The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes()
@ 2026-03-23 14:04 Andy Shevchenko
  2026-03-23 15:46 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-03-23 14:04 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel; +Cc: Andy Shevchenko

__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


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

* Re: [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes()
  2026-03-23 14:04 [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes() Andy Shevchenko
@ 2026-03-23 15:46 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-03-23 15:46 UTC (permalink / raw)
  To: linux-spi, linux-kernel, Andy Shevchenko

On Mon, 23 Mar 2026 15:04:45 +0100, Andy Shevchenko wrote:
> spi: Replace open coded variant of spi_bpw_to_bytes()

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.1

Thanks!

[1/1] spi: Replace open coded variant of spi_bpw_to_bytes()
      https://git.kernel.org/broonie/spi/c/9861e15f6347

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2026-03-24  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 14:04 [PATCH v1 1/1] spi: Replace open coded variant of spi_bpw_to_bytes() Andy Shevchenko
2026-03-23 15:46 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox