From: Bo Sun <bo@mboxify.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/1] spi: convert transfer delay to new spi_delay struct
Date: Fri, 27 Jun 2025 20:28:11 +0800 [thread overview]
Message-ID: <20250627122811.1051283-2-bo@mboxify.com> (raw)
In-Reply-To: <20250627122811.1051283-1-bo@mboxify.com>
Replace the deprecated delay_usecs field with the new spi_delay struct
in spi_transfer structure. Update spi_transfer_one_message to use
spi_delay_exec and the mc13xxx driver to use the new structure.
Signed-off-by: Bo Sun <bo@mboxify.com>
---
drivers/mfd/mc13xxx.c | 5 ++++-
drivers/spi/spi.c | 4 +---
include/spi/spi.h | 8 ++++----
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index 288bd407ff..393f163671 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -84,7 +84,10 @@ static int spi_rw(struct spi_device *spi, void * buf, size_t len)
.rx_buf = buf,
.len = len,
.cs_change = 0,
- .delay_usecs = 0,
+ .delay = {
+ .value = 0,
+ .unit = SPI_DELAY_UNIT_USECS,
+ },
};
struct spi_message m;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f8a01dd083..b64e206649 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -463,9 +463,7 @@ static int spi_transfer_one_message(struct spi_device *spi, struct spi_message *
if (msg->status != -EINPROGRESS)
goto out;
- /* TODO: Convert to new spi_delay API */
- if (xfer->delay_usecs)
- udelay(xfer->delay_usecs);
+ spi_delay_exec(&xfer->delay, NULL);
if (xfer->cs_change) {
if (list_is_last(&xfer->transfer_list,
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 5b2d345705..00337446e6 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -413,9 +413,9 @@ static inline size_t spi_max_transfer_size(struct spi_device *spi)
* @bits_per_word: select a bits_per_word other then the device default
* for this transfer. If 0 the default (from @spi_device) is used.
* @cs_change: affects chipselect after this transfer completes
- * @delay_usecs: microseconds to delay after this transfer before
- * (optionally) changing the chipselect status, then starting
- * the next transfer or completing this @spi_message.
+ * @delay: delay to be introduced after this transfer before
+ * (optionally) changing the chipselect status, then starting
+ * the next transfer or completing this @spi_message.
* @transfer_list: transfers are sequenced through @spi_message.transfers
*
* SPI transfers always write the same number of bytes as they read.
@@ -476,7 +476,7 @@ struct spi_transfer {
unsigned cs_change:1;
u8 bits_per_word;
- u16 delay_usecs;
+ struct spi_delay delay;
u32 speed_hz;
u32 effective_speed_hz;
prev parent reply other threads:[~2025-06-27 13:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 12:28 [PATCH 0/1] " Bo Sun
2025-06-27 12:28 ` Bo Sun [this message]
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=20250627122811.1051283-2-bo@mboxify.com \
--to=bo@mboxify.com \
--cc=barebox@lists.infradead.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