lkml.org 
[lkml]   [2022]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] extcon: ptn5150: add usb role class support
Date


> -----Original Message-----
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Sent: Tuesday, April 19, 2022 4:30 PM
> To: Jun Li <jun.li@nxp.com>
> Cc: myungjoo.ham@samsung.com; cw00.choi@samsung.com;
> linux-kernel@vger.kernel.org; Frank Li <frank.li@nxp.com>; Xu Yang
> <xu.yang_2@nxp.com>
> Subject: Re: [PATCH] extcon: ptn5150: add usb role class support
>
> On 19/04/2022 10:23, Jun Li wrote:
> >
> >
> >> -----Original Message-----
> >> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >> Sent: Tuesday, April 19, 2022 3:57 PM
> >> To: Jun Li <jun.li@nxp.com>
> >> Cc: myungjoo.ham@samsung.com; cw00.choi@samsung.com;
> >> linux-kernel@vger.kernel.org; Frank Li <frank.li@nxp.com>; Xu Yang
> >> <xu.yang_2@nxp.com>
> >> Subject: Re: [PATCH] extcon: ptn5150: add usb role class support
> >>
> >> On Tue, 19 Apr 2022 at 09:53, Jun Li <jun.li@nxp.com> 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-li
> nux/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'
>
> This is some old kernel - v5.15. Please test your changes on mainline. I
> don't see such issue can happen on a recent kernel - there is an EXPORT and
> a stub. Maybe your driver misses proper headers?

I am working on Linux-next 20220414

commit 40354149f4d738dc3492d9998e45b3f02950369a (tag: next-20220414, origin/master, origin/HEAD)
Author: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu Apr 14 15:22:31 2022 +1000

Add linux-next specific files for 20220414

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

My test config is making USB_ROLE_SWITCH=m, but PTN5150=y

So with below header file:

#if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
void usb_role_switch_put(struct usb_role_switch *sw);
#else
static inline void usb_role_switch_put(struct usb_role_switch *sw) { }
#endif

Will have link error.

Thanks
Li Jun
>
> Best regards,
> Krzysztof
\
 
 \ /
  Last update: 2022-04-19 10:53    [W:0.052 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site