[15/15] mmc: host: sdhci-iproc: Tell the compiler that ACPI functions may not be used
diff mbox series

Message ID 20200701124702.908713-16-lee.jones@linaro.org
State In Next
Commit aa4482b93672c0f8b19316126dd374746abcf8a7
Headers show
Series
  • Clean-up MMC's W=1 build warnings
Related show

Commit Message

Lee Jones July 1, 2020, 12:47 p.m. UTC
... 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 <adrian.hunter@intel.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mmc/host/sdhci-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Scott Branden July 2, 2020, 7:42 p.m. UTC | #1
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 <adrian.hunter@intel.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>   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 */ }
Lee Jones July 2, 2020, 8:13 p.m. UTC | #2
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 <adrian.hunter@intel.com>
> > Cc: Ray Jui <rjui@broadcom.com>
> > Cc: Scott Branden <sbranden@broadcom.com>
> > Cc: bcm-kernel-feedback-list@broadcom.com
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >   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 */ }
>
Scott Branden July 2, 2020, 8:49 p.m. UTC | #3
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 <adrian.hunter@intel.com>
>>> Cc: Ray Jui <rjui@broadcom.com>
>>> Cc: Scott Branden <sbranden@broadcom.com>
>>> Cc: bcm-kernel-feedback-list@broadcom.com
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> ---
>>>    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 */ }

Patch
diff mbox series

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 */ }