[03/32] drm/radeon: Use DIV_ROUND_UP()
diff mbox

Message ID 1479399271-31991-4-git-send-email-ville.syrjala@linux.intel.com
State New
Headers show

Commit Message

Ville Syrjälä Nov. 17, 2016, 4:14 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use DIV_ROUND_UP() instead of hand rolling it. Just a drive-by change.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Alex Deucher Nov. 17, 2016, 5:22 p.m. UTC | #1
On Thu, Nov 17, 2016 at 11:14 AM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Use DIV_ROUND_UP() instead of hand rolling it. Just a drive-by change.
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index bb5346812de4..31c03e32a6b5 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -477,9 +477,8 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,
>         crtc_offset_cntl = 0;
>
>         pitch_pixels = target_fb->pitches[0] / (target_fb->bits_per_pixel / 8);
> -       crtc_pitch  = (((pitch_pixels * target_fb->bits_per_pixel) +
> -                       ((target_fb->bits_per_pixel * 8) - 1)) /
> -                      (target_fb->bits_per_pixel * 8));
> +       crtc_pitch = DIV_ROUND_UP(pitch_pixels * target_fb->bits_per_pixel,
> +                                 target_fb->bits_per_pixel * 8);
>         crtc_pitch |= crtc_pitch << 16;
>
>         crtc_offset_cntl |= RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN;
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index bb5346812de4..31c03e32a6b5 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -477,9 +477,8 @@  int radeon_crtc_do_set_base(struct drm_crtc *crtc,
 	crtc_offset_cntl = 0;
 
 	pitch_pixels = target_fb->pitches[0] / (target_fb->bits_per_pixel / 8);
-	crtc_pitch  = (((pitch_pixels * target_fb->bits_per_pixel) +
-			((target_fb->bits_per_pixel * 8) - 1)) /
-		       (target_fb->bits_per_pixel * 8));
+	crtc_pitch = DIV_ROUND_UP(pitch_pixels * target_fb->bits_per_pixel,
+				  target_fb->bits_per_pixel * 8);
 	crtc_pitch |= crtc_pitch << 16;
 
 	crtc_offset_cntl |= RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN;