RE: [PATCH] extcon: ptn5150: add usb role class support

From: Jun Li
Date: Tue Apr 19 2022 - 04:23:48 EST




> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Sent: Tuesday, April 19, 2022 3:57 PM
> To: Jun Li <jun.li@xxxxxxx>
> Cc: myungjoo.ham@xxxxxxxxxxx; cw00.choi@xxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; Frank Li <frank.li@xxxxxxx>; Xu Yang
> <xu.yang_2@xxxxxxx>
> Subject: Re: [PATCH] extcon: ptn5150: add usb role class support
>
> On Tue, 19 Apr 2022 at 09:53, Jun Li <jun.li@xxxxxxx> wrote:
> > > > > @@ -132,6 +132,7 @@ config EXTCON_PTN5150
> > > > > tristate "NXP PTN5150 CC LOGIC USB EXTCON support"
> > > > > depends on I2C && (GPIOLIB || COMPILE_TEST)
> > > > > select REGMAP_I2C
> > > > > + select USB_ROLE_SWITCH
> > > >
> > > > You do not need to select it. Driver will work without role
> > > > switch, won't it? If it works, then probably it should be just imply.
> > >
> > > Okay, usb role class provider should enable this for me, will drop it.
> >
> > A second check on this and I think I still need this, there maybe some
> > usb controller driver without usb role switch
> > + ptn5150 via extcon, so no need USB_ROLE_SWITCH, I need
> > select it to avoid build break.
>
> What build problem exactly? Aren't there stubs for !USB_ROLE_SWITCH case?

Mostly cases USB_ROLE_SWITCH is enabled, but I cannot 100% ensure
that, at least I can via make menuconfig change by removing some
controllers drivers to create a config to generate a build break:

/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: drivers/extcon/extcon-ptn5150.o: in function `ptn5150_work_sync_and_put':
extcon-ptn5150.c:(.text+0x20): undefined reference to `usb_role_switch_put'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: drivers/extcon/extcon-ptn5150.o: in function `ptn5150_check_state':
extcon-ptn5150.c:(.text+0xc8): undefined reference to `usb_role_switch_set_role'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: extcon-ptn5150.c:(.text+0x138): undefined reference to `usb_role_switch_set_role'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: extcon-ptn5150.c:(.text+0x14c): undefined reference to `usb_role_string'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: drivers/extcon/extcon-ptn5150.o: in function `ptn5150_irq_work':
extcon-ptn5150.c:(.text+0x290): undefined reference to `usb_role_switch_set_role'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: drivers/extcon/extcon-ptn5150.o: in function `ptn5150_i2c_probe':
extcon-ptn5150.c:(.text+0x4f4): undefined reference to `usb_role_switch_get'
/opt/fsl-imx-internal-xwayland/5.15-honister/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld: extcon-ptn5150.c:(.text+0x530): undefined reference to `usb_role_switch_put'
make: *** [Makefile:1247: vmlinux] Error 1

thanks
Li Jun

>
> Best regards,
> Krzysztof