public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match
@ 2016-01-20 11:05 Arnd Bergmann
  2016-01-20 11:34 ` [alsa-devel] " kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-01-20 11:05 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>
---
I still want to give this some time in the random build testing to avoid
introducing a stupid mistake, please apply after tomorrow unless you
hear from me otherwise.

diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c
index c166d9394c69..efe87af33f8f 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

* [alsa-devel] [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match
  2016-01-20 11:05 [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match Arnd Bergmann
@ 2016-01-20 11:34 ` kbuild test robot
  2016-01-20 12:24 ` kbuild test robot
  2016-01-20 17:06 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-01-20 11:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20160120]
[cannot apply to v4.4]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/ASoC-avoid-unused-variable-warning-for-rt5659_acpi_match/20160120-190911
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

>> sound/soc/codecs/rt5659.c:4196:1: error: expected ',' or ';' before 'static'
    static struct acpi_device_id rt5659_acpi_match[] = {
    ^
   In file included from sound/soc/codecs/rt5659.c:12:0:
>> sound/soc/codecs/rt5659.c:4201:27: error: 'rt5659_acpi_match' undeclared here (not in a function)
    MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
                              ^
   include/linux/module.h:223:21: note: in definition of macro 'MODULE_DEVICE_TABLE'
    extern const typeof(name) __mod_##type##__##name##_device_table  \
                        ^
>> include/linux/module.h:223:27: error: '__mod_acpi__rt5659_acpi_match_device_table' aliased to undefined symbol 'rt5659_acpi_match'
    extern const typeof(name) __mod_##type##__##name##_device_table  \
                              ^
>> sound/soc/codecs/rt5659.c:4201:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
    MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
    ^

vim +4196 sound/soc/codecs/rt5659.c

d3cb2de2 Bard Liao     2015-11-09  4190  	{ },
d3cb2de2 Bard Liao     2015-11-09  4191  };
51bb9d21 Arnd Bergmann 2016-01-20  4192  MODULE_DEVICE_TABLE(of, rt5659_of_match)
51bb9d21 Arnd Bergmann 2016-01-20  4193  #endif
d3cb2de2 Bard Liao     2015-11-09  4194  
51bb9d21 Arnd Bergmann 2016-01-20  4195  #ifdef CONFIG_ACPI
d3cb2de2 Bard Liao     2015-11-09 @4196  static struct acpi_device_id rt5659_acpi_match[] = {
51bb9d21 Arnd Bergmann 2016-01-20  4197  	{ "10EC5658", 0, },
51bb9d21 Arnd Bergmann 2016-01-20  4198  	{ "10EC5659", 0, },
d3cb2de2 Bard Liao     2015-11-09  4199  	{ },
d3cb2de2 Bard Liao     2015-11-09  4200  };
d3cb2de2 Bard Liao     2015-11-09 @4201  MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
51bb9d21 Arnd Bergmann 2016-01-20  4202  #endif
d3cb2de2 Bard Liao     2015-11-09  4203  
d3cb2de2 Bard Liao     2015-11-09  4204  struct i2c_driver rt5659_i2c_driver = {

:::::: The code at line 4196 was first introduced by commit
:::::: d3cb2de2479bbbde29391393d68f2e313e1f0504 ASoC: rt5659: add rt5659 codec driver

:::::: TO: Bard Liao <bardliao@realtek.com>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 52676 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160120/a7f57720/attachment-0001.obj>

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

* [alsa-devel] [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match
  2016-01-20 11:05 [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match Arnd Bergmann
  2016-01-20 11:34 ` [alsa-devel] " kbuild test robot
