linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding
Date: Wed, 10 Oct 2018 15:43:16 +0200	[thread overview]
Message-ID: <20181010134317.8466-3-geert+renesas@glider.be> (raw)
In-Reply-To: <20181010134317.8466-1-geert+renesas@glider.be>

Reduce code duplication in at25_ee_read() by using the
spi_message_init_with_transfers() helper.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/misc/eeprom/at25.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 7707d3fb49b526d9..5c8dc7ad391435f7 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -103,16 +103,15 @@ static int at25_ee_read(void *priv, unsigned int offset,
 		*cp++ = offset >> 0;
 	}
 
-	spi_message_init(&m);
 	memset(t, 0, sizeof(t));
 
 	t[0].tx_buf = command;
 	t[0].len = at25->addrlen + 1;
-	spi_message_add_tail(&t[0], &m);
 
 	t[1].rx_buf = buf;
 	t[1].len = count;
-	spi_message_add_tail(&t[1], &m);
+
+	spi_message_init_with_transfers(&m, t, ARRAY_SIZE(t));
 
 	mutex_lock(&at25->lock);
 
-- 
2.17.1


  parent reply	other threads:[~2018-10-10 13:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 13:40 [PATCH 0/3] eeprom: at25: SPI transfer improvements Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 1/3] eeprom: at25: Drop obsolete cast in at25_ee_write() Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 3/3] eeprom: at25: Split writes in two SPI transfers to optimize DMA Geert Uytterhoeven
2018-10-10 21:47   ` Trent Piepho
2018-10-11  6:59     ` Geert Uytterhoeven
2018-10-10 13:43 ` [PATCH 0/3] eeprom: at25: SPI transfer improvements Geert Uytterhoeven
2018-10-10 13:43   ` [PATCH 1/3] eeprom: at25: Drop obsolete cast in at25_ee_write() Geert Uytterhoeven
2018-10-10 14:01     ` Arnd Bergmann
2018-10-10 14:42       ` Geert Uytterhoeven
2018-10-10 13:43   ` Geert Uytterhoeven [this message]
2018-10-10 14:02     ` [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding Arnd Bergmann
2018-10-10 13:43   ` [PATCH 3/3] eeprom: at25: Split writes in two SPI transfers to optimize DMA Geert Uytterhoeven
2018-10-10 14:03     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181010134317.8466-3-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).