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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=XHnRNQQo8i95ROiZPOGqAD_=FfU0uzy83Vigb+Xsr4XQ@mail.gmail.com>
Date:   Fri, 24 Jun 2022 13:33:25 -0700
From:   Doug Anderson <dianders@...omium.org>
To:     Matthias Kaehlcke <mka@...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

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.

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

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...


> +/**
> + * 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.


> + */
> +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.

-Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