@ 2016-01-20 12:24 ` kbuild test robot
  2016-01-20 17:06 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-01-20 12:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20160120]
[cannot apply to v4.4]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/ASoC-avoid-unused-variable-warning-for-rt5659_acpi_match/20160120-190911
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: openrisc-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All error/warnings (new ones prefixed by >>):

>> sound/soc/codecs/rt5659.c:4204:1: error: expected ',' or ';' before 'struct'
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_init':
>> sound/soc/codecs/rt5659.c:4216:1: error: 'rt5659_i2c_driver' undeclared (first use in this function)
   sound/soc/codecs/rt5659.c:4216:1: note: each undeclared identifier is reported only once for each function it appears in
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_exit':
>> sound/soc/codecs/rt5659.c:4216:1: error: 'rt5659_i2c_driver' undeclared (first use in this function)
   sound/soc/codecs/rt5659.c: At top level:
   sound/soc/codecs/rt5659.c:3974:12: warning: 'rt5659_i2c_probe' defined but not used
   sound/soc/codecs/rt5659.c:4172:12: warning: 'rt5659_i2c_remove' defined but not used
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_init':
>> sound/soc/codecs/rt5659.c:4216:1: warning: control reaches end of non-void function

vim +4204 sound/soc/codecs/rt5659.c

51bb9d21 Arnd Bergmann 2016-01-20  4198  	{ "10EC5659", 0, },
d3cb2de2 Bard Liao     2015-11-09  4199  	{ },
d3cb2de2 Bard Liao     2015-11-09  4200  };
d3cb2de2 Bard Liao     2015-11-09  4201  MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
51bb9d21 Arnd Bergmann 2016-01-20  4202  #endif
d3cb2de2 Bard Liao     2015-11-09  4203  
d3cb2de2 Bard Liao     2015-11-09 @4204  struct i2c_driver rt5659_i2c_driver = {
d3cb2de2 Bard Liao     2015-11-09  4205  	.driver = {
d3cb2de2 Bard Liao     2015-11-09  4206  		.name = "rt5659",
d3cb2de2 Bard Liao     2015-11-09  4207  		.owner = THIS_MODULE,
51bb9d21 Arnd Bergmann 2016-01-20  4208  		.of_match_table = of_match_ptr(rt5659_of_match),
d3cb2de2 Bard Liao     2015-11-09  4209  		.acpi_match_table = ACPI_PTR(rt5659_acpi_match),
d3cb2de2 Bard Liao     2015-11-09  4210  	},
d3cb2de2 Bard Liao     2015-11-09  4211  	.probe = rt5659_i2c_probe,
d3cb2de2 Bard Liao     2015-11-09  4212  	.remove = rt5659_i2c_remove,
d3cb2de2 Bard Liao     2015-11-09  4213  	.shutdown = rt5659_i2c_shutdown,
d3cb2de2 Bard Liao     2015-11-09  4214  	.id_table = rt5659_i2c_id,
d3cb2de2 Bard Liao     2015-11-09  4215  };
d3cb2de2 Bard Liao     2015-11-09 @4216  module_i2c_driver(rt5659_i2c_driver);
d3cb2de2 Bard Liao     2015-11-09  4217  
d3cb2de2 Bard Liao     2015-11-09  4218  MODULE_DESCRIPTION("ASoC RT5659 driver");
d3cb2de2 Bard Liao     2015-11-09  4219  MODULE_AUTHOR("Bard Liao <bardliao@realtek.com>");

:::::: The code at line 4204 was first introduced by commit
:::::: d3cb2de2479bbbde29391393d68f2e313e1f0504 ASoC: rt5659: add rt5659 codec driver

:::::: TO: Bard Liao <bardliao@realtek.com>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 35893 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160120/db03b4ae/attachment-0001.obj>

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

* [alsa-devel] [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match
  2016-01-20 11:05 [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match Arnd Bergmann
  2016-01-20 11:34 ` [alsa-devel] " kbuild test robot
  2016-01-20 12:24 ` kbuild test robot
@ 2016-01-20 17:06 ` kbuild test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-01-20 17:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

[auto build test WARNING on asoc/for-next]
[also build test WARNING on next-20160120]
[cannot apply to v4.4]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/ASoC-avoid-unused-variable-warning-for-rt5659_acpi_match/20160120-190911
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: parisc-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=parisc 

