2020-07-01 12:48:32

by Lee Jones

[permalink] [raw]
Subject: [PATCH 15/15] mmc: host: sdhci-iproc: Tell the compiler that ACPI functions may not be used

... as is the case when !CONFIG_ACPI.

Fixes the following W=1 kernel build warning:

mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]

Cc: Adrian Hunter <[email protected]>
Cc: Ray Jui <[email protected]>
Cc: Scott Branden <[email protected]>
Cc: [email protected]
Signed-off-by: Lee Jones <[email protected]>
---
drivers/mmc/host/sdhci-iproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 225603148d7de..9c7d130205edd 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -294,7 +294,7 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
};
MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);

-static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
+static const struct acpi_device_id __maybe_unused sdhci_iproc_acpi_ids[] = {
{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
{ /* sentinel */ }
--
2.25.1


2020-07-02 19:43:25

by Scott Branden

[permalink] [raw]
Subject: Re: [PATCH 15/15] mmc: host: sdhci-iproc: Tell the compiler that ACPI functions may not be used

Hi Lee,

On 2020-07-01 5:47 a.m., Lee Jones wrote:
> ... as is the case when !CONFIG_ACPI.
>
> Fixes the following W=1 kernel build warning:
>
> mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]
>
> Cc: Adrian Hunter <[email protected]>
> Cc: Ray Jui <[email protected]>
> Cc: Scott Branden <[email protected]>
> Cc: [email protected]
> Signed-off-by: Lee Jones <[email protected]>
> ---
> drivers/mmc/host/sdhci-iproc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 225603148d7de..9c7d130205edd 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -294,7 +294,7 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>
Would it better to compile this in if CONFIG_ACPI is defined instead?
#if CONFIG_ACPI
> -static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
> +static const struct acpi_device_id __maybe_unused sdhci_iproc_acpi_ids[] = {
> { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
> { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> { /* sentinel */ }

2020-07-02 20:17:53

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 15/15] mmc: host: sdhci-iproc: Tell the compiler that ACPI functions may not be used

On Thu, 02 Jul 2020, Scott Branden wrote:

> Hi Lee,
>
> On 2020-07-01 5:47 a.m., Lee Jones wrote:
> > ... as is the case when !CONFIG_ACPI.
> >
> > Fixes the following W=1 kernel build warning:
> >
> > mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]
> >
> > Cc: Adrian Hunter <[email protected]>
> > Cc: Ray Jui <[email protected]>
> > Cc: Scott Branden <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Lee Jones <[email protected]>
> > ---
> > drivers/mmc/host/sdhci-iproc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> > index 225603148d7de..9c7d130205edd 100644
> > --- a/drivers/mmc/host/sdhci-iproc.c
> > +++ b/drivers/mmc/host/sdhci-iproc.c
> > @@ -294,7 +294,7 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
> > };
> > MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);

> Would it better to compile this in if CONFIG_ACPI is defined instead?
> #if CONFIG_ACPI

Literally can't win.

https://lore.kernel.org/linux-arm-kernel/CAGb2v66Ws4WNPZbOYQvikKoozj_2WjzS-Jq-o2VxT77=k0vODw@mail.gmail.com/

Damned if we do, damned if we don't. ;)

