mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-kernel@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH v1 1/1] regmap: spi: Use spi_message_init_with_transfers()
Date: Mon, 10 Jul 2023 17:23:35 +0300	[thread overview]
Message-ID: <20230710142335.66598-1-andriy.shevchenko@linux.intel.com> (raw)

Use spi_message_init_with_transfers() instead of open coded variants.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap-spi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c
index 37ab23a9d034..65e8adac8d0e 100644
--- a/drivers/base/regmap/regmap-spi.c
+++ b/drivers/base/regmap/regmap-spi.c
@@ -43,9 +43,7 @@ static int regmap_spi_gather_write(void *context,
 	struct spi_transfer t[2] = { { .tx_buf = reg, .len = reg_len, },
 				     { .tx_buf = val, .len = val_len, }, };
 
-	spi_message_init(&m);
-	spi_message_add_tail(&t[0], &m);
-	spi_message_add_tail(&t[1], &m);
+	spi_message_init_with_transfers(&m, t, 2);
 
 	return spi_sync(spi, &m);
 }
@@ -66,10 +64,7 @@ static int regmap_spi_async_write(void *context,
 	async->t[1].tx_buf = val;
 	async->t[1].len = val_len;
 
-	spi_message_init(&async->m);
-	spi_message_add_tail(&async->t[0], &async->m);
-	if (val)
-		spi_message_add_tail(&async->t[1], &async->m);
+	spi_message_init_with_transfers(&async->m, async->t, val ? 2 : 1);
 
 	async->m.complete = regmap_spi_complete;
 	async->m.context = async;
-- 
2.40.0.1.gaa8946217a0b


             reply	other threads:[~2023-07-10 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 14:23 Andy Shevchenko [this message]
2023-07-10 14:34 ` Cristian Ciocaltea
2023-07-10 14:38 ` Mark Brown
2023-07-10 15:01   ` Andy Shevchenko
2023-07-10 15:54     ` Mark Brown

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=20230710142335.66598-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.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

all inboxes | Powered by JetHome®