From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes()
Date: Mon, 23 Mar 2026 15:04:45 +0100 [thread overview]
Message-ID: <20260323140445.3496736-1-andriy.shevchenko@linux.intel.com> (raw)
__spi_validate() open codes the functionality of spi_bpw_to_bytes().
Replace the custom piece by the call to the mentioned function.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/spi/spi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 200d942c85bb..cd1561d84e73 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -4222,12 +4222,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
* SPI transfer length should be multiple of SPI word size
* where SPI word size should be power-of-two multiple.
*/
- if (xfer->bits_per_word <= 8)
- w_size = 1;
- else if (xfer->bits_per_word <= 16)
- w_size = 2;
- else
- w_size = 4;
+ w_size = spi_bpw_to_bytes(xfer->bits_per_word);
/* No partial transfers accepted */
if (xfer->len % w_size)
--
2.50.1
next reply other threads:[~2026-03-23 14:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 14:04 Andy Shevchenko [this message]
2026-03-23 15:46 ` [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes() 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=20260323140445.3496736-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.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