* [PATCH] ASoC: avoid unused variable warning for rt5659_acpi_match
@ 2016-01-20 11:46 Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-20 11:46 UTC (permalink / raw)
To: linux-arm-kernel
The newly added rt5659 codec driver unconditionally defines an
ACPI device match table but then uses ACPI_PTR() to remove the
only reference to it, so we get a harmless build warning:
sound/soc/codecs/rt5659.c:4200:30: warning: 'rt5659_acpi_match' defined but not used [-Wunused-variable]
static struct acpi_device_id rt5659_acpi_match[] = {
This changes both the OF match table and the ACPI match table
to follow the same style, using ACPI_PTR/of_match_ptr to
make the reference conditional, and using an #ifdef to hide
the table. This also adds the missing MODULE_DEVICE_TABLE for
the OF case and adapts the formatting to the same style.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: actually builds with CONFIG_OF enabled, testing in a couple of
configurations with and without OF
diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
index c166d9394c69..fb8ea05c0de1 100644
--- a/sound/soc/codecs/rt5659.c
+++ b/sound/soc/codecs/rt5659.c
@@ -4183,24 +4183,29 @@ void rt5659_i2c_shutdown(struct i2c_client *client)
regmap_write(rt5659->regmap, RT5659_RESET, 0);
}
+#ifdef CONFIG_OF
static const struct of_device_id rt5659_of_match[] = {
{ .compatible = "realtek,rt5658", },
{ .compatible = "realtek,rt5659", },
- {},
+ { },
};
+MODULE_DEVICE_TABLE(of, rt5659_of_match);
+#endif
+#ifdef CONFIG_ACPI
static struct acpi_device_id rt5659_acpi_match[] = {
- { "10EC5658", 0},
- { "10EC5659", 0},
- { },
+ { "10EC5658", 0, },
+ { "10EC5659", 0, },
+ { },
};
MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
+#endif
struct i2c_driver rt5659_i2c_driver = {
.driver = {
.name = "rt5659",
.owner = THIS_MODULE,
- .of_match_table = rt5659_of_match,
+ .of_match_table = of_match_ptr(rt5659_of_match),
.acpi_match_table = ACPI_PTR(rt5659_acpi_match),
},
.probe = rt5659_i2c_probe,
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] ASoC: avoid unused variable warning for rt5659_acpi_match
@ 2016-01-20 10:43 Arnd Bergmann
2016-01-20 10:45 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-20 10:43 UTC (permalink / raw)
To: linux-arm-kernel
The newly added rt5659 codec driver unconditionally defines an
ACPI device match table but then uses ACPI_PTR() to remove the
only reference to it, so we get a harmless build warning:
sound/soc/codecs/rt5659.c:4200:30: warning: 'rt5659_acpi_match' defined but not used [-Wunused-variable]
static struct acpi_device_id rt5659_acpi_match[] = {
This removes the ACPI_PTR() to avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This is a harmless regression against v4.4, found on ARM randconfig builds
diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
index c166d9394c69..5a1d789ba58d 100644
--- a/sound/soc/codecs/rt5659.c
+++ b/sound/soc/codecs/rt5659.c
@@ -4201,7 +4201,7 @@ struct i2c_driver rt5659_i2c_driver = {
.name = "rt5659",
.owner = THIS_MODULE,
.of_match_table = rt5659_of_match,
- .acpi_match_table = ACPI_PTR(rt5659_acpi_match),
+ .acpi_match_table = rt5659_acpi_match,
},
.probe = rt5659_i2c_probe,
.remove = rt5659_i2c_remove,
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] ASoC: avoid unused variable warning for rt5659_acpi_match
2016-01-20 10:43 Arnd Bergmann
@ 2016-01-20 10:45 ` Mark Brown
2016-01-20 10:58 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2016-01-20 10:45 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 20, 2016 at 11:43:48AM +0100, Arnd Bergmann wrote:
> The newly added rt5659 codec driver unconditionally defines an
> ACPI device match table but then uses ACPI_PTR() to remove the
> only reference to it, so we get a harmless build warning:
> sound/soc/codecs/rt5659.c:4200:30: warning: 'rt5659_acpi_match' defined but not used [-Wunused-variable]
> static struct acpi_device_id rt5659_acpi_match[] = {
> This removes the ACPI_PTR() to avoid the warning.
Why is this a better fix than conditionally defining the table?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160120/ce9df5db/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] ASoC: avoid unused variable warning for rt5659_acpi_match
2016-01-20 10:45 ` Mark Brown
@ 2016-01-20 10:58 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-20 10:58 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 20 January 2016 10:45:55 Mark Brown wrote:
> On Wed, Jan 20, 2016 at 11:43:48AM +0100, Arnd Bergmann wrote:
> > The newly added rt5659 codec driver unconditionally defines an
> > ACPI device match table but then uses ACPI_PTR() to remove the
> > only reference to it, so we get a harmless build warning:
>
> > sound/soc/codecs/rt5659.c:4200:30: warning: 'rt5659_acpi_match' defined but not used [-Wunused-variable]
> > static struct acpi_device_id rt5659_acpi_match[] = {
>
> > This removes the ACPI_PTR() to avoid the warning.
>
> Why is this a better fix than conditionally defining the table?
I'm not overly fond of adding #ifdef if it can be avoided. In this case,
both approaches seemed reasonable (either add an #ifdef or waste a couple
of bytes), and I picked at random. I'll send you the alternative as well,
please apply whichever one you prefer.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-20 11:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 11:46 [PATCH] ASoC: avoid unused variable warning for rt5659_acpi_match Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2016-01-20 10:43 Arnd Bergmann
2016-01-20 10:45 ` Mark Brown
2016-01-20 10:58 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox