linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: core: skip interfaces disabled in devicetree
@ 2019-02-16 17:04 Mans Rullgard
  2019-02-19 13:11 ` Greg Kroah-Hartman
  2019-02-19 14:52 ` [PATCH v2] " Mans Rullgard
  0 siblings, 2 replies; 5+ messages in thread
From: Mans Rullgard @ 2019-02-16 17:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-usb; +Cc: linux-kernel

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>
---
 drivers/usb/core/message.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index bfa5eda0cc26..6b45d4835e41 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -2007,6 +2007,10 @@ 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))
+			continue;
+
 		dev_dbg(&dev->dev,
 			"adding %s (config #%d, interface %d)\n",
 			dev_name(&intf->dev), configuration,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-19 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-16 17:04 [PATCH] usb: core: skip interfaces disabled in devicetree Mans Rullgard
2019-02-19 13:11 ` Greg Kroah-Hartman
2019-02-19 13:24   ` Måns Rullgård
2019-02-19 13:42     ` Greg Kroah-Hartman
2019-02-19 14:52 ` [PATCH v2] " Mans Rullgard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).