From dbd4d5761e1f06fd86abe0b256e049b501cea059 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Fri, 18 Nov 2016 21:53:10 +0200 Subject: drm: Replace 'format->format' comparisons to just 'format' comparisons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than compare the format u32s of two format infos, we can direclty compare the format info pointers themselves. Noramlly all the ->format pointers all point to somwehere in the big array, so this is a valid way to test for equality. Also drivers may want to point ->format at a private format info struct instead (eg. for special compressed formats with extra planes), so just comparing the pixel format values wouldn't necessaritly even work. But comparing the pointers will also take care of that case. @@ struct drm_framebuffer *a; struct drm_framebuffer *b; @@ ( - a->format->format != b->format->format + a->format != b->format | - a->format->format == b->format->format + a->format == b->format ) @@ struct drm_plane_state *a; struct drm_plane_state *b; @@ ( - a->fb->format->format != b->fb->format->format + a->fb->format != b->fb->format | - a->fb->format->format == b->fb->format->format + a->fb->format == b->fb->format ) @@ struct drm_crtc *crtc; struct drm_framebuffer *x; @@ ( - crtc->primary->fb->format->format != x->format->format + crtc->primary->fb->format != x->format | - x->format->format != crtc->primary->fb->format->format + x->format != crtc->primary->fb->format ) @@ struct drm_mode_set *set; @@ - set->fb->format->format != set->crtc->primary->fb->format->format + set->fb->format != set->crtc->primary->fb->format Cc: Laurent Pinchart Suggested-by: Laurent Pinchart Signed-off-by: Ville Syrjälä Link: http://patchwork.freedesktop.org/patch/msgid/1479498793-31021-35-git-send-email-ville.syrjala@linux.intel.com Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/armada/armada_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/drm/armada') diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 41fc6ee9da91..e62ee4498ce4 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -1035,7 +1035,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc, int ret; /* We don't support changing the pixel format */ - if (fb->format->format != crtc->primary->fb->format->format) + if (fb->format != crtc->primary->fb->format) return -EINVAL; work = kmalloc(sizeof(*work), GFP_KERNEL); -- cgit v1.2.3-59-g8ed1b