All warnings (new ones prefixed by >>):

   sound/soc/codecs/rt5659.c:4204:1: error: expected ',' or ';' before 'struct'
    struct i2c_driver rt5659_i2c_driver = {
    ^
   In file included from sound/soc/codecs/rt5659.c:17:0:
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_init':
   sound/soc/codecs/rt5659.c:4216:19: error: 'rt5659_i2c_driver' undeclared (first use in this function)
    module_i2c_driver(rt5659_i2c_driver);
                      ^
   include/linux/i2c.h:592:35: note: in definition of macro 'i2c_add_driver'
     i2c_register_driver(THIS_MODULE, driver)
                                      ^
>> include/linux/i2c.h:633:2: note: in expansion of macro 'module_driver'
     module_driver(__i2c_driver, i2c_add_driver, \
     ^
>> sound/soc/codecs/rt5659.c:4216:1: note: in expansion of macro 'module_i2c_driver'
    module_i2c_driver(rt5659_i2c_driver);
    ^
   sound/soc/codecs/rt5659.c:4216:19: note: each undeclared identifier is reported only once for each function it appears in
    module_i2c_driver(rt5659_i2c_driver);
                      ^
   include/linux/i2c.h:592:35: note: in definition of macro 'i2c_add_driver'
     i2c_register_driver(THIS_MODULE, driver)
                                      ^
>> include/linux/i2c.h:633:2: note: in expansion of macro 'module_driver'
     module_driver(__i2c_driver, i2c_add_driver, \
     ^
>> sound/soc/codecs/rt5659.c:4216:1: note: in expansion of macro 'module_i2c_driver'
    module_i2c_driver(rt5659_i2c_driver);
    ^
   In file included from include/linux/i2c.h:30:0,
                    from sound/soc/codecs/rt5659.c:17:
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_exit':
   sound/soc/codecs/rt5659.c:4216:19: error: 'rt5659_i2c_driver' undeclared (first use in this function)
    module_i2c_driver(rt5659_i2c_driver);
                      ^
   include/linux/device.h:1332:17: note: in definition of macro 'module_driver'
     __unregister(&(__driver) , ##__VA_ARGS__); \
                    ^
>> sound/soc/codecs/rt5659.c:4216:1: note: in expansion of macro 'module_i2c_driver'
    module_i2c_driver(rt5659_i2c_driver);
    ^
   sound/soc/codecs/rt5659.c: At top level:
   sound/soc/codecs/rt5659.c:3974:12: warning: 'rt5659_i2c_probe' defined but not used [-Wunused-function]
    static int rt5659_i2c_probe(struct i2c_client *i2c,
               ^
   sound/soc/codecs/rt5659.c:4172:12: warning: 'rt5659_i2c_remove' defined but not used [-Wunused-function]
    static int rt5659_i2c_remove(struct i2c_client *i2c)
               ^
   sound/soc/codecs/rt5659.c: In function 'rt5659_i2c_driver_init':
   sound/soc/codecs/rt5659.c:4216:1: warning: control reaches end of non-void function [-Wreturn-type]
    module_i2c_driver(rt5659_i2c_driver);
    ^

vim +/module_i2c_driver +4216 sound/soc/codecs/rt5659.c

d3cb2de2 Bard Liao     2015-11-09  4200  };
d3cb2de2 Bard Liao     2015-11-09  4201  MODULE_DEVICE_TABLE(acpi, rt5659_acpi_match);
51bb9d21 Arnd Bergmann 2016-01-20  4202  #endif
d3cb2de2 Bard Liao     2015-11-09  4203  
d3cb2de2 Bard Liao     2015-11-09  4204  struct i2c_driver rt5659_i2c_driver = {
d3cb2de2 Bard Liao     2015-11-09  4205  	.driver = {
d3cb2de2 Bard Liao     2015-11-09  4206  		.name = "rt5659",
d3cb2de2 Bard Liao     2015-11-09  4207  		.owner = THIS_MODULE,
51bb9d21 Arnd Bergmann 2016-01-20  4208  		.of_match_table = of_match_ptr(rt5659_of_match),
d3cb2de2 Bard Liao     2015-11-09  4209  		.acpi_match_table = ACPI_PTR(rt5659_acpi_match),
d3cb2de2 Bard Liao     2015-11-09  4210  	},
d3cb2de2 Bard Liao     2015-11-09  4211  	.probe = rt5659_i2c_probe,
d3cb2de2 Bard Liao     2015-11-09  4212  	.remove = rt5659_i2c_remove,
d3cb2de2 Bard Liao     2015-11-09  4213  	.shutdown = rt5659_i2c_shutdown,
d3cb2de2 Bard Liao     2015-11-09  4214  	.id_table = rt5659_i2c_id,
d3cb2de2 Bard Liao     2015-11-09  4215  };
d3cb2de2 Bard Liao     2015-11-09 @4216  module_i2c_driver(rt5659_i2c_driver);
d3cb2de2 Bard Liao     2015-11-09  4217  
d3cb2de2 Bard Liao     2015-11-09  4218  MODULE_DESCRIPTION("ASoC RT5659 driver");
d3cb2de2 Bard Liao     2015-11-09  4219  MODULE_AUTHOR("Bard Liao <bardliao@realtek.com>");
d3cb2de2 Bard Liao     2015-11-09  4220  MODULE_LICENSE("GPL v2");

:::::: The code at line 4216 was first introduced by commit
:::::: d3cb2de2479bbbde29391393d68f2e313e1f0504 ASoC: rt5659: add rt5659 codec driver

:::::: TO: Bard Liao <bardliao@realtek.com>
:::::: CC: Mark Brown <broonie@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 42828 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160121/1d2b8f1c/attachment-0001.obj>

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

end of thread, other threads:[~2016-01-20 17:06 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:05 [PATCH v2] ASoC: avoid unused variable warning for rt5659_acpi_match Arnd Bergmann
2016-01-20 11:34 ` [alsa-devel] " kbuild test robot
2016-01-20 12:24 ` kbuild test robot
2016-01-20 17:06 ` kbuild test robot

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