public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI
@ 2013-09-19  9:18 Thierry Reding
  2013-09-19 10:45 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2013-09-19  9:18 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, linux-kernel

The ACPI_PTR() macro evaluates to NULL if ACPI is disabled and hence the
ACPI match table won't be used, causing the compiler to complain. Avoid
this by protecting the table using an #ifdef CONFIG_ACPI.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 sound/soc/codecs/rt5640.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 0bfb960..641eeeb 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2082,11 +2082,13 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
 
+#ifdef CONFIG_ACPI
 static struct acpi_device_id rt5640_acpi_match[] = {
 	{ "INT33CA", 0 },
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match);
+#endif
 
 static int rt5640_parse_dt(struct rt5640_priv *rt5640, struct device_node *np)
 {
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI
  2013-09-19  9:18 [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI Thierry Reding
@ 2013-09-19 10:45 ` Mark Brown
  2013-09-19 11:21   ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2013-09-19 10:45 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Thu, Sep 19, 2013 at 11:18:06AM +0200, Thierry Reding wrote:
> The ACPI_PTR() macro evaluates to NULL if ACPI is disabled and hence the
> ACPI match table won't be used, causing the compiler to complain. Avoid
> this by protecting the table using an #ifdef CONFIG_ACPI.

Applied, thanks.  Like I was saying to Olof we really should be able to
do better than needing the ifdefs though.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI
  2013-09-19 10:45 ` Mark Brown
@ 2013-09-19 11:21   ` Thierry Reding
  2013-09-19 13:22     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2013-09-19 11:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

On Thu, Sep 19, 2013 at 11:45:25AM +0100, Mark Brown wrote:
> On Thu, Sep 19, 2013 at 11:18:06AM +0200, Thierry Reding wrote:
> > The ACPI_PTR() macro evaluates to NULL if ACPI is disabled and hence the
> > ACPI match table won't be used, causing the compiler to complain. Avoid
> > this by protecting the table using an #ifdef CONFIG_ACPI.
> 
> Applied, thanks.  Like I was saying to Olof we really should be able to
> do better than needing the ifdefs though.

The struct device_driver's .acpi_match_table field is unconditionally
declared and the ACPI table with one entry and the sentinel weighs in
at 26 bytes, so perhaps doing away with the conditionals would be an
equally good option.

Or perhaps we can annotate the table so that the compiler will stop
complaining but remove the table nonetheless if it isn't used. Similarly
to what we can do with

	if (IS_ENABLED(CONFIG_FOO)) {
		...
	}

constructs. I can't really think of a way to do that, though. Perhaps
gcc will throw away the table anyway, so we'll just need a way to make
it shut up?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI
  2013-09-19 11:21   ` Thierry Reding
@ 2013-09-19 13:22     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-09-19 13:22 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Liam Girdwood, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

On Thu, Sep 19, 2013 at 01:21:04PM +0200, Thierry Reding wrote:

> Or perhaps we can annotate the table so that the compiler will stop
> complaining but remove the table nonetheless if it isn't used. Similarly
> to what we can do with
> 
> 	if (IS_ENABLED(CONFIG_FOO)) {
> 		...
> 	}
> 
> constructs. I can't really think of a way to do that, though. Perhaps
> gcc will throw away the table anyway, so we'll just need a way to make
> it shut up?

There's an annotation which can stop the unreferenced variable warning
and then modern compilers are able to eliminate unreferenced static
symbols.  Not sure if it's actually worth the effort of doing all this
though, but it is nice to be able to avoid needing multiple builds.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-19 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19  9:18 [PATCH] ASoC: rt5640: Omit ACPI match table only if !ACPI Thierry Reding
2013-09-19 10:45 ` Mark Brown
2013-09-19 11:21   ` Thierry Reding
2013-09-19 13:22     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox