[PATCH] ARM: multi_v7_defconfig: Select CONFIG_USB_ONBOARD_DEV as built-in
Fabio Estevam
festevam at gmail.com
Wed May 1 16:04:17 PDT 2024
Adding Matthias, the onboard usb hub driver maintainer.
On Tue, Apr 30, 2024 at 5:25 PM Arnd Bergmann <arnd at arndb.de> wrote:
>
> On Tue, Apr 30, 2024, at 21:53, Fabio Estevam wrote:
> > On Tue, Apr 30, 2024 at 4:53 AM Arnd Bergmann <arnd at arndb.de> wrote:
> >
> >> It does sound like this is something the kernel should be able to
> >> get to work properly in some form, but I don't think making it
> >> a 'bool' symbol is the correct answer here: if CONFIG_USB is
> >> set to =m, it would be impossible to include USB_ONBOARD_DEV
> >> in this case.
> >>
> >> Fabio, can you explain how making it built-in addresses the
> >> problem here? I assume this is related to probe order, so I
> >> wonder if it's just a matter of making the usb hub driver
> >> properly handle -EPROBE_DEFER until the onboard dev has been
> >> initialized.
> >
> > From drivers/usb/misc/Kconfig:
> >
> > "config USB_ONBOARD_DEV
> > tristate "Onboard USB device support"
> > .....
> > This driver can be used as a module but its state (module vs
> > builtin) must match the state of the USB subsystem. Enabling
> > this config will enable the driver and it will automatically
> > match the state of the USB subsystem. If this driver is a
> > module it will be called onboard_usb_dev."
>
> Ok, so there is some kind of design mistake here that this
> is trying to paper over. Kbuild should always be powerful
> enough to enforce these things without having a person read
> a comment though.
>
> > In multi_v7_defconfig:
> > CONFIG_USB=y and CONFIG_USB_ONBOARD_DEV=m, so there is a mismatch.
> >
> > My patch enforces CONFIG_USB_ONBOARD_DEV=y to guarantee the matching.
> >
> > Is there any other way to solve this?
>
> I can think of multiple ways to enforce this in Kbuild:
>
> a) make CONFIG_USB_ONBOARD_DEV a 'bool' symbol and then add
> a hidden symbol that duplicates the state of CONFIG_USB when
> USB_ONBOARD_DEV is enabled:
>
> config CONFIG_USB_ONBOARD_DEV_MODULE
> def_tristate USB
> depends on CONFIG_USB_ONBOARD_DEV
>
> b) Do the same thing but use Makefile syntax instead of Kconfig
> syntax:
>
> usb-onboard-dev-$(CONFIG_USB_ONBOARD_DEV) += onboard_usb_dev.o
> obj-$(CONFIG_USB) += usb-onboard-dev.o
>
> (or something close to this, need to try).
>
>
> However, I still feel there should be a better way to solve
> the problem at the code level rather than the Kbuild level.
>
> I don't know exactly how a "usb_device_driver" (as opposed
> to a "usb_driver") works here, but from what I can tell,
> the idea here is that the USB bus probe finds a device, matches
> the driver and then continues probing it. If the onboard-dev
> driver gets loaded after the initial bus probe, that driver
> won't exist yet and it then runs into some error that
> prevents it from being retried when after the onboard-dev
> driver is there. If you can pinpoint exactly what error it
> runs into, try to make it retry the same thing after
> -EPROBE_DEFER.
>
> Arnd
More information about the linux-arm-kernel
mailing list