> > -static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
> > +static const struct acpi_device_id __maybe_unused sdhci_iproc_acpi_ids[] = {
> > { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
> > { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> > { /* sentinel */ }
>

--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

2020-07-02 20:50:25

by Scott Branden

[permalink] [raw]
Subject: Re: [PATCH 15/15] mmc: host: sdhci-iproc: Tell the compiler that ACPI functions may not be used



On 2020-07-02 1:13 p.m., Lee Jones wrote:
> On Thu, 02 Jul 2020, Scott Branden wrote:
>
>> Hi Lee,
>>
>> On 2020-07-01 5:47 a.m., Lee Jones wrote:
>>> ... as is the case when !CONFIG_ACPI.
>>>
>>> Fixes the following W=1 kernel build warning:
>>>
>>> mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]
>>>
>>> Cc: Adrian Hunter <[email protected]>
>>> Cc: Ray Jui <[email protected]>
>>> Cc: Scott Branden <[email protected]>
>>> Cc: [email protected]
>>> Signed-off-by: Lee Jones <[email protected]>
>>> ---
>>> drivers/mmc/host/sdhci-iproc.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>>> index 225603148d7de..9c7d130205edd 100644
>>> --- a/drivers/mmc/host/sdhci-iproc.c
>>> +++ b/drivers/mmc/host/sdhci-iproc.c
>>> @@ -294,7 +294,7 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
>>> };
>>> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>> Would it better to compile this in if CONFIG_ACPI is defined instead?
>> #if CONFIG_ACPI
> Literally can't win.
>
> https://lore.kernel.org/linux-arm-kernel/CAGb2v66Ws4WNPZbOYQvikKoozj_2WjzS-Jq-o2VxT77=k0vODw@mail.gmail.com/
>
> Damned if we do, damned if we don't. ;)
This is very minor in this one change here, but it's just more bloat of
things that really should be compiled out if they're not used.
I don't understand why __maybe_unused would be preferred approach -
unless it is not linked in when it is not used?
>
>>> -static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
>>> +static const struct acpi_device_id __maybe_unused sdhci_iproc_acpi_ids[] = {
>>> { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
>>> { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
>>> { /* sentinel */ }

2020-07-07 06:48:17

by Lee Jones

[permalink] [raw]
Subject: [PATCH v2 15/15] mmc: host: sdhci-iproc: Do not define 'struct acpi_device_id' when !CONFIG_ACPI

Since ACPI_PTR() is used to NULLify the value when !CONFIG_ACPI,
'struct sdhci_iproc_acpi_ids' becomes defined but unused.

Fixes the following W=1 kernel build warning:

mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]

Cc: Adrian Hunter <[email protected]>
Cc: Ray Jui <[email protected]>
Cc: Scott Branden <[email protected]>
Cc: [email protected]
Signed-off-by: Lee Jones <[email protected]>

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 225603148d7de..e2d8dfe90077e 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -294,12 +294,14 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
};
MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);

+#ifdef CONFIG_ACPI
static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
+#endif

static int sdhci_iproc_probe(struct platform_device *pdev)
{

2020-07-07 15:49:45

by Scott Branden

[permalink] [raw]
Subject: Re: [PATCH v2 15/15] mmc: host: sdhci-iproc: Do not define 'struct acpi_device_id' when !CONFIG_ACPI

thanks

On 2020-07-06 11:47 p.m., Lee Jones wrote:
> Since ACPI_PTR() is used to NULLify the value when !CONFIG_ACPI,
> 'struct sdhci_iproc_acpi_ids' becomes defined but unused.
>
> Fixes the following W=1 kernel build warning:
>
> mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]
>
> Cc: Adrian Hunter <[email protected]>
> Cc: Ray Jui <[email protected]>
> Cc: Scott Branden <[email protected]>
> Cc: [email protected]
> Signed-off-by: Lee Jones <[email protected]>
Acked-by: Scott Branden <[email protected]>
>
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 225603148d7de..e2d8dfe90077e 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -294,12 +294,14 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>
> +#ifdef CONFIG_ACPI
> static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
> { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
> { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
> +#endif
>
> static int sdhci_iproc_probe(struct platform_device *pdev)
> {

2020-07-08 13:21:55

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2 15/15] mmc: host: sdhci-iproc: Do not define 'struct acpi_device_id' when !CONFIG_ACPI

On Tue, 7 Jul 2020 at 08:47, Lee Jones <[email protected]> wrote:
>
> Since ACPI_PTR() is used to NULLify the value when !CONFIG_ACPI,
> 'struct sdhci_iproc_acpi_ids' becomes defined but unused.
>
> Fixes the following W=1 kernel build warning:
>
> mmc/host/sdhci-iproc.c:297:36: warning: ‘sdhci_iproc_acpi_ids’ defined but not used [-Wunused-const-variable=]
>
> Cc: Adrian Hunter <[email protected]>
> Cc: Ray Jui <[email protected]>
> Cc: Scott Branden <[email protected]>
> Cc: [email protected]
> Signed-off-by: Lee Jones <[email protected]>

Alright, so I have replaced v1 with this v2 on my next branch, thanks!

Kind regards
Uffe

>
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 225603148d7de..e2d8dfe90077e 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -294,12 +294,14 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>
> +#ifdef CONFIG_ACPI
> static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
> { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
> { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
> +#endif
>
> static int sdhci_iproc_probe(struct platform_device *pdev)
> {