From: Mark Brown Date: Wed, 11 May 2011 17:25:42 +0000 (+0200) Subject: ASoC: Reintroduce do_spi_write() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f7391fce6a1553ed3375ee4d73f2deaa3fd69732;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ASoC: Reintroduce do_spi_write() There is an unfortunate difference in return values between spi_write() and i2c_master_send() so we need an adaptor function to translate. Reported-by: Lars-Peter Clausen Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 01e5b9846436..06b7b81a1601 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c @@ -20,6 +20,20 @@ #include +#ifdef CONFIG_SPI_MASTER +static int do_spi_write(void *control, const char *data, int len) +{ + struct spi_device *spi = control; + int ret; + + ret = spi_write(spi, data, len); + if (ret < 0) + return ret; + + return len; +} +#endif + static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value, const void *data, int len) { @@ -412,7 +426,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, case SND_SOC_SPI: #ifdef CONFIG_SPI_MASTER - codec->hw_write = (hw_write_t)spi_write; + codec->hw_write = do_spi_write; #endif codec->control_data = container_of(codec->dev,