* [PATCH] ASoC: rt5682: fix building without I2C
@ 2020-04-08 18:55 Arnd Bergmann
2020-04-08 19:12 ` Pierre-Louis Bossart
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-04-08 18:55 UTC (permalink / raw)
To: Oder Chiou, Mark Brown
Cc: Pierre-Louis Bossart, alsa-devel, kbuild test robot,
Arnd Bergmann, linux-kernel, Liam Girdwood, Takashi Iwai,
Derek Fang, Shuming Fan
When I2C is disabled, building rt5682 produces a compile-time error:
sound/soc/codecs/rt5682.c:3716:1: warning: data definition has no type or storage class
3716 | module_i2c_driver(rt5682_i2c_driver);
| ^~~~~~~~~~~~~~~~~
sound/soc/codecs/rt5682.c:3716:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
sound/soc/codecs/rt5682.c:3716:1: warning: parameter names (without types) in function declaration
sound/soc/codecs/rt5682.c:3706:26: error: 'rt5682_i2c_driver' defined but not used [-Werror=unused-variable]
3706 | static struct i2c_driver rt5682_i2c_driver = {
| ^~~~~~~~~~~~~~~~~
Move the i2c specific entry points into an #ifdef section so
it can actually be built standalone.
Fixes: 5549ea647997 ("ASoC: rt5682: fix unmet dependencies")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/soc/codecs/rt5682.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index c9268a230daa..a6548f870807 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -3224,12 +3224,6 @@ static const struct regmap_config rt5682_regmap = {
.use_single_write = true,
};
-static const struct i2c_device_id rt5682_i2c_id[] = {
- {"rt5682", 0},
- {}
-};
-MODULE_DEVICE_TABLE(i2c, rt5682_i2c_id);
-
static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
{
@@ -3526,7 +3520,7 @@ int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
EXPORT_SYMBOL_GPL(rt5682_io_init);
#endif
-static int rt5682_i2c_probe(struct i2c_client *i2c,
+static int __maybe_unused rt5682_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct rt5682_platform_data *pdata = dev_get_platdata(&i2c->dev);
@@ -3680,13 +3674,14 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
rt5682_dai, ARRAY_SIZE(rt5682_dai));
}
-static void rt5682_i2c_shutdown(struct i2c_client *client)
+static void __maybe_unused rt5682_i2c_shutdown(struct i2c_client *client)
{
struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
rt5682_reset(rt5682);
}
+#ifdef CONFIG_I2C
#ifdef CONFIG_OF
static const struct of_device_id rt5682_of_match[] = {
{.compatible = "realtek,rt5682i"},
@@ -3703,6 +3698,12 @@ static const struct acpi_device_id rt5682_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, rt5682_acpi_match);
#endif
+static const struct i2c_device_id rt5682_i2c_id[] = {
+ {"rt5682", 0},
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, rt5682_i2c_id);
+
static struct i2c_driver rt5682_i2c_driver = {
.driver = {
.name = "rt5682",
@@ -3714,6 +3715,7 @@ static struct i2c_driver rt5682_i2c_driver = {
.id_table = rt5682_i2c_id,
};
module_i2c_driver(rt5682_i2c_driver);
+#endif
MODULE_DESCRIPTION("ASoC RT5682 driver");
MODULE_AUTHOR("Bard Liao <bardliao@realtek.com>");
--
2.26.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: rt5682: fix building without I2C
2020-04-08 18:55 [PATCH] ASoC: rt5682: fix building without I2C Arnd Bergmann
@ 2020-04-08 19:12 ` Pierre-Louis Bossart
0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Louis Bossart @ 2020-04-08 19:12 UTC (permalink / raw)
To: Arnd Bergmann, Oder Chiou, Mark Brown
Cc: alsa-devel, kbuild test robot, linux-kernel, Liam Girdwood,
Takashi Iwai, Derek Fang, Shuming Fan
On 4/8/20 1:55 PM, Arnd Bergmann wrote:
> When I2C is disabled, building rt5682 produces a compile-time error:
>
> sound/soc/codecs/rt5682.c:3716:1: warning: data definition has no type or storage class
> 3716 | module_i2c_driver(rt5682_i2c_driver);
> | ^~~~~~~~~~~~~~~~~
> sound/soc/codecs/rt5682.c:3716:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
> sound/soc/codecs/rt5682.c:3716:1: warning: parameter names (without types) in function declaration
> sound/soc/codecs/rt5682.c:3706:26: error: 'rt5682_i2c_driver' defined but not used [-Werror=unused-variable]
> 3706 | static struct i2c_driver rt5682_i2c_driver = {
> | ^~~~~~~~~~~~~~~~~
>
> Move the i2c specific entry points into an #ifdef section so
> it can actually be built standalone.
>
> Fixes: 5549ea647997 ("ASoC: rt5682: fix unmet dependencies")
it's already fixed by [PATCH -next] ASoC: rt5682: Fix build error
without CONFIG_I2C
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-08 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 18:55 [PATCH] ASoC: rt5682: fix building without I2C Arnd Bergmann
2020-04-08 19:12 ` Pierre-Louis Bossart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).