Exclude all I2C-related code from compilation to avoid compilation errors and defined but not used warnings. sound/soc/codecs/rt5682.c:3688:26: warning: 'rt5682_i2c_driver' defined but not used [-Wunused-variable] static struct i2c_driver rt5682_i2c_driver = { ^~~~~~~~~~~~~~~~~ Reported-by: kbuild test robot <lkp@xxxxxxxxx> Fixes: 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support') Cc: Oder Chiou <oder_chiou@xxxxxxxxxxx> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> --- sound/soc/codecs/rt5682.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index e1df2d076533..8828ed5db58d 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -33,6 +33,7 @@ #include "rt5682.h" #include "rt5682-sdw.h" +#if IS_ENABLED(CONFIG_I2C) static const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = { "AVDD", "MICVDD", @@ -47,6 +48,7 @@ static const struct rt5682_platform_data i2s_default_platform_data = { .dai_clk_names[RT5682_DAI_WCLK_IDX] = "rt5682-dai-wclk", .dai_clk_names[RT5682_DAI_BCLK_IDX] = "rt5682-dai-bclk", }; +#endif static const struct reg_sequence patch_list[] = { {RT5682_HP_IMP_SENS_CTRL_19, 0x1000}, @@ -974,6 +976,7 @@ static int rt5682_headset_detect(struct snd_soc_component *component, return rt5682->jack_type; } +#if IS_ENABLED(CONFIG_I2C) static irqreturn_t rt5682_irq(int irq, void *data) { struct rt5682_priv *rt5682 = data; @@ -1002,6 +1005,7 @@ static void rt5682_jd_check_handler(struct work_struct *work) schedule_delayed_work(&rt5682->jd_check_work, 500); } } +#endif static int rt5682_set_jack_detect(struct snd_soc_component *component, struct snd_soc_jack *hs_jack, void *data) @@ -3214,6 +3218,7 @@ static const struct regmap_config rt5682_regmap = { .use_single_write = true, }; +#if IS_ENABLED(CONFIG_I2C) static const struct i2c_device_id rt5682_i2c_id[] = { {"rt5682", 0}, {} @@ -3244,6 +3249,7 @@ static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev) return 0; } +#endif static void rt5682_calibrate(struct rt5682_priv *rt5682) { @@ -3510,6 +3516,7 @@ int rt5682_io_init(struct device *dev, struct sdw_slave *slave) EXPORT_SYMBOL_GPL(rt5682_io_init); #endif +#if IS_ENABLED(CONFIG_I2C) static int rt5682_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -3668,6 +3675,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) rt5682_reset(rt5682); } +#endif #ifdef CONFIG_OF static const struct of_device_id rt5682_of_match[] = { @@ -3685,6 +3693,7 @@ static const struct acpi_device_id rt5682_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, rt5682_acpi_match); #endif +#if IS_ENABLED(CONFIG_I2C) static struct i2c_driver rt5682_i2c_driver = { .driver = { .name = "rt5682", @@ -3696,6 +3705,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@xxxxxxxxxxx>"); -- 2.20.1