lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YroKgNPY4YHh0kGf@google.com>
Date:   Mon, 27 Jun 2022 12:52:32 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Doug Anderson <dianders@...omium.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Felipe Balbi <balbi@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Ravi Chandra Sadineni <ravisadineni@...omium.org>,
        Bastien Nocera <hadess@...ess.net>,
        Linux USB List <linux-usb@...r.kernel.org>,
        Roger Quadros <rogerq@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Michal Simek <michal.simek@...inx.com>,
        Stephen Boyd <swboyd@...omium.org>,
        Peter Chen <peter.chen@...nel.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Souradeep Chowdhury <quic_schowdhu@...cinc.com>
Subject: Re: [PATCH v23 2/3] usb: misc: Add onboard_usb_hub driver

On Fri, Jun 24, 2022 at 01:33:25PM -0700, Doug Anderson wrote:
> Hi,
> 
> On Wed, Jun 22, 2022 at 2:49 PM Matthias Kaehlcke <mka@...omium.org> wrote:
> >
> > diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> > index 4c5ddbd75b7e..7fd40183a395 100644
> > --- a/drivers/usb/misc/Kconfig
> > +++ b/drivers/usb/misc/Kconfig
> > @@ -295,3 +295,19 @@ config BRCM_USB_PINMAP
> >           This option enables support for remapping some USB external
> >           signals, which are typically on dedicated pins on the chip,
> >           to any gpio.
> > +
> > +config USB_ONBOARD_HUB
> > +       bool "Onboard USB hub support"
> 
> The above needs to be "tristate", not bool.

right, thanks!

> Weirdly the way you have it if you set "CONFIG_USB=m" and
> "CONFIG_USB_ONBOARD_HUB=y" you don't get any compile errors, but also
> the onboard usb hub doesn't even get compiled (!). Once you switch to
> tristate then setting "CONFIG_USB=m" will force the onboard hub to be
> a module too (since it's underneath the "if" in the Kconfig).
> 
> ...ugh, but once you do that then you start getting compile errors if
> you have "CONFIG_USB=y" and "CONFIG_USB_ONBOARD_HUB=m". I guess that
> can be fixed with something like this
> 
> -usbcore-$(CONFIG_USB_ONBOARD_HUB)      += ../misc/onboard_usb_hub_pdevs.o
> +ifdef CONFIG_USB_ONBOARD_HUB
> +usbcore-y                      += ../misc/onboard_usb_hub_pdevs.o
> +endif

Thanks for testing and the suggestion!

> Given the problems we've had in the past, please make sure you test
> with all combinations of "=y" and "=m" for CONFIG_USB and
> CONFIG_USB_ONBOARD_HUB. Note that on sc7180-trogdor devices if you
> want CONFIG_USB to be a module don't forget to also set
> CONFIG_USB_DWC3=m or DWC3 will force you to gadget mode...

ack

I think I did an 'allmodconfig' build only test, but that didn't really help
in this case ...

> > +/**
> > + * onboard_hub_create_pdevs -- create platform devices for onboard USB hubs
> > + * @parent_hub : parent hub to scan for connected onboard hubs
> > + * @pdev_list  : list of onboard hub platform devices owned by the parent hub
> > + *
> > + * Creates a platform device for each supported onboard hub that is connected to
> > + * the given parent hub. The platform device is in charge of initializing the
> > + * hub (enable regulators, take the hub out of reset, ...) and can optionally
> > + * control whether the hub remains powered during system suspend or not.
> > +
> > + * To keep track of the platform devices they are added to
> > + * a list that is owned by the parent hub.
> 
> super nitty, but the above two lines of comment could be word-wrapped better.

Sure, I probably rephrased that at some point and forgot to re-wrap.

> > + */
> > +void onboard_hub_create_pdevs(struct usb_device *parent_hub, struct list_head *pdev_list)
> > +{
> > +       int i;
> > +       struct usb_hcd *hcd = bus_to_hcd(parent_hub->bus);
> 
> As per my response on v22, would you be willing to rename that to
> "parent_hcd"? I'll probably still confuse myself next time I read this
> function, but at least maybe this will help me recognize more quickly
> that this isn't necessarily the child's hcd in the case of the root
> hub.

See my reply on v22, I think 'parent_hcd' could still be confusing and it
might be best to have a more detailed description of the problem. In any
case I'm open to discuss it :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