* [PATCH -next] mmc: core: use roundup macro to to calculate blk_sz
@ 2020-12-22 13:33 Zheng Yongjun
2021-01-19 13:11 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-22 13:33 UTC (permalink / raw)
To: ulf.hansson, linux-mmc, linux-kernel; +Cc: Zheng Yongjun
Don't open-code roundup() kernel macro.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/mmc/core/sdio_io.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 79dbf90216b5..35c69bdeb40e 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -263,8 +263,7 @@ unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz)
* Realign it so that it can be done with one request,
* and recheck if the controller still likes it.
*/
- blk_sz = ((sz + func->cur_blksize - 1) /
- func->cur_blksize) * func->cur_blksize;
+ blk_sz = roundup(sz, func->cur_blksize);
blk_sz = _sdio_align_size(blk_sz);
/*
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] mmc: core: use roundup macro to to calculate blk_sz
2020-12-22 13:33 [PATCH -next] mmc: core: use roundup macro to to calculate blk_sz Zheng Yongjun
@ 2021-01-19 13:11 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2021-01-19 13:11 UTC (permalink / raw)
To: Zheng Yongjun; +Cc: linux-mmc, Linux Kernel Mailing List
On Tue, 22 Dec 2020 at 14:34, Zheng Yongjun <zhengyongjun3@huawei.com> wrote:
>
> Don't open-code roundup() kernel macro.
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/mmc/core/sdio_io.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
> index 79dbf90216b5..35c69bdeb40e 100644
> --- a/drivers/mmc/core/sdio_io.c
> +++ b/drivers/mmc/core/sdio_io.c
> @@ -263,8 +263,7 @@ unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz)
> * Realign it so that it can be done with one request,
> * and recheck if the controller still likes it.
> */
> - blk_sz = ((sz + func->cur_blksize - 1) /
> - func->cur_blksize) * func->cur_blksize;
> + blk_sz = roundup(sz, func->cur_blksize);
If I understand correctly, roundup() assumes func->cur_blksize is a
power of 2. The above doesn't, which means there is no open coding
happening here.
> blk_sz = _sdio_align_size(blk_sz);
>
> /*
> --
> 2.22.0
>
Kind regards
Uffe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-19 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 13:33 [PATCH -next] mmc: core: use roundup macro to to calculate blk_sz Zheng Yongjun
2021-01-19 13:11 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).