From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 272DEC4727D for ; Mon, 5 Oct 2020 19:36:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF939212CC for ; Mon, 5 Oct 2020 19:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729435AbgJETgM (ORCPT ); Mon, 5 Oct 2020 15:36:12 -0400 Received: from netrider.rowland.org ([192.131.102.5]:45865 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1729302AbgJETgM (ORCPT ); Mon, 5 Oct 2020 15:36:12 -0400 Received: (qmail 390590 invoked by uid 1000); 5 Oct 2020 15:36:11 -0400 Date: Mon, 5 Oct 2020 15:36:11 -0400 From: Alan Stern To: Matthias Kaehlcke Cc: Rob Herring , Doug Anderson , Greg Kroah-Hartman , Frank Rowand , "linux-kernel@vger.kernel.org" , Linux USB List , Bastien Nocera , Stephen Boyd , Ravi Chandra Sadineni , Krzysztof Kozlowski , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Peter Chen Subject: Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete onboard USB hubs Message-ID: <20201005193611.GA389867@rowland.harvard.edu> References: <20201002183633.GA296334@rowland.harvard.edu> <20201003124142.GA318272@rowland.harvard.edu> <20201005160655.GA4135817@google.com> <20201005161527.GI376584@rowland.harvard.edu> <20201005191812.GB4135817@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201005191812.GB4135817@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 12:18:12PM -0700, Matthias Kaehlcke wrote: > On Mon, Oct 05, 2020 at 12:15:27PM -0400, Alan Stern wrote: > > The conclusion is that we need to have code that is aware of some > > detailed needs of a specific device but is not part of the device's > > driver. I'm not sure what the best way to implement this would be. > > Wouldn't it be possible to load the module when the DT specifies that > the device exists? For USB the kernel would need the VID/PID to identify > the module, these could be extracted from the compatible string. Loading a driver module whenever DT says a device exists? Not a bad idea. I don't know what would be involved, but no doubt it is possible. Note that, except for a few special cases, the kernel identifies the appropriate driver for USB hubs not by the VID/PID but instead by the device class or interface class. I suppose the compatible string could include that information too? > Having the initialization code outside of the driver could lead to code > duplication, since the driver might want to power the device down in > certain situations (e.g. system suspend). True. On the other hand, how common do you think it would be for drivers not to want to mess with the power settings? Alan Stern