2019-04-04 10:47:00

by Yue Haibing

[permalink] [raw]
Subject: [PATCH] extcon: axp288: Fix build err without CONFIG_ACPI

From: YueHaibing <[email protected]>

When building CONFIG_ACPI is not set
gcc warn this:

drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
put_device(&adev->dev);

Reported-by: Hulk Robot <[email protected]>
Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
Signed-off-by: YueHaibing <[email protected]>
---
drivers/extcon/extcon-axp288.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 50f9402..ed8ac3f 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -333,7 +333,6 @@ static int axp288_extcon_probe(struct platform_device *pdev)
struct axp288_extcon_info *info;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev;
- struct acpi_device *adev;
int ret, i, pirq;

info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,6 +356,8 @@ static int axp288_extcon_probe(struct platform_device *pdev)
if (ret)
return ret;

+#ifdef CONFIG_ACPI
+ struct acpi_device *adev;
adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
if (adev) {
info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
@@ -365,9 +366,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
return -EPROBE_DEFER;

dev_info(dev, "controlling USB role\n");
- } else {
- dev_info(dev, "controlling USB role based on Vbus presence\n");
}
+#else
+ dev_info(dev, "controlling USB role based on Vbus presence\n");
+#endif
}

info->vbus_attach = axp288_get_vbus_attach(info);
--
2.7.4



2019-04-04 11:48:56

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] extcon: axp288: Fix build err without CONFIG_ACPI


On 4/4/2019 4:12 PM, Yue Haibing wrote:
> From: YueHaibing <[email protected]>
>
> When building CONFIG_ACPI is not set
> gcc warn this:
>
> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
> put_device(&adev->dev);
>
> Reported-by: Hulk Robot <[email protected]>
> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <[email protected]>


Looks fine to me.
Reviewed-by: Mukesh Ojha <[email protected]>

Cheers,
-Mukesh

> ---
> drivers/extcon/extcon-axp288.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 50f9402..ed8ac3f 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -333,7 +333,6 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> struct axp288_extcon_info *info;
> struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> struct device *dev = &pdev->dev;
> - struct acpi_device *adev;
> int ret, i, pirq;
>
> info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> @@ -357,6 +356,8 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> +#ifdef CONFIG_ACPI
> + struct acpi_device *adev;
> adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
> if (adev) {
> info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
> @@ -365,9 +366,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> return -EPROBE_DEFER;
>
> dev_info(dev, "controlling USB role\n");
> - } else {
> - dev_info(dev, "controlling USB role based on Vbus presence\n");
> }
> +#else
> + dev_info(dev, "controlling USB role based on Vbus presence\n");
> +#endif
> }
>
> info->vbus_attach = axp288_get_vbus_attach(info);

2019-04-04 12:04:00

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH] extcon: axp288: Fix build err without CONFIG_ACPI

Hi,

On 04-04-19 12:42, Yue Haibing wrote:
> From: YueHaibing <[email protected]>
>
> When building CONFIG_ACPI is not set
> gcc warn this:
>
> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
> put_device(&adev->dev);
>
> Reported-by: Hulk Robot <[email protected]>
> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
> Signed-off-by: YueHaibing <[email protected]>

Using this driver without ACPI makes little sense, IMHO it would be better to add
a depends on ACPI to the Kconfig entry, rather then adding #ifdef-s to the driver.

Regards,

Hans


> ---
> drivers/extcon/extcon-axp288.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 50f9402..ed8ac3f 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -333,7 +333,6 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> struct axp288_extcon_info *info;
> struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> struct device *dev = &pdev->dev;
> - struct acpi_device *adev;
> int ret, i, pirq;
>
> info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> @@ -357,6 +356,8 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> +#ifdef CONFIG_ACPI
> + struct acpi_device *adev;
> adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
> if (adev) {
> info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
> @@ -365,9 +366,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> return -EPROBE_DEFER;
>
> dev_info(dev, "controlling USB role\n");
> - } else {
> - dev_info(dev, "controlling USB role based on Vbus presence\n");
> }
> +#else
> + dev_info(dev, "controlling USB role based on Vbus presence\n");
> +#endif
> }
>
> info->vbus_attach = axp288_get_vbus_attach(info);
>

2019-04-04 13:27:45

by Yue Haibing

[permalink] [raw]
Subject: Re: [PATCH] extcon: axp288: Fix build err without CONFIG_ACPI

