linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mans Rullgard <mans@mansr.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] usb: core: skip interfaces disabled in devicetree
Date: Sat, 16 Feb 2019 17:04:52 +0000	[thread overview]
Message-ID: <20190216170452.10884-1-mans@mansr.com> (raw)

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


             reply	other threads:[~2019-02-16 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16 17:04 Mans Rullgard [this message]
2019-02-19 13:11 ` [PATCH] usb: core: skip interfaces disabled in devicetree 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190216170452.10884-1-mans@mansr.com \
    --to=mans@mansr.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).