public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: sdio: Use min3() to simplify sdio_set_block_size()
@ 2026-03-05 12:25 Thorsten Blum
  2026-03-05 12:25 ` [PATCH 2/2] mmc: tifm_sd: Use min3() to simplify tifm_sd_transfer_data() Thorsten Blum
  2026-03-09 15:06 ` [PATCH 1/2] mmc: sdio: Use min3() to simplify sdio_set_block_size() Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-03-05 12:25 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Thorsten Blum, linux-mmc, linux-kernel

Use min3() to simplify sdio_set_block_size().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/mmc/core/sdio_io.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index b774bf51981d..12716ec0e35d 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -163,10 +163,8 @@ int sdio_set_block_size(struct sdio_func *func, unsigned blksz)
 	if (blksz > func->card->host->max_blk_size)
 		return -EINVAL;
 
-	if (blksz == 0) {
-		blksz = min(func->max_blksize, func->card->host->max_blk_size);
-		blksz = min(blksz, 512u);
-	}
+	if (blksz == 0)
+		blksz = min3(func->max_blksize, func->card->host->max_blk_size, 512u);
 
 	ret = mmc_io_rw_direct(func->card, 1, 0,
 		SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE,
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


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

end of thread, other threads:[~2026-03-09 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 12:25 [PATCH 1/2] mmc: sdio: Use min3() to simplify sdio_set_block_size() Thorsten Blum
2026-03-05 12:25 ` [PATCH 2/2] mmc: tifm_sd: Use min3() to simplify tifm_sd_transfer_data() Thorsten Blum
2026-03-09 15:06   ` Ulf Hansson
2026-03-09 15:06 ` [PATCH 1/2] mmc: sdio: Use min3() to simplify sdio_set_block_size() Ulf Hansson

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