Re: [PATCH] usb: cdns3: attempt to fix Kconfig dependencies

Arnd Bergmann
2026-04-03T18:51:33Z

On Fri, Apr 3, 2026, at 11:26, Peter Chen (CIX) wrote:
> On 26-04-03 10:39:18, Arnd Bergmann wrote:
>> On Fri, Apr 3, 2026, at 09:50, Peter Chen (CIX) wrote:
>
> I am afraid it may need to change more for your patch, otherwise, it could have
> error with below combinations:
>
> USB=y USB_GADGET=y USB_CDNS_SUPPORT=y USB_CDNS_HOST=y
> USB_CDNS_PLATFORM=y USB_CDNS3=y
> USB_CDNS3_GADGET=y USB_CDNS3_HOST=y USB_CDNSP=y USB_CDNSP_GADGET=m
> USB_CDNSP_HOST=y
>
> USB_CDNS_PLATFORM reference to the cdnsp_gadget_init which is built as module.
>
> drivers/usb/cdns3/cdns3-plat.c:52: undefined reference to `cdnsp_gadget_init'

Good catch! I ran into the same one after a few hundred more randonfig
builds and can confirm that your suggested fixup addresses all of the
problems found so far.

> @@ -13,11 +13,13 @@ config USB_CDNS_HOST
> bool
> depends on USB=y || USB=USB_CDNS_SUPPORT
>
> -config CONFIG_USB_CDNS_PLATFORM
> +config USB_CDNS_PLATFORM
> tristate "Cadence USB3 generic platform support"
> depends on USB_CDNSP || USB_CDNS3
> depends on USB_CDNSP || !USB_CDNSP
> depends on USB_CDNS3 || !USB_CDNS3
> + depends on USB_CDNS3_GADGET || !USB_CDNS3_GADGET
> + depends on USB_CDNSP_GADGET || !USB_CDNSP_GADGET
> help
> The platform driver support is needed on any SoC integrating
> a variant of the Cadence USB3 or USBSSP dual-role controllers,

The dependencies here are rather unwieldy, but it does look like
this is the minimum set we need with the current code.

The only other alternative I see would be to split up the
platform driver support into separate modules for cdns3 and
cdnsp as well, which would make the dependencies trivial but
require reworking of the actual in a way that I haven't
been able to figure out yet. If you are already integrating
other changes for the next attempt, maybe you can try to
come up with a solution for this as well.

Arnd