[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025010805-frostlike-engorge-fe1a@gregkh>
Date: Wed, 8 Jan 2025 13:35:01 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Ying Hsu <yinghsu@...omium.org>
Cc: linux-bluetooth@...r.kernel.org, luiz.dentz@...il.com,
chromeos-bluetooth-upstreaming@...omium.org,
Marcel Holtmann <marcel@...tmann.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB
alt setting
On Fri, Dec 13, 2024 at 12:04:22PM +0800, Ying Hsu wrote:
> When a Bluetooth raw socket is open, the HCI event related to SCO
> connection changes are not dispatched to the hci_event module, and
> the underlying Bluetooth controller's USB Interface 1 will not be
> updated accordingly.
>
> This patch adds `isoc_alt` sysfs attribute, allowing user space
> to update the alternate setting of the USB interface alternate
> setting as needed.
>
> Signed-off-by: Ying Hsu <yinghsu@...omium.org>
> ---
> This commit has been tested on a chromebook with AX211.
>
> Changes in v2:
> - Add check for the existence of a valid USB interface 1.
You forgot a Documentation/ABI/ entry.
Also, the code isn't quite right:
> @@ -4008,6 +4034,10 @@ static int btusb_probe(struct usb_interface *intf,
> data->isoc, data);
> if (err < 0)
> goto out_free_dev;
> +
> + err = device_create_file(&intf->dev, &dev_attr_isoc_alt);
> + if (err)
> + goto out_free_dev;
You just raced with userspace and lost. Please properly use a device
group instead. That makes for smaller code, and it works properly.
thanks,
greg k-h
Powered by blists - more mailing lists