2022-05-10 10:24:26

by guanjing (D)

[permalink] [raw]
Subject: [PATCH -next] usb: dwc3: include extcon.h to fix compile error

If dwc3 is not include extcon.h, the dwc3 driver
will fail to link:

drivers/usb/dwc3/core.o: In function `dwc3_probe':
core.c:(.text+0x1095): undefined reference to `extcon_get_edev_by_phandle'
core.c:(.text+0x10bd): undefined reference to `extcon_get_extcon_dev'

Add miss #include <linux/extcon.h> to fix this error.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Guan Jing <[email protected]>
---
drivers/usb/dwc3/core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 950e238c65bf..ea7259443283 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -33,6 +33,7 @@
#include <linux/usb/gadget.h>
#include <linux/usb/of.h>
#include <linux/usb/otg.h>
+#include <linux/extcon.h>

#include "core.h"
#include "gadget.h"
--
2.17.1



2022-05-10 13:48:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH -next] usb: dwc3: include extcon.h to fix compile error

On Tue, May 10, 2022 at 04:20:29PM +0800, Guan Jing wrote:
> If dwc3 is not include extcon.h, the dwc3 driver
> will fail to link:
>
> drivers/usb/dwc3/core.o: In function `dwc3_probe':
> core.c:(.text+0x1095): undefined reference to `extcon_get_edev_by_phandle'
> core.c:(.text+0x10bd): undefined reference to `extcon_get_extcon_dev'
>
> Add miss #include <linux/extcon.h> to fix this error.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Guan Jing <[email protected]>
> ---
> drivers/usb/dwc3/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 950e238c65bf..ea7259443283 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -33,6 +33,7 @@
> #include <linux/usb/gadget.h>
> #include <linux/usb/of.h>
> #include <linux/usb/otg.h>
> +#include <linux/extcon.h>
>
> #include "core.h"
> #include "gadget.h"
> --
> 2.17.1
>

Very odd, I do not see these build errors here.

What commit id does this change fix? What caused the problem?

And please put the extcon.h include above the usb includes, as that's
the better place for it, right?

thanks,

greg k-h

2022-05-11 05:26:00

by guanjing (D)

[permalink] [raw]
Subject: Re: [PATCH -next] usb: dwc3: include extcon.h to fix compile error

Thanks for your reply, when CONFIG_EXTCON is "m", we will see these
build error.


Fixes: 0f0101719138 ("usb: dwc3: Don't switch OTG -> peripheral if
extcon is present")


I have pasted the config file in the attachment.


On 2022/5/10 16:28, Greg KH wrote:
> On Tue, May 10, 2022 at 04:20:29PM +0800, Guan Jing wrote:
>> If dwc3 is not include extcon.h, the dwc3 driver
>> will fail to link:
>>
>> drivers/usb/dwc3/core.o: In function `dwc3_probe':
>> core.c:(.text+0x1095): undefined reference to `extcon_get_edev_by_phandle'
>> core.c:(.text+0x10bd): undefined reference to `extcon_get_extcon_dev'
>>
>> Add miss #include <linux/extcon.h> to fix this error.
>>
>> Reported-by: Hulk Robot <[email protected]>
>> Signed-off-by: Guan Jing <[email protected]>
>> ---
>> drivers/usb/dwc3/core.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index 950e238c65bf..ea7259443283 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -33,6 +33,7 @@
>> #include <linux/usb/gadget.h>
>> #include <linux/usb/of.h>
>> #include <linux/usb/otg.h>
>> +#include <linux/extcon.h>
>>
>> #include "core.h"
>> #include "gadget.h"
>> --
>> 2.17.1
>>
> Very odd, I do not see these build errors here.
>
> What commit id does this change fix? What caused the problem?
>
> And please put the extcon.h include above the usb includes, as that's
> the better place for it, right?
>
> thanks,
>
> greg k-h
> .
>


Attachments:
.config (130.42 kB)

2022-05-13 06:27:43

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH -next] usb: dwc3: include extcon.h to fix compile error

On Wed, May 11, 2022 at 10:05:56AM +0800, guanjing (D) wrote:
> Thanks for your reply, when CONFIG_EXTCON is "m", we will see these build
> error.
>
>
> Fixes: 0f0101719138 ("usb: dwc3: Don't switch OTG -> peripheral if extcon is
> present")
>
>
> I have pasted the config file in the attachment.

Your .config builds just fine for me here. Are you sure you are working
with a clean tree?

thanks,

greg k-h