linux
Undefined reference due to missing dependency on I2C
SND_FSI_AK4642 enables the compilation of ak4642.c, which depends on code enabled by I2C. Thus, if I2C is disabled we get a build error. The same applies for SND_FSI_DA7210.
Bug fixed by commit 66517915e09
| Type | UndeclaredIdentifier |
| Config | "(SND_FSI_AK4642 || SND_FSI_DA7210) && !I2C" (2nd degree) |
| Fix-in | model |
| Location | sound/ |
#ifdef CONFIG_SND_FSI_AK4642
#define CONFIG_SND_SOC_AK4642
#endif
#ifdef CONFIG_SND_FSI_DA7210
#define CONFIG_SND_SOC_DA7210
#endif
#ifdef CONFIG_I2C
static int i2c_master_send = 0;
#endif
#ifdef CONFIG_SND_SOC_DA7210
static int da7210_init()
{
int codec_hw_write = i2c_master_send; // ERROR
return 0;
}
#endif
#ifdef CONFIG_SND_SOC_AK4642
static int ak4642_init()
{
int codec_hw_write = i2c_master_send; // ERROR
return 0;
}
#endif
int main(int argc, char** argv)
{
#ifdef CONFIG_SND_SOC_DA7210
da7210_init();
#endif
#ifdef CONFIG_SND_SOC_AK4642
ak4642_init();
#endif
return 0;
}
diff --git a/simple/6651791.c b/simple/6651791.c --- a/simple/6651791.c +++ b/simple/6651791.c @@ -1,3 +1,8 @@ + +#if defined(CONFIG_SND_SOC_SH4_FSI) && defined(CONFIG_I2C) +#define CONFIG_SND_FSI_AK4642 +#define CONFIG_SND_FSI_DA7210 +#endif #ifdef CONFIG_SND_FSI_AK4642 #define CONFIG_SND_SOC_AK4642
#ifdef CONFIG_SND_FSI_AK4642
#define CONFIG_SND_SOC_AK4642
#endif
#ifdef CONFIG_SND_FSI_DA7210
#define CONFIG_SND_SOC_DA7210
#endif
#ifdef CONFIG_I2C
static int i2c_master_send = 0;
#endif
int main(int argc, char** argv)
{
#ifdef CONFIG_SND_SOC_DA7210
// da7210_init();
int codec_hw_write = i2c_master_send; // ERROR
#endif
#ifdef CONFIG_SND_SOC_AK4642
// ak4642_init();
int codec_hw_write2 = i2c_master_send; // ERROR
#endif
return 0;
}
. sound/soc/codecs/da7210.c:462: codec->hw_write = (hw_write_t)i2c_master_send;