[PATCH 1/1 linux-next] drm: atmel-hlcdc: use swap() in atmel_hlcdc_plane_atomic_check()

Fabian Frederick fabf at skynet.be
Wed Jun 10 09:31:57 PDT 2015


Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf at skynet.be>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index be9fa82..abe3ba9 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -548,7 +548,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 	unsigned int patched_crtc_h;
 	unsigned int patched_src_w;
 	unsigned int patched_src_h;
-	unsigned int tmp;
 	int x_offset = 0;
 	int y_offset = 0;
 	int hsub = 1;
@@ -586,12 +585,8 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 	 * Swap width and size in case of 90 or 270 degrees rotation
 	 */
 	if (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
-		tmp = state->crtc_w;
-		state->crtc_w = state->crtc_h;
-		state->crtc_h = tmp;
-		tmp = state->src_w;
-		state->src_w = state->src_h;
-		state->src_h = tmp;
+		swap(state->crtc_w, state->crtc_h);
+		swap(state->src_w, state->src_h);
 	}
 
 	if (state->crtc_x + state->crtc_w > mode->hdisplay)
-- 
2.4.2



More information about the dri-devel mailing list