From patchwork Wed Sep 19 15:44:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Wang X-Patchwork-Id: 10606039 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03DB71390 for ; Wed, 19 Sep 2018 15:44:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E92A9286DC for ; Wed, 19 Sep 2018 15:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC5162874A; Wed, 19 Sep 2018 15:44:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 752C4286DC for ; Wed, 19 Sep 2018 15:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732469AbeISVW5 (ORCPT ); Wed, 19 Sep 2018 17:22:57 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:43059 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732294AbeISVW5 (ORCPT ); Wed, 19 Sep 2018 17:22:57 -0400 Received: by mail-yb1-f193.google.com with SMTP id w80-v6so2552896ybe.10 for ; Wed, 19 Sep 2018 08:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pWUoaHdWNYbT1VHvFbV5zRlmk2PD/DXO6SjUkzIlK6w=; b=AWnaeZbVwX0qeT/smEUKvChBtxTRxkksufyk4hxp4F4gYnc/PGV8sh+BsPDgrYe7fS HBhquPIwcohZV1d8ijjqwrG5LgbwmKGnXi5aikswKw8ajYZL+pCwzNMV9wO4wTQiLY0T mZC3ccLpxt+Eimzs/2lXKGWwT2d5Hrwt6hdho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pWUoaHdWNYbT1VHvFbV5zRlmk2PD/DXO6SjUkzIlK6w=; b=ZbtiJjmNMoQJYUogQqJBdpUq2L68Jgqs9mRsQhN4KvSx3/fNnjGARBnK7lDwPnq/7+ WhsctGxLMeFyMyOa4s57lcWjH7AOssrz7mf/tyAAd7AZH0KYelyxWPd5DfHa/+cLd8LQ nWst5Frhj434L+BNxPJ/eTEVzuThahoBZwZuCgqtznJc/WzNhGX1GBcMB79wltN0YUHk bRJWQtt8ihY81yQdUpkJFr5Vp+h0pzPehJl3RrNx+FIycy3kmLSBuHaVezWwX12nE1lj sop5tC33r+4pRmlQLAlCbSuauI8oY+nB2MfnY7/MF6FCKmuev9Yl01dKliR3GxzrUnN4 FX3A== X-Gm-Message-State: APzg51DtfgjvWb0a/DIyYQSIowKiaDhFKMIWPOw6ZVKmU8RMkHYrQJ6c VjdwkxOINpVYZn7SqtdDaqX9ig== X-Google-Smtp-Source: ANB0VdZiBEC3pZ5ebeeSlt+VW4p5k9TJiLlqCZ1IFoODnFma3YeO0TVM0deRgsCAPfDsevbYPUsMYg== X-Received: by 2002:a25:b794:: with SMTP id n20-v6mr15768171ybh.130.1537371866333; Wed, 19 Sep 2018 08:44:26 -0700 (PDT) Received: from bzwang.cnc.corp.google.com ([2620:0:1013:11:6f9e:dcbe:41ef:a61]) by smtp.gmail.com with ESMTPSA id h10-v6sm4425921ywa.35.2018.09.19.08.44.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 08:44:25 -0700 (PDT) From: Bruce Wang To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: seanpaul@chromium.org, jsanka@codeaurora.org, robdclark@gmail.com, abhinavk@codeaurora.org, Bruce Wang Subject: [PATCH 1/5] drm/msm/dpu: Remove unneeded checks from dpu_plane Date: Wed, 19 Sep 2018 11:44:11 -0400 Message-Id: <20180919154415.131292-2-bzwang@chromium.org> X-Mailer: git-send-email 2.19.0.397.gdd90340f6a-goog In-Reply-To: <20180919154415.131292-1-bzwang@chromium.org> References: <20180919154415.131292-1-bzwang@chromium.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Removes some checks from dpu_plane.c that will never result in an error. Subsequent variable assignments become part of the initialization wherever possible. Signed-off-by: Bruce Wang --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 53 +++-------------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 1ce76460d710..a8d00f57f06a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -229,19 +229,11 @@ static u64 _dpu_plane_get_qos_lut(const struct dpu_qos_lut_tbl *tbl, static void _dpu_plane_set_qos_lut(struct drm_plane *plane, struct drm_framebuffer *fb) { - struct dpu_plane *pdpu; + struct dpu_plane *pdpu = to_dpu_plane(plane); const struct dpu_format *fmt = NULL; u64 qos_lut; u32 total_fl = 0, lut_usage; - if (!plane || !fb) { - DPU_ERROR("invalid arguments plane %d fb %d\n", - plane != 0, fb != 0); - return; - } - - pdpu = to_dpu_plane(plane); - if (!pdpu->pipe_hw || !pdpu->pipe_sblk || !pdpu->catalog) { DPU_ERROR("invalid arguments\n"); return; @@ -290,17 +282,10 @@ static void _dpu_plane_set_qos_lut(struct drm_plane *plane, static void _dpu_plane_set_danger_lut(struct drm_plane *plane, struct drm_framebuffer *fb) { - struct dpu_plane *pdpu; + struct dpu_plane *pdpu = to_dpu_plane(plane); const struct dpu_format *fmt = NULL; u32 danger_lut, safe_lut; - if (!plane || !fb) { - DPU_ERROR("invalid arguments\n"); - return; - } - - pdpu = to_dpu_plane(plane); - if (!pdpu->pipe_hw || !pdpu->pipe_sblk || !pdpu->catalog) { DPU_ERROR("invalid arguments\n"); return; @@ -361,14 +346,7 @@ static void _dpu_plane_set_danger_lut(struct drm_plane *plane, static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane, bool enable, u32 flags) { - struct dpu_plane *pdpu; - - if (!plane) { - DPU_ERROR("invalid arguments\n"); - return; - } - - pdpu = to_dpu_plane(plane); + struct dpu_plane *pdpu = to_dpu_plane(plane); if (!pdpu->pipe_hw || !pdpu->pipe_sblk) { DPU_ERROR("invalid arguments\n"); @@ -452,16 +430,9 @@ static void _dpu_plane_set_ot_limit(struct drm_plane *plane, { struct dpu_plane *pdpu; struct dpu_vbif_set_ot_params ot_params; - struct msm_drm_private *priv; + struct msm_drm_private *priv = plane->dev->dev_private; struct dpu_kms *dpu_kms; - if (!plane || !plane->dev || !crtc) { - DPU_ERROR("invalid arguments plane %d crtc %d\n", - plane != 0, crtc != 0); - return; - } - - priv = plane->dev->dev_private; if (!priv || !priv->kms) { DPU_ERROR("invalid KMS reference\n"); return; @@ -496,15 +467,9 @@ static void _dpu_plane_set_qos_remap(struct drm_plane *plane) { struct dpu_plane *pdpu; struct dpu_vbif_set_qos_params qos_params; - struct msm_drm_private *priv; + struct msm_drm_private *priv = plane->dev->dev_private; struct dpu_kms *dpu_kms; - if (!plane || !plane->dev) { - DPU_ERROR("invalid arguments\n"); - return; - } - - priv = plane->dev->dev_private; if (!priv || !priv->kms) { DPU_ERROR("invalid KMS reference\n"); return; @@ -1737,17 +1702,11 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev, struct drm_plane *plane = NULL, *master_plane = NULL; const struct dpu_format_extended *format_list; struct dpu_plane *pdpu; - struct msm_drm_private *priv; + struct msm_drm_private *priv = dev->dev_private; struct dpu_kms *kms; int zpos_max = DPU_ZPOS_MAX; int ret = -EINVAL; - if (!dev) { - DPU_ERROR("[%u]device is NULL\n", pipe); - goto exit; - } - - priv = dev->dev_private; if (!priv) { DPU_ERROR("[%u]private data is NULL\n", pipe); goto exit;