mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] regmap: spi: Use spi_message_init_with_transfers()
@ 2023-07-10 14:23 Andy Shevchenko
  2023-07-10 14:34 ` Cristian Ciocaltea
  2023-07-10 14:38 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-07-10 14:23 UTC (permalink / raw)
  To: Cristian Ciocaltea, Andy Shevchenko, linux-kernel
  Cc: Mark Brown, Greg Kroah-Hartman, Rafael J. Wysocki

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-10 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10 14:23 [PATCH v1 1/1] regmap: spi: Use spi_message_init_with_transfers() Andy Shevchenko
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

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®