* [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
* [PATCH 2/2] mmc: tifm_sd: Use min3() to simplify tifm_sd_transfer_data()
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 ` 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
1 sibling, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-03-05 12:25 UTC (permalink / raw)
To: Alex Dubov, Ulf Hansson; +Cc: Thorsten Blum, linux-mmc, linux-kernel
Use min3() to simplify tifm_sd_transfer_data().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/mmc/host/tifm_sd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 2cd69c9e9571..c1f7d5b37911 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -193,9 +193,7 @@ static void tifm_sd_transfer_data(struct tifm_sd *host)
pg = sg_page(&sg[host->sg_pos]) + (off >> PAGE_SHIFT);
p_off = offset_in_page(off);
- p_cnt = PAGE_SIZE - p_off;
- p_cnt = min(p_cnt, cnt);
- p_cnt = min(p_cnt, t_size);
+ p_cnt = min3(PAGE_SIZE - p_off, cnt, t_size);
if (r_data->flags & MMC_DATA_READ)
tifm_sd_read_fifo(host, pg, p_off, p_cnt);
--
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
* Re: [PATCH 1/2] mmc: sdio: Use min3() to simplify sdio_set_block_size()
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
1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2026-03-09 15:06 UTC (permalink / raw)
To: Thorsten Blum; +Cc: linux-mmc, linux-kernel
On Thu, 5 Mar 2026 at 13:26, Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Use min3() to simplify sdio_set_block_size().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Applied for next, thanks!
Kind regards
Uffe
> ---
> 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 [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mmc: tifm_sd: Use min3() to simplify tifm_sd_transfer_data()
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
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2026-03-09 15:06 UTC (permalink / raw)
To: Thorsten Blum; +Cc: Alex Dubov, linux-mmc, linux-kernel
On Thu, 5 Mar 2026 at 13:26, Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Use min3() to simplify tifm_sd_transfer_data().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/tifm_sd.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
> index 2cd69c9e9571..c1f7d5b37911 100644
> --- a/drivers/mmc/host/tifm_sd.c
> +++ b/drivers/mmc/host/tifm_sd.c
> @@ -193,9 +193,7 @@ static void tifm_sd_transfer_data(struct tifm_sd *host)
>
> pg = sg_page(&sg[host->sg_pos]) + (off >> PAGE_SHIFT);
> p_off = offset_in_page(off);
> - p_cnt = PAGE_SIZE - p_off;
> - p_cnt = min(p_cnt, cnt);
> - p_cnt = min(p_cnt, t_size);
> + p_cnt = min3(PAGE_SIZE - p_off, cnt, t_size);
>
> if (r_data->flags & MMC_DATA_READ)
> tifm_sd_read_fifo(host, pg, p_off, p_cnt);
> --
> Thorsten Blum <thorsten.blum@linux.dev>
> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
>
^ permalink raw reply [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