summaryrefslogtreecommitdiff
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2019-02-19 14:52:26 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 11:29:01 +0100
commit01fdf179f4b064d4c9d30b39aba178caf32649f4 (patch)
tree5650c0f700cdc45b7d1a9754dcbcc4d5fa276565 /drivers/usb/core
parenteb76b37aaf7e6bdd6638bf5b2ef29688645e03b8 (diff)
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>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/message.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 4f33eb632a88..82239f27c4cc 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -2006,6 +2006,13 @@ free_interfaces:
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,