On 2019/4/4 20:02, Hans de Goede wrote:
> Hi,
>
> On 04-04-19 12:42, Yue Haibing wrote:
>> From: YueHaibing <[email protected]>
>>
>> When building CONFIG_ACPI is not set
>> gcc warn this:
>>
>> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
>> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
>> put_device(&adev->dev);
>>
>> Reported-by: Hulk Robot <[email protected]>
>> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
>> Signed-off-by: YueHaibing <[email protected]>
>
> Using this driver without ACPI makes little sense, IMHO it would be better to add
> a depends on ACPI to the Kconfig entry, rather then adding #ifdef-s to the driver.

OK, thank for your commnet, I will send v2 as this.

>
> Regards,
>
> Hans
>
>
>> ---
>> drivers/extcon/extcon-axp288.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
>> index 50f9402..ed8ac3f 100644
>> --- a/drivers/extcon/extcon-axp288.c
>> +++ b/drivers/extcon/extcon-axp288.c
>> @@ -333,7 +333,6 @@ static int axp288_extcon_probe(struct platform_device *pdev)
>> struct axp288_extcon_info *info;
>> struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
>> struct device *dev = &pdev->dev;
>> - struct acpi_device *adev;
>> int ret, i, pirq;
>> info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
>> @@ -357,6 +356,8 @@ static int axp288_extcon_probe(struct platform_device *pdev)
>> if (ret)
>> return ret;
>> +#ifdef CONFIG_ACPI
>> + struct acpi_device *adev;
>> adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
>> if (adev) {
>> info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
>> @@ -365,9 +366,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
>> return -EPROBE_DEFER;
>> dev_info(dev, "controlling USB role\n");
>> - } else {
>> - dev_info(dev, "controlling USB role based on Vbus presence\n");
>> }
>> +#else
>> + dev_info(dev, "controlling USB role based on Vbus presence\n");
>> +#endif
>> }
>> info->vbus_attach = axp288_get_vbus_attach(info);
>>
>
> .
>

2019-04-04 14:20:49

by Yue Haibing

[permalink] [raw]
Subject: [PATCH v2] extcon: axp288: Add a depends on ACPI to the Kconfig entry

From: YueHaibing <[email protected]>

As Hans de Goede pointed, using this driver without ACPI
makes little sense, so add ACPI dependency to Kconfig entry
to fix a build error while CONFIG_ACPI is not set.

drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
put_device(&adev->dev);

Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
Reported-by: Hulk Robot <[email protected]>
Suggested-by: Hans de Goede <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
v2: rework patch
---
drivers/extcon/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 1ed4b45..de06faf 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -30,7 +30,7 @@ config EXTCON_ARIZONA

config EXTCON_AXP288
tristate "X-Power AXP288 EXTCON support"
- depends on MFD_AXP20X && USB_SUPPORT && X86
+ depends on MFD_AXP20X && USB_SUPPORT && X86 && ACPI
select USB_ROLE_SWITCH
help
Say Y here to enable support for USB peripheral detection
--
2.7.4


2019-04-04 14:46:59

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v2] extcon: axp288: Add a depends on ACPI to the Kconfig entry

Hi,

On 04-04-19 16:17, Yue Haibing wrote:
> From: YueHaibing <[email protected]>
>
> As Hans de Goede pointed, using this driver without ACPI
> makes little sense, so add ACPI dependency to Kconfig entry
> to fix a build error while CONFIG_ACPI is not set.
>
> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
> put_device(&adev->dev);
>
> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
> Reported-by: Hulk Robot <[email protected]>
> Suggested-by: Hans de Goede <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Patch looks to me, thanks:

Reviewed-by: Hans de Goede <[email protected]>

Regards,

Hans


> ---
> v2: rework patch
> ---
> drivers/extcon/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
> index 1ed4b45..de06faf 100644
> --- a/drivers/extcon/Kconfig
> +++ b/drivers/extcon/Kconfig
> @@ -30,7 +30,7 @@ config EXTCON_ARIZONA
>
> config EXTCON_AXP288
> tristate "X-Power AXP288 EXTCON support"
> - depends on MFD_AXP20X && USB_SUPPORT && X86
> + depends on MFD_AXP20X && USB_SUPPORT && X86 && ACPI
> select USB_ROLE_SWITCH
> help
> Say Y here to enable support for USB peripheral detection
>

2019-04-05 05:37:38

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH v2] extcon: axp288: Add a depends on ACPI to the Kconfig entry


