drm: Use DRM_ROTATE_MASK and DRM_REFLECT_MASK
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Thu, 1 Oct 2015 07:00:58 +0000 (10:00 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 5 Oct 2015 13:32:51 +0000 (15:32 +0200)
Avoid magic numbers and use the introduced defines.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_rect.c
drivers/gpu/drm/omapdrm/omap_fb.c
drivers/gpu/drm/omapdrm/omap_plane.c

index 36fda86b351896c42215669d4556137189743c31..d0299aed517e61039cd4b0b93897b21f7c13390c 100644 (file)
@@ -633,7 +633,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
                if (!state->bpp[i])
                        return -EINVAL;
 
-               switch (state->base.rotation & 0xf) {
+               switch (state->base.rotation & DRM_ROTATE_MASK) {
                case BIT(DRM_ROTATE_90):
                        offset = ((y_offset + state->src_y + patched_src_w - 1) /
                                  ydiv) * fb->pitches[i];
index e600a5fb2b60f65b1de6a72168f16baaf83c63fb..e7c842289568e48c6bfab801e75c2296a0b8b824 100644 (file)
@@ -5629,7 +5629,8 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
 {
        if (rotation & ~supported_rotations) {
                rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
-               rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4);
+               rotation = (rotation & DRM_REFLECT_MASK) |
+                          BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
        }
 
        return rotation;
index 631f5afd451c2bed39e94bde3e2ad71483c6e0ae..531ac4cc9756deb9e51f12fd4aefcff46a5c72b7 100644 (file)
@@ -330,7 +330,7 @@ void drm_rect_rotate(struct drm_rect *r,
                }
        }
 
-       switch (rotation & 0xf) {
+       switch (rotation & DRM_ROTATE_MASK) {
        case BIT(DRM_ROTATE_0):
                break;
        case BIT(DRM_ROTATE_90):
@@ -390,7 +390,7 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 {
        struct drm_rect tmp;
 
-       switch (rotation & 0xf) {
+       switch (rotation & DRM_ROTATE_MASK) {
        case BIT(DRM_ROTATE_0):
                break;
        case BIT(DRM_ROTATE_90):
index 51b1219af87f1b29fbbe641fa2fbfd51b5c3b92d..636a1f921569a55edcac211e2869dca9eaee7125 100644 (file)
@@ -171,7 +171,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
                uint32_t w = win->src_w;
                uint32_t h = win->src_h;
 
-               switch (win->rotation & 0xf) {
+               switch (win->rotation & DRM_ROTATE_MASK) {
                default:
                        dev_err(fb->dev->dev, "invalid rotation: %02x",
                                        (uint32_t)win->rotation);
@@ -209,7 +209,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
                info->rotation_type = OMAP_DSS_ROT_TILER;
                info->screen_width  = omap_gem_tiled_stride(plane->bo, orient);
        } else {
-               switch (win->rotation & 0xf) {
+               switch (win->rotation & DRM_ROTATE_MASK) {
                case 0:
                case BIT(DRM_ROTATE_0):
                        /* OK */
index 09e363bb55f2e2a8a6a143cd2136a483f4be2a08..3054bda72688dbd6b2bbfb0101c793d00fcda5c5 100644 (file)
@@ -108,7 +108,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
        win.src_x = state->src_x >> 16;
        win.src_y = state->src_y >> 16;
 
-       switch (state->rotation & 0xf) {
+       switch (state->rotation & DRM_ROTATE_MASK) {
        case BIT(DRM_ROTATE_90):
        case BIT(DRM_ROTATE_270):
                win.src_w = state->src_h >> 16;