Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: Clarify expected behavior of dev_bin_attrs_are_visible()

The commit "usb: Export BOS descriptor to sysfs" added a binary attribute
group to sysfs. It doesn't check if the descriptors attribute should be
visible, which is by design and not an oversight. Update a comment so that
it better explains this in the dev_bin_attrs_are_visible() function.

Signed-off-by: Elbert Mai <code@elbertmai.com>
Link: https://lore.kernel.org/r/20240306001503.313028-1-code@elbertmai.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Elbert Mai and committed by
Greg Kroah-Hartman
dfea1898 28cbed49

+5 -2
+5 -2
drivers/usb/core/sysfs.c
··· 929 929 struct device *dev = kobj_to_dev(kobj); 930 930 struct usb_device *udev = to_usb_device(dev); 931 931 932 - /* All USB devices have a device descriptor, so the descriptors 933 - * attribute always exists. No need to check for its visibility. 932 + /* 933 + * There's no need to check if the descriptors attribute should 934 + * be visible because all devices have a device descriptor. The 935 + * bos_descriptors attribute should be visible if and only if 936 + * the device has a BOS, so check if it exists here. 934 937 */ 935 938 if (a == &bin_attr_bos_descriptors) { 936 939 if (udev->bos == NULL)