From patchwork Sat Feb 16 17:04:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TcOlbnMgUnVsbGfDpXJk?= X-Patchwork-Id: 10816313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FAE81390 for ; Sat, 16 Feb 2019 17:05:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FD5E29443 for ; Sat, 16 Feb 2019 17:05:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F30329EE8; Sat, 16 Feb 2019 17:05:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEBEE29443 for ; Sat, 16 Feb 2019 17:05:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731653AbfBPRFQ (ORCPT ); Sat, 16 Feb 2019 12:05:16 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:39646 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730159AbfBPRFQ (ORCPT ); Sat, 16 Feb 2019 12:05:16 -0500 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 98F9A17C56; Sat, 16 Feb 2019 17:05:14 +0000 (GMT) From: Mans Rullgard To: Greg Kroah-Hartman , 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 Message-Id: <20190216170452.10884-1-mans@mansr.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,