usb: core: skip interfaces disabled in devicetree

If an interface has an associated devicetree node with status disabled,
do not register the device.  This is useful for boards with a built-in
multifunction USB device where some functions are broken or otherwise
undesired.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Mans Rullgard 2019-02-19 14:52:26 +00:00 коммит произвёл Greg Kroah-Hartman
Родитель eb76b37aaf
Коммит 01fdf179f4
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -2006,6 +2006,13 @@ free_interfaces:
for (i = 0; i < nintf; ++i) { for (i = 0; i < nintf; ++i) {
struct usb_interface *intf = cp->interface[i]; struct usb_interface *intf = cp->interface[i];
if (intf->dev.of_node &&
!of_device_is_available(intf->dev.of_node)) {
dev_info(&dev->dev, "skipping disabled interface %d\n",
intf->cur_altsetting->desc.bInterfaceNumber);
continue;
}
dev_dbg(&dev->dev, dev_dbg(&dev->dev,
"adding %s (config #%d, interface %d)\n", "adding %s (config #%d, interface %d)\n",
dev_name(&intf->dev), configuration, dev_name(&intf->dev), configuration,