[alsa-devel] [PATCH 4/4] ASoC: Use spi_write in do_spi_write

Lars-Peter Clausen lars at metafoo.de
Thu May 5 19:52:46 CEST 2011


Instead of open-coding the spi transfer use spi_write.

Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
---
 sound/soc/soc-cache.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index f1ee207..3897d4a 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -25,20 +25,14 @@ static int do_spi_write(void *control_data, const char *msg,
 			int len)
 {
 	struct spi_device *spi = control_data;
-	struct spi_transfer t;
-	struct spi_message m;
+	int ret;
 
 	if (len <= 0)
 		return 0;
 
-	spi_message_init(&m);
-	memset(&t, 0, sizeof t);
-
-	t.tx_buf = msg;
-	t.len = len;
-
-	spi_message_add_tail(&t, &m);
-	spi_sync(spi, &m);
+	ret = spi_write(spi, msg, len);
+	if (ret < 0)
+		return ret;
 
 	return len;
 }
-- 
1.7.2.5



More information about the Alsa-devel mailing list