[PATCH 5/5] drm/zte: Use common drm_fixed_16_16 helper

From: Alyssa Rosenzweig
Date: Wed Sep 01 2021 - 13:55:37 EST


Replace our open-coded FRAC_16_16 with the common drm_fixed_16_16
helper to reduce code duplication between drivers.

Signed-off-by: Alyssa Rosenzweig <alyssa@xxxxxxxxxxxxx>
---
drivers/gpu/drm/zte/zx_plane.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/zte/zx_plane.c b/drivers/gpu/drm/zte/zx_plane.c
index 93bcca428e35..80f61d79be83 100644
--- a/drivers/gpu/drm/zte/zx_plane.c
+++ b/drivers/gpu/drm/zte/zx_plane.c
@@ -11,6 +11,7 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_plane_helper.h>
+#include <drm/drm_fixed.h>

#include "zx_common_regs.h"
#include "zx_drm_drv.h"
@@ -43,8 +44,6 @@ static const uint32_t vl_formats[] = {
*/
};

-#define FRAC_16_16(mult, div) (((mult) << 16) / (div))
-
static int zx_vl_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_state *state)
{
@@ -53,8 +52,8 @@ static int zx_vl_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *fb = plane_state->fb;
struct drm_crtc *crtc = plane_state->crtc;
struct drm_crtc_state *crtc_state;
- int min_scale = FRAC_16_16(1, 8);
- int max_scale = FRAC_16_16(8, 1);
+ int min_scale = drm_fixed_16_16(1, 8);
+ int max_scale = drm_fixed_16_16(8, 1);

if (!crtc || WARN_ON(!fb))
return 0;
--
2.30.2