Re: linux-next: build failure after merge of the usb tree

Matthias Kaehlcke
2022-05-02T17:49:28Z

On Mon, May 02, 2022 at 07:32:54PM +0200, Greg KH wrote:
> On Mon, May 02, 2022 at 10:09:25AM -0700, Matthias Kaehlcke wrote:
> > On Mon, May 02, 2022 at 01:40:45PM +0200, Greg KH wrote:
> > > On Mon, May 02, 2022 at 09:07:28PM +1000, Stephen Rothwell wrote:
> > > > Hi all,
> > > >
> > > > After merging the usb tree, today's linux-next build (x86_64
> > > > modules_install) failed like this:
> > > >
> > > > depmod: ERROR: Cycle detected: usbcore -> onboard_usb_hub -> usbcore
> > > > depmod: ERROR: Found 2 modules in dependency cycles!
> > > >
> > > > Caused by commit
> > > >
> > > > c40b62216c1a ("usb: core: hcd: Create platform devices for onboard hubs in probe()")
> > > >
> > > > I have reverted that commit for today.
> > >
> > > argh, I thought the build issues were fixed :(
> >
> > Sorry about that :(
> >
> > The *build* issues were actually fixed, however I did not try
> > modules_install ...
> >
> > > I'll go revert that series from my tree later today, thanks for the
> > > report.
> >
> > I think the dependency situation can only be resolved by linking
> > onboard_hub_create/destroy_pdevs() into the USB core module. My initial
> > idea was to build them into the kernel binary, however that doesn't
> > work because onboard_hub_create_pdevs() calls usb_of_get_device_node(),
> > which is part of the core module when CONFIG_USB=m. The two function
> > are relatively lightweight and don't depend on internals of the
> > onboard_usb_hub driver (besides the device id table) so linking them
> > into the core module doesn't seem too ugly.
>
> I'll try to look at this next week, it shouldn't be that complex. If it
> is, something feels wrong...

Thanks!

The root of all these dependency issues is that the core/HCD code
needs to call APIs of the onboard hub driver to create/destroy
platform devices based on the device tree. That's fine when CONFIG_USB=y
and CONFIG_USB_ONBOARD_HUB=y, but gets complicated when modules
come into play, since the core/HCD code depends on the aforementioned
driver functions and the driver depends on symbols from the USB core.