[alsa-devel] [PATCH] ASoC: Fix to avoid compile error

Seungwhan Youn sw.youn at samsung.com
Mon Apr 4 06:15:04 CEST 2011


This patch fixes to avoid compile error when ASoC codec doesn't use I2C
nor SPI on snd_soc_hw_bulk_write_raw().

Signed-off-by: Seungwhan Youn <sw.youn at samsung.com>
---
 sound/soc/soc-cache.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 22b0990..6ba1714 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -402,7 +402,7 @@ static int snd_soc_16_16_spi_write(void *control_data, const char *data,
 static int snd_soc_hw_bulk_write_raw(struct snd_soc_codec *codec, unsigned int reg,
 				     const void *data, size_t len)
 {
-	int ret;
+	int ret = 0;
 
 	/* Ensure that the base register is volatile.  Subsequently
 	 * any other register that is touched by this routine should be
@@ -415,10 +415,14 @@ static int snd_soc_hw_bulk_write_raw(struct snd_soc_codec *codec, unsigned int r
 
 	switch (codec->control_type) {
 	case SND_SOC_I2C:
+#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
 		ret = i2c_master_send(codec->control_data, data, len);
+#endif
 		break;
 	case SND_SOC_SPI:
+#if defined(CONFIG_SPI_MASTER)
 		ret = do_spi_write(codec->control_data, data, len);
+#endif
 		break;
 	default:
 		BUG();
-- 
1.7.1



More information about the Alsa-devel mailing list