2020-12-22 13:35:24

by Zheng Yongjun

[permalink] [raw]
Subject: [PATCH -next] gpu/drm/radeon: use DIV_ROUND_UP macro to do calculation

Don't open-code DIV_ROUND_UP() kernel macro.

Signed-off-by: Zheng Yongjun <[email protected]>
---
drivers/gpu/drm/radeon/r600_cs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 390a9621604a..a3aea5329712 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -219,7 +219,7 @@ int r600_fmt_get_nblocksx(u32 format, u32 w)
if (bw == 0)
return 0;

- return (w + bw - 1) / bw;
+ return DIV_ROUND_UP(w, bw);
}

int r600_fmt_get_nblocksy(u32 format, u32 h)
@@ -233,7 +233,7 @@ int r600_fmt_get_nblocksy(u32 format, u32 h)
if (bh == 0)
return 0;

- return (h + bh - 1) / bh;
+ return DIV_ROUND_UP(h, bh);
}

struct array_mode_checker {
--
2.22.0


2021-01-04 17:04:44

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH -next] gpu/drm/radeon: use DIV_ROUND_UP macro to do calculation

On Wed, Dec 23, 2020 at 2:06 AM Zheng Yongjun <[email protected]> wrote:
>
> Don't open-code DIV_ROUND_UP() kernel macro.
>
> Signed-off-by: Zheng Yongjun <[email protected]>

Applied. Thanks!

Alex


> ---
> drivers/gpu/drm/radeon/r600_cs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index 390a9621604a..a3aea5329712 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -219,7 +219,7 @@ int r600_fmt_get_nblocksx(u32 format, u32 w)
> if (bw == 0)
> return 0;
>
> - return (w + bw - 1) / bw;
> + return DIV_ROUND_UP(w, bw);
> }
>
> int r600_fmt_get_nblocksy(u32 format, u32 h)
> @@ -233,7 +233,7 @@ int r600_fmt_get_nblocksy(u32 format, u32 h)
> if (bh == 0)
> return 0;
>
> - return (h + bh - 1) / bh;
> + return DIV_ROUND_UP(h, bh);
> }
>
> struct array_mode_checker {
> --
> 2.22.0
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx