From patchwork Fri May 15 14:07:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6414381 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C57299F32E for ; Fri, 15 May 2015 14:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBBCC2051D for ; Fri, 15 May 2015 14:07:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D17B82051F for ; Fri, 15 May 2015 14:07:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B8176E9DF; Fri, 15 May 2015 07:07:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id C38CB6E9DF for ; Fri, 15 May 2015 07:07:04 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 15 May 2015 07:07:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,434,1427785200"; d="scan'208";a="571891799" Received: from younglae-mobl.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.252.196.157]) by orsmga003.jf.intel.com with ESMTP; 15 May 2015 07:07:05 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Fri, 15 May 2015 15:07:02 +0100 Message-Id: <1431698822-21320-1-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <20150512180029.GN18908@intel.com> References: <20150512180029.GN18908@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915/skl: Remove unnecessary local variables in skl_plane_ctl*() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ville noticed in another patch we we didn't need them at all, so remove them. It's worth saying that it makes no difference to code generated as gcc is clever enough to optimize it out. v2: Remove 'break' after 'return' in switches (Ville) Suggested-by: Ville Syrjälä Reviewed-by: Ville Syrjälä Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/intel_display.c | 66 ++++++++++++------------------------ 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 980afae..9158b4a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2979,103 +2979,79 @@ void skl_detach_scalers(struct intel_crtc *intel_crtc) u32 skl_plane_ctl_format(uint32_t pixel_format) { - u32 format = 0; - switch (pixel_format) { case DRM_FORMAT_C8: - format = PLANE_CTL_FORMAT_INDEXED; - break; + return PLANE_CTL_FORMAT_INDEXED; case DRM_FORMAT_RGB565: - format = PLANE_CTL_FORMAT_RGB_565; - break; + return PLANE_CTL_FORMAT_RGB_565; case DRM_FORMAT_XBGR8888: - format = PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX; - break; + return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX; case DRM_FORMAT_XRGB8888: - format = PLANE_CTL_FORMAT_XRGB_8888; - break; + return PLANE_CTL_FORMAT_XRGB_8888; /* * XXX: For ARBG/ABGR formats we default to expecting scanout buffers * to be already pre-multiplied. We need to add a knob (or a different * DRM_FORMAT) for user-space to configure that. */ case DRM_FORMAT_ABGR8888: - format = PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX | + return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX | PLANE_CTL_ALPHA_SW_PREMULTIPLY; - break; case DRM_FORMAT_ARGB8888: - format = PLANE_CTL_FORMAT_XRGB_8888 | + return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ALPHA_SW_PREMULTIPLY; - break; case DRM_FORMAT_XRGB2101010: - format = PLANE_CTL_FORMAT_XRGB_2101010; - break; + return PLANE_CTL_FORMAT_XRGB_2101010; case DRM_FORMAT_XBGR2101010: - format = PLANE_CTL_ORDER_RGBX | PLANE_CTL_FORMAT_XRGB_2101010; - break; + return PLANE_CTL_ORDER_RGBX | PLANE_CTL_FORMAT_XRGB_2101010; case DRM_FORMAT_YUYV: - format = PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YUYV; - break; + return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YUYV; case DRM_FORMAT_YVYU: - format = PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YVYU; - break; + return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YVYU; case DRM_FORMAT_UYVY: - format = PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_UYVY; - break; + return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_UYVY; case DRM_FORMAT_VYUY: - format = PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_VYUY; - break; + return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_VYUY; default: MISSING_CASE(pixel_format); } - return format; + return 0; } u32 skl_plane_ctl_tiling(uint64_t fb_modifier) { - u32 plane_ctl_tiling = 0; - switch (fb_modifier) { case DRM_FORMAT_MOD_NONE: break; case I915_FORMAT_MOD_X_TILED: - plane_ctl_tiling = PLANE_CTL_TILED_X; - break; + return PLANE_CTL_TILED_X; case I915_FORMAT_MOD_Y_TILED: - plane_ctl_tiling = PLANE_CTL_TILED_Y; - break; + return PLANE_CTL_TILED_Y; case I915_FORMAT_MOD_Yf_TILED: - plane_ctl_tiling = PLANE_CTL_TILED_YF; - break; + return PLANE_CTL_TILED_YF; default: MISSING_CASE(fb_modifier); } - return plane_ctl_tiling; + return 0; } u32 skl_plane_ctl_rotation(unsigned int rotation) { - u32 plane_ctl_rotation = 0; - switch (rotation) { case BIT(DRM_ROTATE_0): break; case BIT(DRM_ROTATE_90): - plane_ctl_rotation = PLANE_CTL_ROTATE_90; - break; + return PLANE_CTL_ROTATE_90; case BIT(DRM_ROTATE_180): - plane_ctl_rotation = PLANE_CTL_ROTATE_180; - break; + return PLANE_CTL_ROTATE_180; case BIT(DRM_ROTATE_270): - plane_ctl_rotation = PLANE_CTL_ROTATE_270; - break; + return PLANE_CTL_ROTATE_270; default: MISSING_CASE(rotation); } - return plane_ctl_rotation; + return 0; } static void skylake_update_primary_plane(struct drm_crtc *crtc,