[04/11] ASoC: codecs: da7219: fix 'defined but not used' warning
diff mbox series

Message ID 20200701182422.81496-5-pierre-louis.bossart@linux.intel.com
State New
Headers show
Series
  • ASoC: codecs: fix kernel-doc and W=1 warnings
Related show

Commit Message

Pierre-Louis Bossart July 1, 2020, 6:24 p.m. UTC
fix W=1 warning

sound/soc/codecs/da7219.c:1711:36: warning: 'da7219_acpi_match'
defined but not used [-Wunused-const-variable=]
 1711 | static const struct acpi_device_id da7219_acpi_match[] = {
      |                                    ^~~~~~~~~~~~~~~~~

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/da7219.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Adam Thomson July 3, 2020, 9:33 a.m. UTC | #1
On 01 July 2020 19:24, Pierre-Louis Bossart wrote:

> fix W=1 warning
> 
> sound/soc/codecs/da7219.c:1711:36: warning: 'da7219_acpi_match'
> defined but not used [-Wunused-const-variable=]
>  1711 | static const struct acpi_device_id da7219_acpi_match[] = {
>       |                                    ^~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/soc/codecs/da7219.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
> index f2520a6c7875..153ea30b5a8f 100644
> --- a/sound/soc/codecs/da7219.c
> +++ b/sound/soc/codecs/da7219.c
> @@ -1708,11 +1708,13 @@ static const struct of_device_id da7219_of_match[] =
> {
>  };
>  MODULE_DEVICE_TABLE(of, da7219_of_match);
> 
> +#ifdef CONFIG_ACPI
>  static const struct acpi_device_id da7219_acpi_match[] = {
>  	{ .id = "DLGS7219", },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, da7219_acpi_match);
> +#endif

I think this will break non-ACPI builds as this symbol is used in the
declaration of 'da7219_i2c_driver', without conditional compilation surrounding
it. Unless of course I'm missing something. Could we instead use
'__maybe_unused' to avoid this warning?

> 
>  static enum da7219_micbias_voltage
>  	da7219_fw_micbias_lvl(struct device *dev, u32 val)
> --
> 2.25.1
Adam Thomson July 3, 2020, 9:57 a.m. UTC | #2
On 03 July 2020 10:33, Adam Thomson wrote

> On 01 July 2020 19:24, Pierre-Louis Bossart wrote:
> 
> > fix W=1 warning
> >
> > sound/soc/codecs/da7219.c:1711:36: warning: 'da7219_acpi_match'
> > defined but not used [-Wunused-const-variable=]
> >  1711 | static const struct acpi_device_id da7219_acpi_match[] = {
> >       |                                    ^~~~~~~~~~~~~~~~~
> >
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > ---
> >  sound/soc/codecs/da7219.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
> > index f2520a6c7875..153ea30b5a8f 100644
> > --- a/sound/soc/codecs/da7219.c
> > +++ b/sound/soc/codecs/da7219.c
> > @@ -1708,11 +1708,13 @@ static const struct of_device_id da7219_of_match[]
> =
> > {
> >  };
> >  MODULE_DEVICE_TABLE(of, da7219_of_match);
> >
> > +#ifdef CONFIG_ACPI
> >  static const struct acpi_device_id da7219_acpi_match[] = {
> >  	{ .id = "DLGS7219", },
> >  	{ }
> >  };
> >  MODULE_DEVICE_TABLE(acpi, da7219_acpi_match);
> > +#endif
> 
> I think this will break non-ACPI builds as this symbol is used in the
> declaration of 'da7219_i2c_driver', without conditional compilation surrounding
> it. Unless of course I'm missing something. Could we instead use
> '__maybe_unused' to avoid this warning?

Obviously a slow start to the day for my brain. You've obviously built test this
given the intention behind this is for non-ACPI builds. Will get more coffee
shortly.

Still wonder if '__maybe_unused' might be nicer as per suspend/resume functions
on platforms which don't include PM_OPS. Either way though:

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> 
> >
> >  static enum da7219_micbias_voltage
> >  	da7219_fw_micbias_lvl(struct device *dev, u32 val)
> > --
> > 2.25.1

Patch
diff mbox series

diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index f2520a6c7875..153ea30b5a8f 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1708,11 +1708,13 @@  static const struct of_device_id da7219_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, da7219_of_match);
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id da7219_acpi_match[] = {
 	{ .id = "DLGS7219", },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, da7219_acpi_match);
+#endif
 
 static enum da7219_micbias_voltage
 	da7219_fw_micbias_lvl(struct device *dev, u32 val)