lkml.org 
[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v23 2/3] usb: misc: Add onboard_usb_hub driver
Hi,

On Wed, Jun 22, 2022 at 2:49 PM Matthias Kaehlcke <mka@chromium.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

\
 
 \ /
  Last update: 2022-06-24 22:35    [W:0.067 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site