Message ID | 20190219145226.3809-1-mans@mansr.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 01fdf179f4b064d4c9d30b39aba178caf32649f4 |
Headers | show |
Series | [v2] usb: core: skip interfaces disabled in devicetree | expand |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index bfa5eda0cc26..46bf79bc03ad 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -2007,6 +2007,13 @@ int usb_set_configuration(struct usb_device *dev, int configuration) for (i = 0; i < nintf; ++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, "adding %s (config #%d, interface %d)\n", dev_name(&intf->dev), configuration,
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> --- Changed in v2: - print message about skipped interfaces --- drivers/usb/core/message.c | 7 +++++++ 1 file changed, 7 insertions(+)