diff mbox series

[-next] ASoC: rt5677: Fix build error without CONFIG_SPI

Message ID 20191127082145.6100-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Commit fb3194413d1ef79732931a40f54da21a16505a76
Headers show
Series [-next] ASoC: rt5677: Fix build error without CONFIG_SPI | expand

Commit Message

Yue Haibing Nov. 27, 2019, 8:21 a.m. UTC
If CONFIG_SPI is n, SND_SOC_RT5677_SPI also is n, building fails:

sound/soc/codecs/rt5677.o: In function `rt5677_irq':
rt5677.c:(.text+0x2dbf): undefined reference to `rt5677_spi_hotword_detected'
sound/soc/codecs/rt5677.o: In function `rt5677_dsp_work':
rt5677.c:(.text+0x3709): undefined reference to `rt5677_spi_write'

This adds stub helpers to fix this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 461c623270e4 ("ASoC: rt5677: Load firmware via SPI using delayed work")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 sound/soc/codecs/rt5677-spi.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Curtis Malainey Nov. 27, 2019, 6:59 p.m. UTC | #1
On Wed, Nov 27, 2019 at 12:22 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> If CONFIG_SPI is n, SND_SOC_RT5677_SPI also is n, building fails:
>
> sound/soc/codecs/rt5677.o: In function `rt5677_irq':
> rt5677.c:(.text+0x2dbf): undefined reference to `rt5677_spi_hotword_detected'
> sound/soc/codecs/rt5677.o: In function `rt5677_dsp_work':
> rt5677.c:(.text+0x3709): undefined reference to `rt5677_spi_write'
>
> This adds stub helpers to fix this.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 461c623270e4 ("ASoC: rt5677: Load firmware via SPI using delayed work")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Curtis Malainey <cujomalainey@chromium.org>
> ---
>  sound/soc/codecs/rt5677-spi.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5677-spi.h b/sound/soc/codecs/rt5677-spi.h
index 3af36ec..088b779 100644
--- a/sound/soc/codecs/rt5677-spi.h
+++ b/sound/soc/codecs/rt5677-spi.h
@@ -9,9 +9,25 @@ 
 #ifndef __RT5677_SPI_H__
 #define __RT5677_SPI_H__
 
+#if IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI)
 int rt5677_spi_read(u32 addr, void *rxbuf, size_t len);
 int rt5677_spi_write(u32 addr, const void *txbuf, size_t len);
 int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw);
 void rt5677_spi_hotword_detected(void);
+#else
+static inline int rt5677_spi_read(u32 addr, void *rxbuf, size_t len)
+{
+	return -EINVAL;
+}
+static inline int rt5677_spi_write(u32 addr, const void *txbuf, size_t len)
+{
+	return -EINVAL;
+}
+static inline int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw)
+{
+	return -EINVAL;
+}
+static inline void rt5677_spi_hotword_detected(void){}
+#endif
 
 #endif /* __RT5677_SPI_H__ */