From patchwork Fri Sep 6 19:23:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DFCC1398 for ; Fri, 6 Sep 2019 19:23:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E4172173B for ; Fri, 6 Sep 2019 19:23:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Yr22SN8b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732468AbfIFTXx (ORCPT ); Fri, 6 Sep 2019 15:23:53 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:47064 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731109AbfIFTXx (ORCPT ); Fri, 6 Sep 2019 15:23:53 -0400 Received: by mail-io1-f67.google.com with SMTP id x4so15179441iog.13 for ; Fri, 06 Sep 2019 12:23:53 -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:mime-version :content-transfer-encoding; bh=AE6/toJbSfVkr1wiQ76oTdfqTgHlpEwnqu8Dl52qybo=; b=Yr22SN8b0+6K0mLDWoC2RcAMt2BSA+g2SJIZhWjnemfnUIXzIb9OfP5pwLy2SunBV0 1mA0dkaunKNZD6NnQTCgqpZ+kfi0Kz3khBQI59IZsUPZ2n+ATm6MmAz9fG81bQHXpHwA DxRwDMxvuIrw2OwIStmmkKuWrbKeB04MPeufs= 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:mime-version :content-transfer-encoding; bh=AE6/toJbSfVkr1wiQ76oTdfqTgHlpEwnqu8Dl52qybo=; b=jfhN7sTsZybxyIGL8f4X3ocdkcFgx2uMyLS0EPL+kbKayEX3reR006QwxR/yoZwSK4 HHD9D3wmq7aTbN2n7GH03IZyuBmHi6UPCT+bczVx9MpxzgR13P4LPi6ZOTEtd+58I39E fyY9kVZftQafrIQ2MlQOebej5+dzIH1O3u62qJ9IgSolQ19IcPZb24XAhVl4EHv8xTSj ri+3bjdEgF5UxaxSClaMkpeWdMi2r6Y/tN4gnV/DQJLyZwSBOvnINMmDgRh82xSkKTua xvuDGEvJiUChaYS3O/cMNUAX5JqrYojES9IzBE+Vu0zKRyRt2RBgkPsrxPzhAYsznZKb W9Rw== X-Gm-Message-State: APjAAAVS/LHe41X0n7ed/p872hYv4/yAo8L+Pj/PRSeLWOa1zfZc+vx6 7m03/lBltIy4u/QUcFnKMfe5bQ== X-Google-Smtp-Source: APXvYqxNdgUM84LcEYFHrtVVCkCw4B+04vJZJSOxcLjqGkPJJF2PCpuIaKSujUu3oHwmwt5ZIOC3fQ== X-Received: by 2002:a5e:9509:: with SMTP id r9mr3806096ioj.100.1567797832607; Fri, 06 Sep 2019 12:23:52 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:52 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , David Airlie , Sean Paul , Bruce Wang , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeykumar Sankaran , Fritz Koenig , Jordan Crouse , Rob Clark , Abhinav Kumar , Sravanthi Kollukuduru , freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH 1/6] drm/msm/dpu: Remove unused variables Date: Fri, 6 Sep 2019 13:23:39 -0600 Message-Id: <20190906192344.223694-1-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 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 Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 ----- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 ------- 2 files changed, 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ce59adff06aa..2ece11262943 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1288,13 +1288,8 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane, { struct drm_crtc *crtc = NULL; struct dpu_crtc *dpu_crtc = NULL; - struct msm_drm_private *priv = NULL; - struct dpu_kms *kms = NULL; int i; - priv = dev->dev_private; - kms = to_dpu_kms(priv->kms); - dpu_crtc = kzalloc(sizeof(*dpu_crtc), GFP_KERNEL); if (!dpu_crtc) return ERR_PTR(-ENOMEM); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d82ea994063f..4d2cacd0ce3d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1914,8 +1914,6 @@ static int _dpu_encoder_debugfs_status_open(struct inode *inode, static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); - struct msm_drm_private *priv; - struct dpu_kms *dpu_kms; int i; static const struct file_operations debugfs_status_fops = { @@ -1932,9 +1930,6 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) return -EINVAL; } - priv = drm_enc->dev->dev_private; - dpu_kms = to_dpu_kms(priv->kms); - snprintf(name, DPU_NAME_SIZE, "encoder%u", drm_enc->base.id); /* create overall sub-directory for the encoder */ @@ -2133,14 +2128,12 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) struct dpu_encoder_virt *dpu_enc = from_timer(dpu_enc, t, frame_done_timer); struct drm_encoder *drm_enc = &dpu_enc->base; - struct msm_drm_private *priv; u32 event; if (!drm_enc->dev || !drm_enc->dev->dev_private) { DPU_ERROR("invalid parameters\n"); return; } - priv = drm_enc->dev->dev_private; if (!dpu_enc->frame_busy_mask[0] || !dpu_enc->crtc_frame_event_cb) { DRM_DEBUG_KMS("id:%u invalid timeout frame_busy_mask=%lu\n", From patchwork Fri Sep 6 19:23:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3151B1398 for ; Fri, 6 Sep 2019 19:23:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 130A32178F for ; Fri, 6 Sep 2019 19:23:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="B3VuUrCP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389898AbfIFTX4 (ORCPT ); Fri, 6 Sep 2019 15:23:56 -0400 Received: from mail-io1-f43.google.com ([209.85.166.43]:39374 "EHLO mail-io1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731943AbfIFTXz (ORCPT ); Fri, 6 Sep 2019 15:23:55 -0400 Received: by mail-io1-f43.google.com with SMTP id d25so15247622iob.6 for ; Fri, 06 Sep 2019 12:23:55 -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=W2yelZaQQgNOeM3tNL1ucPE8YNMsnU8lMoKbAm8AChY=; b=B3VuUrCPXYpqko0QYumGcNMUcl2LhhNpt8HxgSsn0nP4Qj3gxIGutfehwIrE/9CNMq Y/x74jvwoJ5LfLkSBRpe9Ody0Qe/J7PVA5YgG84CwXB6883006LkjTHM/BKvJ5Ghkbp8 cqFcByfJzSDo8FoE6q4ujiKJd2RwGPWB9kUNM= 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=W2yelZaQQgNOeM3tNL1ucPE8YNMsnU8lMoKbAm8AChY=; b=doxnHZLNxCY0vxZMH57WkTT5Uu6VlYhFT1FumIl9xXQ64qikeEB7NHV5LEqgdl1Y+M NCnpb+2aAMjP5UT4YqegU3tJR7OukTW8k/m45/pF/A2jAYR7yoqYkiYc7qlOTl0zIoHf j3qV2Chu5nBbsojaDHRTCUX3iS/5m2xZ8ckE8zs1U9AMcgn4Nnxm97DnYwfYkUp7hHdp Tmnlmz4a8i1MKUf3eRtkV7vlGPU/BmV5wRtZsBq5KP45zULsdz7yYEfNQ/zKc1OKm72P DnzXO42Lmh93Uf+D03gy6qi525oSkJNVeZSIlsOLQoodVlFGtRRWFQUEoctUAG8uEybF vA9g== X-Gm-Message-State: APjAAAWZH+77kC6StlJih6w1jVSQtb3rIBzn2I9md7ZtT7Ei3S0UpZ2B hQ/qJSOHdY3uwUJbXgHr0i0ZSw== X-Google-Smtp-Source: APXvYqyY9z+bVXK367r0PSgo655xMFstBXHta7tC6uhSnr685D0+632U3Kq50X7yvcGVAdjr9dTt6w== X-Received: by 2002:a02:b882:: with SMTP id p2mr11801092jam.16.1567797834689; Fri, 06 Sep 2019 12:23:54 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:54 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , David Airlie , Sean Paul , Bruce Wang , linux-arm-msm@vger.kernel.org, Sam Ravnborg , Thomas Gleixner , Jeykumar Sankaran , Jordan Crouse , Rob Clark , Greg Kroah-Hartman , freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter Subject: [PATCH 2/6] drm/msm/dpu: Remove unused macro Date: Fri, 6 Sep 2019 13:23:40 -0600 Message-Id: <20190906192344.223694-2-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190906192344.223694-1-ddavenport@chromium.org> References: <20190906192344.223694-1-ddavenport@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 Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 4c889aabdaf9..6ceba33a179e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -139,10 +139,6 @@ struct vsync_info { #define to_dpu_kms(x) container_of(x, struct dpu_kms, base) -/* get struct msm_kms * from drm_device * */ -#define ddev_to_msm_kms(D) ((D) && (D)->dev_private ? \ - ((struct msm_drm_private *)((D)->dev_private))->kms : NULL) - /** * Debugfs functions - extra helper functions for debugfs support * From patchwork Fri Sep 6 19:23:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 170161398 for ; Fri, 6 Sep 2019 19:23:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3D6C2173E for ; Fri, 6 Sep 2019 19:23:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Bh3hn4Us" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390821AbfIFTX5 (ORCPT ); Fri, 6 Sep 2019 15:23:57 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44854 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389101AbfIFTX4 (ORCPT ); Fri, 6 Sep 2019 15:23:56 -0400 Received: by mail-io1-f67.google.com with SMTP id j4so15204969iog.11 for ; Fri, 06 Sep 2019 12:23:56 -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=qJR50YCOwMbxx1IjK9E1aTef9wlkdKgnv5HqeQtRqcM=; b=Bh3hn4UsM6oE18036kSaGShJrvCWLn/X+uasTikKWSblJzZ9D3HytWD8cePVT+jBxI SauJZwWkx8MK5TGGh4tzAeDkM8I8BmZKf+CyrkmvJHZO5og0/PYIjGGi/eHS/rcd0rA+ 9OTdHEPG2ab+2LbxKYLIYh5tk2sfkLmZCpWso= 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=qJR50YCOwMbxx1IjK9E1aTef9wlkdKgnv5HqeQtRqcM=; b=i5riYst64meNsiCB5Qij0Su7AB42+Y9XyXTb1BValWs4t3xg+t6J9E1sdtmQxtJvsT jcttU2Qf3Hff4ERWxyrNSJGkMKGZYfgbCpXCkoDUG0A8Akr987YiOf9C5/lsgizDCrA9 MpzVvJr3hO/I3LrOwxfPM3LWSErIDYnkS8hWEnEiLn/VvC+jg6nDKS5//VOlA7t5fdeM s7mA5HdlcNeCE97wlA74F1vc6RU5/Jg3NRD6aoWkXlEOqZqK3ldptLKLF+WiRrujwVFe iCsShWD5to5CnEQKeC1QyDB3bDukuawH2vUTbObjSo51lF9sJ6PQ7G2CmsfPmxXXHZ1x JA2Q== X-Gm-Message-State: APjAAAU71KvVSSyR0VbOyx78igVQbB+d1YFr4MTjGRbtpYVHjdJF5bTI EOy1jKmYF6T7kPBBLvOkZSKJUA== X-Google-Smtp-Source: APXvYqy5hNKNaSbwjwB7JTrB3yYUGFNb3GXAP0vGF4wjv9mZrnUkKHMP9pVGLmuyHcBbkR/lMQ30uA== X-Received: by 2002:a6b:fc02:: with SMTP id r2mr11259064ioh.15.1567797835630; Fri, 06 Sep 2019 12:23:55 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:55 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , David Airlie , Sean Paul , Jayant Shekhar , Abhinav Kumar , Bruce Wang , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Alexios Zavras , Thomas Gleixner , Greg Kroah-Hartman , Jordan Crouse , Rob Clark , Sravanthi Kollukuduru , Jeykumar Sankaran , freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH 3/6] drm/msm/dpu: Remove unnecessary NULL checks Date: Fri, 6 Sep 2019 13:23:41 -0600 Message-Id: <20190906192344.223694-3-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190906192344.223694-1-ddavenport@chromium.org> References: <20190906192344.223694-1-ddavenport@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 drm_device.dev_private is set to a non-NULL msm_drm_private struct in msm_drm_init. Successful initialization of msm means that dev_private is non-NULL so there is no need to check it everywhere. Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 6 ------ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 15 +++++---------- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 2 +- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 3 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 16 +++------------- 7 files changed, 14 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index cdbea38b8697..17f917b718ce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -349,9 +349,6 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) if (!dpu_kms->dev) { DPU_ERROR("invalid drm device\n"); return; - } else if (!dpu_kms->dev->dev_private) { - DPU_ERROR("invalid device private\n"); - return; } priv = dpu_kms->dev->dev_private; @@ -385,9 +382,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms) if (!dpu_kms->dev) { DPU_ERROR("invalid drm device\n"); return; - } else if (!dpu_kms->dev->dev_private) { - DPU_ERROR("invalid device private\n"); - return; } priv = dpu_kms->dev->dev_private; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 09a49b59bb5b..094d74635fb7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -33,13 +33,13 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) { struct msm_drm_private *priv; - if (!crtc->dev || !crtc->dev->dev_private) { + if (!crtc->dev) { DPU_ERROR("invalid device\n"); return NULL; } priv = crtc->dev->dev_private; - if (!priv || !priv->kms) { + if (!priv->kms) { DPU_ERROR("invalid kms\n"); return NULL; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 2ece11262943..ead7d657097c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -694,7 +694,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, unsigned long flags; bool release_bandwidth = false; - if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) { + if (!crtc || !crtc->dev || !crtc->state) { DPU_ERROR("invalid crtc\n"); return; } @@ -766,7 +766,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, struct msm_drm_private *priv; bool request_bandwidth; - if (!crtc || !crtc->dev || !crtc->dev->dev_private) { + if (!crtc || !crtc->dev) { DPU_ERROR("invalid crtc\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 4d2cacd0ce3d..7b37d1eeeab5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -735,8 +735,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc, struct msm_drm_private *priv; bool is_vid_mode = false; - if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private || - !drm_enc->crtc) { + if (!drm_enc || !drm_enc->dev || !drm_enc->crtc) { DPU_ERROR("invalid parameters\n"); return -EINVAL; } @@ -1092,7 +1091,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) struct msm_drm_private *priv; struct dpu_kms *dpu_kms; - if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private) { + if (!drm_enc || !drm_enc->dev) { DPU_ERROR("invalid parameters\n"); return; } @@ -1193,9 +1192,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) } else if (!drm_enc->dev) { DPU_ERROR("invalid dev\n"); return; - } else if (!drm_enc->dev->dev_private) { - DPU_ERROR("invalid dev_private\n"); - return; } dpu_enc = to_dpu_encoder_virt(drm_enc); @@ -1734,8 +1730,7 @@ static void dpu_encoder_vsync_event_handler(struct timer_list *t) struct msm_drm_private *priv; struct msm_drm_thread *event_thread; - if (!drm_enc->dev || !drm_enc->dev->dev_private || - !drm_enc->crtc) { + if (!drm_enc->dev || !drm_enc->crtc) { DPU_ERROR("invalid parameters\n"); return; } @@ -1925,7 +1920,7 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) char name[DPU_NAME_SIZE]; - if (!drm_enc->dev || !drm_enc->dev->dev_private) { + if (!drm_enc->dev) { DPU_ERROR("invalid encoder or kms\n"); return -EINVAL; } @@ -2130,7 +2125,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) struct drm_encoder *drm_enc = &dpu_enc->base; u32 event; - if (!drm_enc->dev || !drm_enc->dev->dev_private) { + if (!drm_enc->dev) { DPU_ERROR("invalid parameters\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index 2923b63d95fe..50fe1ed7095c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -373,7 +373,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( } dpu_kms = phys_enc->dpu_kms; - if (!dpu_kms || !dpu_kms->dev || !dpu_kms->dev->dev_private) { + if (!dpu_kms || !dpu_kms->dev) { DPU_ERROR("invalid device\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index b9c84fb4d4a1..bd333d957add 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -570,8 +570,7 @@ static void dpu_encoder_phys_vid_disable(struct dpu_encoder_phys *phys_enc) unsigned long lock_flags; int ret; - if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev || - !phys_enc->parent->dev->dev_private) { + if (!phys_enc || !phys_enc->parent || !phys_enc->parent->dev) { DPU_ERROR("invalid encoder/device\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 58b0485dc375..4a69d8ecf5e1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -72,7 +72,7 @@ static int _dpu_danger_signal_status(struct seq_file *s, struct dpu_danger_safe_status status; int i; - if (!kms->dev || !kms->dev->dev_private || !kms->hw_mdp) { + if (!kms->dev || !kms->hw_mdp) { DPU_ERROR("invalid arg(s)\n"); return 0; } @@ -157,9 +157,6 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data) return 0; priv = dev->dev_private; - if (!priv) - return 0; - base = dpu_kms->mmio + regset->offset; /* insert padding spaces, if needed */ @@ -292,7 +289,7 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms, dpu_kms = to_dpu_kms(kms); dev = dpu_kms->dev; - if (!dev || !dev->dev_private) + if (!dev) return; priv = dev->dev_private; @@ -470,9 +467,6 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) } else if (!dpu_kms->dev) { DPU_ERROR("invalid dev\n"); return; - } else if (!dpu_kms->dev->dev_private) { - DPU_ERROR("invalid dev_private\n"); - return; } priv = dpu_kms->dev->dev_private; @@ -809,10 +803,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) } priv = dev->dev_private; - if (!priv) { - DPU_ERROR("invalid private data\n"); - return rc; - } atomic_set(&dpu_kms->bandwidth_ref, 0); @@ -974,7 +964,7 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev) struct dpu_kms *dpu_kms; int irq; - if (!dev || !dev->dev_private) { + if (!dev) { DPU_ERROR("drm device node invalid\n"); return ERR_PTR(-EINVAL); } From patchwork Fri Sep 6 19:23:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135887 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 495771398 for ; Fri, 6 Sep 2019 19:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AE7D2173E for ; Fri, 6 Sep 2019 19:23:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="RVUr+41F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388818AbfIFTX6 (ORCPT ); Fri, 6 Sep 2019 15:23:58 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:47078 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390263AbfIFTX5 (ORCPT ); Fri, 6 Sep 2019 15:23:57 -0400 Received: by mail-io1-f67.google.com with SMTP id x4so15179938iog.13 for ; Fri, 06 Sep 2019 12:23:56 -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=j/k1s41Cd84FscFUH5HHkD4volUIZMrS8vWB51FggFg=; b=RVUr+41FgmB62dAmBtO1Yq+z6nYqWpcb7vKjFfyJhjKwnK2zetlCIe4aATNsLL5Igw 63by+MASskqj+6jzFzFqSsjREa0+GkcMUAoeg4H9GmmkSkEDivCEm46WJVBXxXlYGmlH NVFZ/59Xrc+sZiOFTXGT5XjfVM+a7JzT0eVK4= 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=j/k1s41Cd84FscFUH5HHkD4volUIZMrS8vWB51FggFg=; b=LDyc5e61z5S2pu8IzTAhxHncq7f4wur9/LzibUqLXwJ537WX/7xwwXELtrmKRizkWY KVwhS25ct9L7glt2I2Oau+30pKdYcMIycf7xsPM2mVMS1Q485gTc9uKWEzMDz417Hx6O rzk4OvTRMJdzsoHTp4G8uV6ezOQ6zZW2zOWNd9gdFVAzG9rZdRpR9ezuFDZBzigMVo62 NhB1uDNcIQ6Jhen4W0ah4347rm7PprLUBnmhiUDEhVNsB5cUix0dgL/iDeoHKQuEUr73 +1WEn0RXFJD6gZds3AQxf0/WdRoTfMETR/mnglvBifXDWBvY6PA7a3oSehHoDuXgCTqR +dSA== X-Gm-Message-State: APjAAAXYdlZ8cT0feWYvEzrFH1YveWwHyFTKNR2Oixb826QE0o/Cp++d TUeOqjcAzBCUr/rIk7PgXKzLPg== X-Google-Smtp-Source: APXvYqxqS6QiXdDk5JDrakHdF9YlW8kNKtcmhtlrPTEYPW9EklfJ+iKnRmaedLHEBp6mDxHHlcHM/w== X-Received: by 2002:a02:cad1:: with SMTP id f17mr8739258jap.18.1567797836589; Fri, 06 Sep 2019 12:23:56 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:56 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , Sean Paul , Jayant Shekhar , Bruce Wang , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeykumar Sankaran , Jordan Crouse , Rob Clark , David Airlie , Greg Kroah-Hartman , Sravanthi Kollukuduru , freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH 4/6] drm/msm/dpu: Remove unnecessary NULL checks Date: Fri, 6 Sep 2019 13:23:42 -0600 Message-Id: <20190906192344.223694-4-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190906192344.223694-1-ddavenport@chromium.org> References: <20190906192344.223694-1-ddavenport@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 drm_crtc.dev will never be NULL, so no need to check it. Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 5 ----- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 094d74635fb7..839887a3a80c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -33,11 +33,6 @@ static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) { struct msm_drm_private *priv; - if (!crtc->dev) { - DPU_ERROR("invalid device\n"); - return NULL; - } - priv = crtc->dev->dev_private; if (!priv->kms) { DPU_ERROR("invalid kms\n"); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ead7d657097c..0b9dc042d2e2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -266,7 +266,7 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc) { struct drm_encoder *encoder; - if (!crtc || !crtc->dev) { + if (!crtc) { DPU_ERROR("invalid crtc\n"); return INTF_MODE_NONE; } @@ -694,7 +694,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc, unsigned long flags; bool release_bandwidth = false; - if (!crtc || !crtc->dev || !crtc->state) { + if (!crtc || !crtc->state) { DPU_ERROR("invalid crtc\n"); return; } @@ -766,7 +766,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, struct msm_drm_private *priv; bool request_bandwidth; - if (!crtc || !crtc->dev) { + if (!crtc) { DPU_ERROR("invalid crtc\n"); return; } From patchwork Fri Sep 6 19:23:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135903 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F2FB15E6 for ; Fri, 6 Sep 2019 19:24:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 480AA2173E for ; Fri, 6 Sep 2019 19:24:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NLZLAm6V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393262AbfIFTYT (ORCPT ); Fri, 6 Sep 2019 15:24:19 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:34521 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390263AbfIFTX7 (ORCPT ); Fri, 6 Sep 2019 15:23:59 -0400 Received: by mail-io1-f65.google.com with SMTP id s21so15291813ioa.1 for ; Fri, 06 Sep 2019 12:23:58 -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=3Y04QnjYU5dJNrZssW/fqqEItLo+91e3CGDIJ1aD7PM=; b=NLZLAm6VsmD2KIJSboAW7bdf1CLhAbOAzv1bOsD/9BWTa31MLOaEYpevUNHRd4Nkeh wSE8T5fq2iEzPzoDmb3K+tXS4x7NlHuCZX+fIr2tK3inGdI6hyvNdSwDNCgFEFdwOtHA 0IWPyIcC/3j6cp7bIwei94+YwSaRUDkDqb0g0= 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=3Y04QnjYU5dJNrZssW/fqqEItLo+91e3CGDIJ1aD7PM=; b=Biqd7p8ktAHGoLU1sLzUQWeXFvXG9uExwGJl/M8MyoHZTWYUiADF2EcvkSQB893iUY OretEUhyPli6HVsdS0vSsI6hGPDDOD5NVIfrAsDjsWzFZKAy8CM6N8tqDDTHIkHQd0O2 8yHbZoABSP0pnX2vQi55VLVS8+54Z3ONS5i0PqRfUliRrkxo/MS+BguKhrkPO6cifLQu r5kbVeEBiykAjsAQGpnDTV+LBnMZL3sqXu7usJCxsgBsqHSk+b85xZLxqke71ExKItBg It/3Nqofh3nlgrVZDxxRsslWfv//pnTe+VL6CIhmqlJ2E/noWOb2v2b13Xlp1vkYuLaC I82Q== X-Gm-Message-State: APjAAAWRTf/bRx+H/A+78oxmnQNV8V5TCPKEZi7HoocTVdK2oBiePVGB p29QTi50r1BiPjab2RcnqukISA== X-Google-Smtp-Source: APXvYqyBbtoo1o0fe5WO0n2dN8F0Smtrfi9xLASw+PgMwTpy9LBoyvwyJFyzoel+FarZsdy/gyoIhw== X-Received: by 2002:a02:cf10:: with SMTP id q16mr11453526jar.89.1567797837840; Fri, 06 Sep 2019 12:23:57 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:57 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , David Airlie , Sean Paul , Jayant Shekhar , Bruce Wang , Allison Randal , Daniel Vetter , Sam Ravnborg , Alexios Zavras , Thomas Gleixner , Fritz Koenig , Jordan Crouse , Rob Clark , linux-arm-msm@vger.kernel.org, Greg Kroah-Hartman , Sravanthi Kollukuduru , Jeykumar Sankaran , freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Abhinav Kumar Subject: [PATCH 5/6] drm/msm/dpu: Remove unnecessary NULL checks Date: Fri, 6 Sep 2019 13:23:43 -0600 Message-Id: <20190906192344.223694-5-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190906192344.223694-1-ddavenport@chromium.org> References: <20190906192344.223694-1-ddavenport@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 msm_drm_private.kms will only be NULL in the dummy headless case, so there is no need to check it in the dpu display driver. Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 23 ++++++++----------- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 12 +++------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 14 ++--------- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 2 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 5 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 6 +---- 7 files changed, 19 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index 17f917b718ce..a53517abf15c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -55,8 +55,7 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) int dpu_core_irq_idx_lookup(struct dpu_kms *dpu_kms, enum dpu_intr_type intr_type, u32 instance_idx) { - if (!dpu_kms || !dpu_kms->hw_intr || - !dpu_kms->hw_intr->ops.irq_idx_lookup) + if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.irq_idx_lookup) return -EINVAL; return dpu_kms->hw_intr->ops.irq_idx_lookup(intr_type, @@ -73,7 +72,7 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) unsigned long irq_flags; int ret = 0, enable_count; - if (!dpu_kms || !dpu_kms->hw_intr || + if (!dpu_kms->hw_intr || !dpu_kms->irq_obj.enable_counts || !dpu_kms->irq_obj.irq_counts) { DPU_ERROR("invalid params\n"); @@ -114,7 +113,7 @@ int dpu_core_irq_enable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) { int i, ret = 0, counts; - if (!dpu_kms || !irq_idxs || !irq_count) { + if (!irq_idxs || !irq_count) { DPU_ERROR("invalid params\n"); return -EINVAL; } @@ -138,7 +137,7 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) { int ret = 0, enable_count; - if (!dpu_kms || !dpu_kms->hw_intr || !dpu_kms->irq_obj.enable_counts) { + if (!dpu_kms->hw_intr || !dpu_kms->irq_obj.enable_counts) { DPU_ERROR("invalid params\n"); return -EINVAL; } @@ -169,7 +168,7 @@ int dpu_core_irq_disable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) { int i, ret = 0, counts; - if (!dpu_kms || !irq_idxs || !irq_count) { + if (!irq_idxs || !irq_count) { DPU_ERROR("invalid params\n"); return -EINVAL; } @@ -186,7 +185,7 @@ int dpu_core_irq_disable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx, bool clear) { - if (!dpu_kms || !dpu_kms->hw_intr || + if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.get_interrupt_status) return 0; @@ -205,7 +204,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx, { unsigned long irq_flags; - if (!dpu_kms || !dpu_kms->irq_obj.irq_cb_tbl) { + if (!dpu_kms->irq_obj.irq_cb_tbl) { DPU_ERROR("invalid params\n"); return -EINVAL; } @@ -240,7 +239,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx, { unsigned long irq_flags; - if (!dpu_kms || !dpu_kms->irq_obj.irq_cb_tbl) { + if (!dpu_kms->irq_obj.irq_cb_tbl) { DPU_ERROR("invalid params\n"); return -EINVAL; } @@ -274,8 +273,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx, static void dpu_clear_all_irqs(struct dpu_kms *dpu_kms) { - if (!dpu_kms || !dpu_kms->hw_intr || - !dpu_kms->hw_intr->ops.clear_all_irqs) + if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.clear_all_irqs) return; dpu_kms->hw_intr->ops.clear_all_irqs(dpu_kms->hw_intr); @@ -283,8 +281,7 @@ static void dpu_clear_all_irqs(struct dpu_kms *dpu_kms) static void dpu_disable_all_irqs(struct dpu_kms *dpu_kms) { - if (!dpu_kms || !dpu_kms->hw_intr || - !dpu_kms->hw_intr->ops.disable_all_irqs) + if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.disable_all_irqs) return; dpu_kms->hw_intr->ops.disable_all_irqs(dpu_kms->hw_intr); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 839887a3a80c..e96843010dff 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -32,13 +32,7 @@ enum dpu_perf_mode { static struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc) { struct msm_drm_private *priv; - priv = crtc->dev->dev_private; - if (!priv->kms) { - DPU_ERROR("invalid kms\n"); - return NULL; - } - return to_dpu_kms(priv->kms); } @@ -111,7 +105,7 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, } kms = _dpu_crtc_get_kms(crtc); - if (!kms || !kms->catalog) { + if (!kms->catalog) { DPU_ERROR("invalid parameters\n"); return 0; } @@ -219,7 +213,7 @@ void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc) } kms = _dpu_crtc_get_kms(crtc); - if (!kms || !kms->catalog) { + if (!kms->catalog) { DPU_ERROR("invalid kms\n"); return; } @@ -292,7 +286,7 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc, } kms = _dpu_crtc_get_kms(crtc); - if (!kms || !kms->catalog) { + if (!kms->catalog) { DPU_ERROR("invalid kms\n"); return -EINVAL; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 7b37d1eeeab5..85e7bacbce42 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -645,11 +645,6 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, priv = drm_enc->dev->dev_private; dpu_kms = to_dpu_kms(priv->kms); - if (!dpu_kms) { - DPU_ERROR("invalid dpu_kms\n"); - return; - } - hw_mdptop = dpu_kms->hw_mdp; if (!hw_mdptop) { DPU_ERROR("invalid mdptop\n"); @@ -1098,10 +1093,6 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) priv = drm_enc->dev->dev_private; dpu_kms = to_dpu_kms(priv->kms); - if (!dpu_kms) { - DPU_ERROR("invalid dpu_kms\n"); - return; - } dpu_enc = to_dpu_encoder_virt(drm_enc); if (!dpu_enc || !dpu_enc->cur_master) { @@ -2032,9 +2023,8 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, enum dpu_intf_type intf_type; struct dpu_enc_phys_init_params phys_params; - if (!dpu_enc || !dpu_kms) { - DPU_ERROR("invalid arg(s), enc %d kms %d\n", - dpu_enc != 0, dpu_kms != 0); + if (!dpu_enc) { + DPU_ERROR("invalid arg(s), enc %d\n", dpu_enc != 0); return -EINVAL; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index 50fe1ed7095c..39fc39cd2439 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -373,7 +373,7 @@ static void dpu_encoder_phys_cmd_tearcheck_config( } dpu_kms = phys_enc->dpu_kms; - if (!dpu_kms || !dpu_kms->dev) { + if (!dpu_kms->dev) { DPU_ERROR("invalid device\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index bd333d957add..15d21d7ec304 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -374,7 +374,7 @@ static void dpu_encoder_phys_vid_mode_set( struct drm_display_mode *mode, struct drm_display_mode *adj_mode) { - if (!phys_enc || !phys_enc->dpu_kms) { + if (!phys_enc) { DPU_ERROR("invalid encoder/kms\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 4a69d8ecf5e1..9d6429fa6229 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -461,10 +461,7 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) struct msm_drm_private *priv; int i; - if (!dpu_kms) { - DPU_ERROR("invalid dpu_kms\n"); - return; - } else if (!dpu_kms->dev) { + if (!dpu_kms->dev) { DPU_ERROR("invalid dev\n"); return; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c index 8d24b79fd400..991f4c8f8a12 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -154,10 +154,6 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, u32 ot_lim; int ret, i; - if (!dpu_kms) { - DPU_ERROR("invalid arguments\n"); - return; - } mdp = dpu_kms->hw_mdp; for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { @@ -214,7 +210,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, const struct dpu_vbif_qos_tbl *qos_tbl; int i; - if (!dpu_kms || !params || !dpu_kms->hw_mdp) { + if (!params || !dpu_kms->hw_mdp) { DPU_ERROR("invalid arguments\n"); return; } From patchwork Fri Sep 6 19:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 11135893 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F0E51398 for ; Fri, 6 Sep 2019 19:24:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7906D21835 for ; Fri, 6 Sep 2019 19:24:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NstWgQZ/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392804AbfIFTYC (ORCPT ); Fri, 6 Sep 2019 15:24:02 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:44865 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391120AbfIFTYA (ORCPT ); Fri, 6 Sep 2019 15:24:00 -0400 Received: by mail-io1-f68.google.com with SMTP id j4so15205324iog.11 for ; Fri, 06 Sep 2019 12:23:59 -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=cLz5QC5EJYd9kp9XKMbuAGHR5fi2TN9ydlWG4VtkjSA=; b=NstWgQZ/kGHFe9FYzpcxJAoLl0QS/jip/BCw1gAy/CCYENThy4U6g23kiiYOQK/kVn 0X/DbN0TY/m/cX9ji0Ncb6bMYIVtOngPXcAqvqX9CwryexCMz9JorS8jHwK2n7ME2PM9 vaekQfgj4Sh0PBK63tRWpOfBmTafeNJfgrgvs= 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=cLz5QC5EJYd9kp9XKMbuAGHR5fi2TN9ydlWG4VtkjSA=; b=MSS+GwYsYgK6hpJnKaYwTjBcErISas57WxC0vWwSQbwdc/AU4qGuIJClPp2SAR5hd/ jikvGthp1drrHI2mk1hHLIkjcTVA5jZMfgmCOPriYrAuUhKkiId+f/ieQgzzY0ZHDU14 U09MgrrPY+bb8h2NjsMeBSjnkEolsA5LlApMGsSfy/q5EFYjD1QECn6yyCghAhHSrXRa RmSinq2ZPUiyEv+bU4mmzixzLlSFO2JrHSR5Cb2zGNcmpfea/6rvApm8wLRCezIz2ySc ZN1FCdnxSuTQKdBmcfytYTz9uNyRd1phESEOr9shQbeZLwqEVM0wG11QzyOdFRxdq2ad AKXA== X-Gm-Message-State: APjAAAWoQmssXtQGeh6hAe3627cBrBPxQqrRgdpcV0Q0rl9Io6XQZR0s nHe7xKO3zGvppPNSDpa5XeYwmg== X-Google-Smtp-Source: APXvYqxCifj8cFirPG/j36LsIQyAzJ2ccqGM/ZpMfWoiy9BssNUvOklUn/BM//2ijxdKxIj3Cl5Mxg== X-Received: by 2002:a6b:d812:: with SMTP id y18mr2222166iob.73.1567797838855; Fri, 06 Sep 2019 12:23:58 -0700 (PDT) Received: from ddavenport4.bld.corp.google.com ([2620:15c:183:0:92f:a80a:519d:f777]) by smtp.gmail.com with ESMTPSA id h70sm10931804iof.48.2019.09.06.12.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:23:58 -0700 (PDT) From: Drew Davenport To: dri-devel@lists.freedesktop.org Cc: Drew Davenport , David Airlie , Sean Paul , Bruce Wang , Allison Randal , linux-kernel@vger.kernel.org, Thomas Gleixner , Jeykumar Sankaran , Jordan Crouse , Rob Clark , linux-arm-msm@vger.kernel.org, Greg Kroah-Hartman , Sravanthi Kollukuduru , freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH 6/6] drm/msm/dpu: Remove unnecessary NULL checks Date: Fri, 6 Sep 2019 13:23:44 -0600 Message-Id: <20190906192344.223694-6-ddavenport@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190906192344.223694-1-ddavenport@chromium.org> References: <20190906192344.223694-1-ddavenport@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 dpu_kms.dev will never be NULL, so don't bother checking. Signed-off-by: Drew Davenport --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 8 ----- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 30 +------------------ 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index a53517abf15c..283d5a48fd13 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -343,10 +343,6 @@ void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms) struct msm_drm_private *priv; int i; - if (!dpu_kms->dev) { - DPU_ERROR("invalid drm device\n"); - return; - } priv = dpu_kms->dev->dev_private; pm_runtime_get_sync(&dpu_kms->pdev->dev); @@ -376,10 +372,6 @@ void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms) struct msm_drm_private *priv; int i; - if (!dpu_kms->dev) { - DPU_ERROR("invalid drm device\n"); - return; - } priv = dpu_kms->dev->dev_private; pm_runtime_get_sync(&dpu_kms->pdev->dev); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index 39fc39cd2439..d5532836b5b9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -373,10 +373,6 @@ static void dpu_encoder_phys_cmd_tearcheck_config( } dpu_kms = phys_enc->dpu_kms; - if (!dpu_kms->dev) { - DPU_ERROR("invalid device\n"); - return; - } priv = dpu_kms->dev->dev_private; /* diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 9d6429fa6229..fbb154d7c81c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -72,7 +72,7 @@ static int _dpu_danger_signal_status(struct seq_file *s, struct dpu_danger_safe_status status; int i; - if (!kms->dev || !kms->hw_mdp) { + if (!kms->hw_mdp) { DPU_ERROR("invalid arg(s)\n"); return 0; } @@ -153,9 +153,6 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data) return 0; dev = dpu_kms->dev; - if (!dev) - return 0; - priv = dev->dev_private; base = dpu_kms->mmio + regset->offset; @@ -288,9 +285,6 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms, return; dpu_kms = to_dpu_kms(kms); dev = dpu_kms->dev; - - if (!dev) - return; priv = dev->dev_private; /* Call prepare_commit for all affected encoders */ @@ -461,10 +455,6 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) struct msm_drm_private *priv; int i; - if (!dpu_kms->dev) { - DPU_ERROR("invalid dev\n"); - return; - } priv = dpu_kms->dev->dev_private; for (i = 0; i < priv->num_crtcs; i++) @@ -496,7 +486,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) int primary_planes_idx = 0, cursor_planes_idx = 0, i, ret; int max_crtc_count; - dev = dpu_kms->dev; priv = dev->dev_private; catalog = dpu_kms->catalog; @@ -576,8 +565,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) int i; dev = dpu_kms->dev; - if (!dev) - return; if (dpu_kms->hw_intr) dpu_hw_intr_destroy(dpu_kms->hw_intr); @@ -794,11 +781,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms = to_dpu_kms(kms); dev = dpu_kms->dev; - if (!dev) { - DPU_ERROR("invalid device\n"); - return rc; - } - priv = dev->dev_private; atomic_set(&dpu_kms->bandwidth_ref, 0); @@ -1051,11 +1033,6 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev) struct dss_module_power *mp = &dpu_kms->mp; ddev = dpu_kms->dev; - if (!ddev) { - DPU_ERROR("invalid drm_device\n"); - return rc; - } - rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false); if (rc) DPU_ERROR("clock disable failed rc:%d\n", rc); @@ -1073,11 +1050,6 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) struct dss_module_power *mp = &dpu_kms->mp; ddev = dpu_kms->dev; - if (!ddev) { - DPU_ERROR("invalid drm_device\n"); - return rc; - } - rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); if (rc) { DPU_ERROR("clock enable failed rc:%d\n", rc);