Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4897007yba; Wed, 8 May 2019 04:49:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOlUSpQF8AiWGYzbJhmdrpGGkMjsgv3DoRblCWuMRnymPezlA278G7H8tyDILYbgM8EiLL X-Received: by 2002:a63:246:: with SMTP id 67mr15218804pgc.145.1557316154221; Wed, 08 May 2019 04:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557316154; cv=none; d=google.com; s=arc-20160816; b=aPgtm6sxKLEj+uEKwCQnY9VnW3NDX6DrH4iQ7AQKFGQDQo4yJld/HFiMpawvZEAwXG MELyHhzl5wJ0B680U9n2j+xlhdAybDc5yoAIxOC7E3Y9SLiHRxI0Fx1SY8ZHPdiX3xXU ElW7mWsR9rfD7zfc1FZXiPvfJvMkyozSIGAua5z2Yj48uzWNLsH+TE6krbzE0i22mi8b J+JKDnEeH2k9rvgHuHWNTw7dwAHFYZu95LLWcoLhLVAqQ8NYce8gvvyezYCjgP98BOey EYK1axjpyGn/8oCWdQG4a/V45a1/nQGZoC8zYpbbxyehcqCi2ifxsHAxcFR/skGhRsAr bkFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from; bh=pFOKAclREHk/9smhqxfZFXHhTMs6nRTNZM4Qa4ht3bI=; b=0YJkrrw53p2njsxmqfb9e29bUNwNvaUBAbEvj2VMbsUgSnxz24Tm4nfIWTU483FYep nRirp6QU0LhXtidPSBTMJpnoVvDHydblLi5693RTvoUO1E8MNXAtx1fp514/pHtUOajS KLcXfC1DptBiBmQXO7HQGOoo4SXhbEzItZrfebP0AMYYxbEzoUrUbXrfjVJ29cz1azYf d/pkuoXHQ2H9q31XCy09XwpIyxfnNBBX5eo9iCkj1rGDH+hV7/s2CTzXdsnCtFN3mZlU Sm0Zeb7TBpTdsGEHRjlKPF2gIhw+eonyNGXGE8+V7IS3bSMIdlhtugfT+poFNx//1gRT HFeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si8874375pgh.331.2019.05.08.04.48.58; Wed, 08 May 2019 04:49:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbfEHLqf convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 May 2019 07:46:35 -0400 Received: from unicorn.mansr.com ([81.2.72.234]:35024 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727545AbfEHLqf (ORCPT ); Wed, 8 May 2019 07:46:35 -0400 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 2C80F149B7; Wed, 8 May 2019 12:46:33 +0100 (BST) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Marek Szyprowski Cc: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Markus Reichl , Krzysztof Kozlowski Subject: Re: [PATCH v2] usb: core: verify devicetree nodes for disabled interfaces References: <106fc58c-1a4f-6605-41d7-b6031c5751a3@samsung.com> <20190508104434.3409-1-m.szyprowski@samsung.com> Date: Wed, 08 May 2019 12:46:33 +0100 In-Reply-To: <20190508104434.3409-1-m.szyprowski@samsung.com> (Marek Szyprowski's message of "Wed, 08 May 2019 12:44:34 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Marek Szyprowski writes: > Commit 01fdf179f4b0 ("usb: core: skip interfaces disabled in devicetree") > add support for disabling given USB device interface by adding nodes to > the USB host controller device. The mentioned commit however identifies > the given USB interface node only by the 'reg' property in the host > controller children nodes and then checks for their the 'status'. The USB > device interface nodes however also has to have a 'compatible' property as > described in Documentation/devicetree/bindings/usb/usb-device.txt. This is > important, because USB host controller might have child-nodes for other > purposes. For example, Exynos EHCI and OHCI drivers already define > child-nodes for each physical root hub port and assigns respective PHY > controller and parameters for them. This conflicts with the proposed > approach and verifying for the presence of the compatible property fixes > this issue without changing the bindings and the way the PHY controllers > are handled by Exynos EHCI/OHCI drivers. > > Reported-by: Markus Reichl > Fixes: 01fdf179f4b0 ("usb: core: skip interfaces disabled in devicetree") > Signed-off-by: Marek Szyprowski > --- > drivers/usb/core/message.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c > index e844bb7b5676..6f7d047392bd 100644 > --- a/drivers/usb/core/message.c > +++ b/drivers/usb/core/message.c > @@ -2009,6 +2009,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) > struct usb_interface *intf = cp->interface[i]; > > if (intf->dev.of_node && > + of_find_property(intf->dev.of_node, "compatible", NULL) && > !of_device_is_available(intf->dev.of_node)) { > dev_info(&dev->dev, "skipping disabled interface %d\n", > intf->cur_altsetting->desc.bInterfaceNumber); > -- I don't think this is the right approach. We don't want to be adding such checks everywhere the of_node is used. A better way might be to not set of_node at all in the absence of a proper "compatible" string. Then there's the problem of how to resolve the incompatibility between the generic USB and Exynos bindings. One possible fix could be to use a child node of the controller node to represent the root hub. Since the driver currently doesn't work at all if a devicetree has nodes for USB devices, there should be no compatibility concerns. -- M?ns Rullg?rd