Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp757462img; Thu, 28 Feb 2019 07:24:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbfKsy44JXE4fdbeRiE7cihhcZNTLDDB7Z7i3+hmh/sbHykWNTc/F56qC/+9WzoNFspxxjQ X-Received: by 2002:a63:680a:: with SMTP id d10mr8755308pgc.46.1551367496592; Thu, 28 Feb 2019 07:24:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551367496; cv=none; d=google.com; s=arc-20160816; b=PxkT/es8y/duU4Zv0x2CRfX6CX5ffzYq4hVMLxEwpeHYTFpO2xStXyy0Qd3jtmjGZB DQpgAgG7bWnkqY1FvBKletib9RMfoj9ZVR4VNLBHGZWsMRzF1XDFY23FXiC9Xo1x+Rs+ ZAlNc+KRTJmSQIMtP3Q6jIUdNdFik+j/guvvnR+GZxIt+9h9qASEHQ56YFWhz6ZNZkbp EZW4otyVYObKX+tT/P5fdMuIhKLOT1Kxc07e/eTtKQZzT5lvv3AahF9qWMxwIyG8sCPh lAAnltpQQE096kWh6HLgSLuJF6TobBzaEIi7g2mXEif73tF5qn8EAVSkaJab0EGHkUlA +WtQ== 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=WRBhvtN26PSdu64o1hleA0AVMMVSZ3oGr1/SWsWA0Xg=; b=ULKFJQJFWRNSAPwAiDbPsg6BLLvrdk0ZyuFjaF3SYXHFL6xS2d8/j85BBtjxTA1DUV faXazI+/DKME/TeGLZ2JJlcuq0EemAflHB/y0VW8Zm6rq1+MyqGCbtN5evg8d6LcvHE/ F5ep6oT23Z2Ky347e/dbGKtmyO2aQHuP+792MWewCOP3w5FOivC04uH6ghlGlKEdjXb3 ViDSwkn225ycnPYjoHP+aMGtlQsaDPGHZtXbAJKxPC5M5FX0GQSZ+vRi6bAXRPdtIQzh vAmg2iErJZF265yuDNBAggKPNZH3DZHWFhCqsY40f0ACQ1Azv/47lDFAm3FRZTyD0XiW 4MTA== 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 8si17770267pgz.484.2019.02.28.07.24.41; Thu, 28 Feb 2019 07:24:56 -0800 (PST) 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 S2388960AbfB1PW2 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 28 Feb 2019 10:22:28 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:48126 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732623AbfB1PW0 (ORCPT ); Thu, 28 Feb 2019 10:22:26 -0500 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 66DE015632; Thu, 28 Feb 2019 15:22:24 +0000 (GMT) From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Greg Kroah-Hartman Cc: Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH] dt-bindings: usb: add non-removable device property References: <20190228143344.16312-1-mans@mansr.com> <20190228151330.GA1360@kroah.com> Date: Thu, 28 Feb 2019 15:22:24 +0000 In-Reply-To: <20190228151330.GA1360@kroah.com> (Greg Kroah-Hartman's message of "Thu, 28 Feb 2019 16:13:30 +0100") 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 Greg Kroah-Hartman writes: > On Thu, Feb 28, 2019 at 02:33:44PM +0000, Mans Rullgard wrote: >> Add a boolean property indicating that a device is hardwired to the >> upstream port. Although hubs can provide this information, they are not >> always configured correctly. An alternate means of indicating this for >> built-in USB devices is thus useful. >> >> Signed-off-by: Mans Rullgard >> --- >> I have a situation where userspace would like to know which USB devices >> are built-in, but the on-board hub doesn't have the right setting. >> Also, the hub itself can't be indicated as fixed in any other way that >> I'm aware of. > > Then that's a firmware bug, right? We have a way for firmware to export > this to the USB core, why not use that? Your on-board hub should get a > firmware update with this information, let's not try to create > yet-another-way to define this type of information please. What firmware? This is not an ACPI system, obviously, so DT _is_ the firmware. >> In a way, adding this property seems a bit silly since dt can only >> sensibly be used for hardwired devices in the first place. Thus the >> mere presence of a dt node could be taken to indicate the same thing. >> On the other hand, it's conceivable that someone might dynamically >> generate a devicetree based on what happens to be connected on boot or >> something. For that reason, and explicit property seems safer. >> --- >> Documentation/devicetree/bindings/usb/usb-device.txt | 8 ++++++++ >> 1 file changed, 8 insertions(+) > > Can you show some code actually using this? Again, this should "just > work" for USB today unless your platform is really broken (and if it is, > go complain to the vendor...) You know full well that complaining to the vendor is rarely something that works. Especially not when there are already thousands of the devices in the field. This is how I meant to use it: diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 3adff4da2ee1..81ef3cb705b7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2392,6 +2392,14 @@ static void set_usb_port_removable(struct usb_device *udev) break; } + /* + * Otherwise, check whether DT indicates this device is non-removable. + */ + if (of_property_read_bool(udev->dev.of_node, "non-removable")) { + udev->removable = USB_DEVICE_FIXED; + return; + } + /* * Otherwise, check whether the hub knows whether a port is removable * or not -- M?ns Rullg?rd