On 4/4/2019 7:47 PM, Yue Haibing wrote:
> From: YueHaibing <[email protected]>
>
> As Hans de Goede pointed, using this driver without ACPI
> makes little sense, so add ACPI dependency to Kconfig entry
> to fix a build error while CONFIG_ACPI is not set.
>
> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
> put_device(&adev->dev);
>
> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
> Reported-by: Hulk Robot <[email protected]>
> Suggested-by: Hans de Goede <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

This looks good too.
Reviewed-by: Mukesh Ojha <[email protected]>

Cheers,
-Mukesh

> ---
> v2: rework patch
> ---
> drivers/extcon/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
> index 1ed4b45..de06faf 100644
> --- a/drivers/extcon/Kconfig
> +++ b/drivers/extcon/Kconfig
> @@ -30,7 +30,7 @@ config EXTCON_ARIZONA
>
> config EXTCON_AXP288
> tristate "X-Power AXP288 EXTCON support"
> - depends on MFD_AXP20X && USB_SUPPORT && X86
> + depends on MFD_AXP20X && USB_SUPPORT && X86 && ACPI
> select USB_ROLE_SWITCH
> help
> Say Y here to enable support for USB peripheral detection

2019-04-11 23:31:10

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v2] extcon: axp288: Add a depends on ACPI to the Kconfig entry

On 19. 4. 4. 오후 11:17, Yue Haibing wrote:
> From: YueHaibing <[email protected]>
>
> As Hans de Goede pointed, using this driver without ACPI
> makes little sense, so add ACPI dependency to Kconfig entry
> to fix a build error while CONFIG_ACPI is not set.
>
> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
> put_device(&adev->dev);
>
> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
> Reported-by: Hulk Robot <[email protected]>
> Suggested-by: Hans de Goede <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> v2: rework patch
> ---
> drivers/extcon/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
> index 1ed4b45..de06faf 100644
> --- a/drivers/extcon/Kconfig
> +++ b/drivers/extcon/Kconfig
> @@ -30,7 +30,7 @@ config EXTCON_ARIZONA
>
> config EXTCON_AXP288
> tristate "X-Power AXP288 EXTCON support"
> - depends on MFD_AXP20X && USB_SUPPORT && X86
> + depends on MFD_AXP20X && USB_SUPPORT && X86 && ACPI
> select USB_ROLE_SWITCH
> help
> Say Y here to enable support for USB peripheral detection
>

Applied it. Thanks.

--
Best Regards,
Chanwoo Choi
Samsung Electronics

2019-04-12 00:59:36

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v2] extcon: axp288: Add a depends on ACPI to the Kconfig entry

Dear all,

+ [email protected]

It should be posted to [email protected]
in order to merge it to stable tree.

Regards,
Chanwoo Choi


On 19. 4. 12. 오전 8:30, Chanwoo Choi wrote:
> On 19. 4. 4. 오후 11:17, Yue Haibing wrote:
>> From: YueHaibing <[email protected]>
>>
>> As Hans de Goede pointed, using this driver without ACPI
>> makes little sense, so add ACPI dependency to Kconfig entry
>> to fix a build error while CONFIG_ACPI is not set.
>>
>> drivers/extcon/extcon-axp288.c: In function 'axp288_extcon_probe':
>> drivers/extcon/extcon-axp288.c:363:20: error: dereferencing pointer to incomplete type
>> put_device(&adev->dev);
>>
>> Fixes: 0cf064db948a ("extcon: axp288: Convert to use acpi_dev_get_first_match_dev()")
>> Reported-by: Hulk Robot <[email protected]>
>> Suggested-by: Hans de Goede <[email protected]>
>> Signed-off-by: YueHaibing <[email protected]>
>> ---
>> v2: rework patch
>> ---
>> drivers/extcon/Kconfig | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
>> index 1ed4b45..de06faf 100644
>> --- a/drivers/extcon/Kconfig
>> +++ b/drivers/extcon/Kconfig
>> @@ -30,7 +30,7 @@ config EXTCON_ARIZONA
>>
>> config EXTCON_AXP288
>> tristate "X-Power AXP288 EXTCON support"
>> - depends on MFD_AXP20X && USB_SUPPORT && X86
>> + depends on MFD_AXP20X && USB_SUPPORT && X86 && ACPI
>> select USB_ROLE_SWITCH
>> help
>> Say Y here to enable support for USB peripheral detection
>>
>
> Applied it. Thanks.
>


--
Best Regards,
Chanwoo Choi
Samsung Electronics