From: Liam Girdwood Subject: Re: [PATCH] ASoC: Reintroduce do_spi_write() Date: Thu, 12 May 2011 09:42:21 +0100 Message-ID: <1305189742.3369.1.camel@odin> References: <1305134752-20571-1-git-send-email-broonie@opensource.wolfsonmicro.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-fx0-f51.google.com (mail-fx0-f51.google.com [209.85.161.51]) by alsa0.perex.cz (Postfix) with ESMTP id 27EDF103840 for ; Thu, 12 May 2011 10:42:26 +0200 (CEST) Received: by fxm5 with SMTP id 5so1014539fxm.38 for ; Thu, 12 May 2011 01:42:26 -0700 (PDT) In-Reply-To: <1305134752-20571-1-git-send-email-broonie@opensource.wolfsonmicro.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen , patches@opensource.wolfsonmicro.com List-Id: alsa-devel@alsa-project.org On Wed, 2011-05-11 at 19:25 +0200, Mark Brown wrote: > 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 > --- > sound/soc/soc-cache.c | 16 +++++++++++++++- > 1 files changed, 15 insertions(+), 1 deletions(-) > > diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c > index 04861c4..dee86fc 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) > { > @@ -409,7 +423,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, Acked-by: Liam Girdwood