From patchwork Sat May 20 17:58:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 100235 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp813623qge; Sat, 20 May 2017 11:02:41 -0700 (PDT) X-Received: by 10.98.159.19 with SMTP id g19mr16689243pfe.189.1495303361215; Sat, 20 May 2017 11:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495303361; cv=none; d=google.com; s=arc-20160816; b=s+VejUCDFFjeZN6v6ZTF82Sxkf81SK2D1IDi7wy8JwUNrxXKapfA1aed71lJ0HFrAy /J/Qn8K1tQc/5c/pUp1nsHrWjKPUHWw1dH1w5Ho4Br+fYW/x8YmsjpodvaX3RfYrPYc0 OPuZdexemhV2vvjHOqR8xc/V3i+ZKjmsn7VP7bUa/Z0DIQ3D4qVDi2L7M0iw9bybaRB7 7wifviEez7X/zM3no0i5/8x0OfE2SjDZl1E03AQjQsjstHLFAJW/Is39/yruiCG4BgXc 637VD/6lIqPFmq8h/j5J22PnyQs0K1VKc2xf46fOIzdCslftZ6MgSCOQ20D0yFM364ky AeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=71RG3oB5NptdW8ufTIxgZ7JbE3t8UYgeod8TDQBqQDc=; b=qa4vIsMr+WZulPWtfBN8+YVyj37aQGH32RoLJdz5K93IRbjK72L6A7RM9zChpJIcpx Qt7I/tRttFFCSybHLf0JFS246VLtWaX2ctwkguu2Qz/DZ6yRiy3ViJTmTgpkl7UeYYgf JfDuvjn6cGy1inamnEErHPOUZ24n2rw2/WliobvzXIMvWvSz6r+i4Ps72gbxtTz4rf94 uETnYs0dN/TG20hn/37909JP5/fvzsjNynHA60e6arlhMjT1av+2ZNh3JfamLdNsl55T x+4B56MsjEFEYzi/0AdlFZ6GXFHFVDCdLAjxxTpMUqPe9HaS8PXMQWLnUsX8PIW5F1Jf BqAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x76si11991748pfj.11.2017.05.20.11.02.40; Sat, 20 May 2017 11:02:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755569AbdETSCj (ORCPT + 25 others); Sat, 20 May 2017 14:02:39 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:39508 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbdETSCe (ORCPT ); Sat, 20 May 2017 14:02:34 -0400 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-09.nifty.com with ESMTP id v4KHwwra013762; Sun, 21 May 2017 02:59:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v4KHwwra013762 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495303160; bh=71RG3oB5NptdW8ufTIxgZ7JbE3t8UYgeod8TDQBqQDc=; h=From:To:Cc:Subject:Date:From; b=sO+fvfsrcw/Wxp+AZP3E3NjL+mHcwh0jJ5wLNw1N5+EUTXvAfnB5reDpD8l9D5GyY i2VjMGlQjcnaBCWgrhexKT3BhmK7aRNKiy+H4/zwmeFkB/uuP+eUvsXhyOMFjwhLH3 1PMpb1Xb0wNbYkw/pqWjN7GbR0W9sqFpoUfNYswrZSjrXea0P9EbQ2O7bWkRPGvPkQ 07xLFgeWufM7XB0UMCMlCuxBU1P7g5EG5V3AZo1QIjt9KL4Rk62EStpBgOYsltQAJo PhpTbUzcJlqgPbvTbJRTS6QOnN8AUYI5Pdy+0jVwJK1NpQGKSr9gbqVxZniFhpCZ53 gHsPRK/G45Xug== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: Daniel Vetter , dri-devel@lists.freedesktop.org, David Airlie Cc: Masahiro Yamada , Lucas Stach , freedreno@lists.freedesktop.org, Benjamin Gaignard , Thierry Reding , Vincent Abriou , Christian Gmeiner , Jonathan Hunter , linux-arm-msm@vger.kernel.org, Ben Skeggs , etnaviv@lists.freedesktop.org, Tomi Valkeinen , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Marek Vasut , Rob Clark , nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, Laurent Pinchart , Russell King Subject: [PATCH] drm: remove NULL pointer check for clk_disable_unprepare Date: Sun, 21 May 2017 02:58:51 +0900 Message-Id: <1495303131-9814-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After long term efforts of fixing non-common clock implementations, clk_disable() is a no-op for a NULL pointer input, and this is now tree-wide consistent. All clock consumers can safely call clk_disable(_unprepare) without NULL pointer check. Signed-off-by: Masahiro Yamada --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 15 +++++---------- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 6 ++---- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 3 +-- drivers/gpu/drm/msm/msm_gpu.c | 6 ++---- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 3 +-- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 6 ++---- drivers/gpu/drm/omapdrm/dss/venc.c | 3 +-- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 3 +-- drivers/gpu/drm/sti/sti_gdp.c | 3 +-- 10 files changed, 17 insertions(+), 34 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 9a9c407..70efe04 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1481,23 +1481,18 @@ static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu) return 0; disable_clk_core: - if (gpu->clk_core) - clk_disable_unprepare(gpu->clk_core); + clk_disable_unprepare(gpu->clk_core); disable_clk_bus: - if (gpu->clk_bus) - clk_disable_unprepare(gpu->clk_bus); + clk_disable_unprepare(gpu->clk_bus); return ret; } static int etnaviv_gpu_clk_disable(struct etnaviv_gpu *gpu) { - if (gpu->clk_shader) - clk_disable_unprepare(gpu->clk_shader); - if (gpu->clk_core) - clk_disable_unprepare(gpu->clk_core); - if (gpu->clk_bus) - clk_disable_unprepare(gpu->clk_bus); + clk_disable_unprepare(gpu->clk_shader); + clk_disable_unprepare(gpu->clk_core); + clk_disable_unprepare(gpu->clk_bus); return 0; } diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index 3d26d77..886d07a 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c @@ -202,11 +202,9 @@ int mdp4_disable(struct mdp4_kms *mdp4_kms) DBG(""); clk_disable_unprepare(mdp4_kms->clk); - if (mdp4_kms->pclk) - clk_disable_unprepare(mdp4_kms->pclk); + clk_disable_unprepare(mdp4_kms->pclk); clk_disable_unprepare(mdp4_kms->lut_clk); - if (mdp4_kms->axi_clk) - clk_disable_unprepare(mdp4_kms->axi_clk); + clk_disable_unprepare(mdp4_kms->axi_clk); return 0; } diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index d3d6b4c..9175064 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c @@ -252,8 +252,7 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms) clk_disable_unprepare(mdp5_kms->ahb_clk); clk_disable_unprepare(mdp5_kms->axi_clk); clk_disable_unprepare(mdp5_kms->core_clk); - if (mdp5_kms->lut_clk) - clk_disable_unprepare(mdp5_kms->lut_clk); + clk_disable_unprepare(mdp5_kms->lut_clk); return 0; } diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 97b9c38..c5fb326 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -116,8 +116,7 @@ static int disable_clk(struct msm_gpu *gpu) int i; for (i = gpu->nr_clocks - 1; i >= 0; i--) - if (gpu->grp_clks[i]) - clk_disable(gpu->grp_clks[i]); + clk_disable(gpu->grp_clks[i]); for (i = gpu->nr_clocks - 1; i >= 0; i--) if (gpu->grp_clks[i]) @@ -148,8 +147,7 @@ static int enable_axi(struct msm_gpu *gpu) static int disable_axi(struct msm_gpu *gpu) { - if (gpu->ebi1_clk) - clk_disable_unprepare(gpu->ebi1_clk); + clk_disable_unprepare(gpu->ebi1_clk); if (gpu->bus_freq) bs_set(gpu, 0); return 0; diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c index 1144e0c..05acf7a 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c @@ -155,8 +155,7 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) mxsfb_disable_axi_clk(mxsfb); clk_disable_unprepare(mxsfb->clk); - if (mxsfb->clk_disp_axi) - clk_disable_unprepare(mxsfb->clk_disp_axi); + clk_disable_unprepare(mxsfb->clk_disp_axi); } static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index d1b9c34..b0f33d4 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -87,8 +87,7 @@ void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb) void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) { - if (mxsfb->clk_axi) - clk_disable_unprepare(mxsfb->clk_axi); + clk_disable_unprepare(mxsfb->clk_axi); } static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c index 6474bd2..bde8ab2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c @@ -64,8 +64,7 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) err_clamp: clk_disable_unprepare(tdev->clk_pwr); err_clk_pwr: - if (tdev->clk_ref) - clk_disable_unprepare(tdev->clk_ref); + clk_disable_unprepare(tdev->clk_ref); err_clk_ref: clk_disable_unprepare(tdev->clk); err_clk: @@ -84,8 +83,7 @@ nvkm_device_tegra_power_down(struct nvkm_device_tegra *tdev) udelay(10); clk_disable_unprepare(tdev->clk_pwr); - if (tdev->clk_ref) - clk_disable_unprepare(tdev->clk_ref); + clk_disable_unprepare(tdev->clk_ref); clk_disable_unprepare(tdev->clk); udelay(10); diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index 19d1495..a4f91c4 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c @@ -943,8 +943,7 @@ static int venc_remove(struct platform_device *pdev) static int venc_runtime_suspend(struct device *dev) { - if (venc.tv_dac_clk) - clk_disable_unprepare(venc.tv_dac_clk); + clk_disable_unprepare(venc.tv_dac_clk); dispc_runtime_put(); diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index e773893..54bc783 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c @@ -61,8 +61,7 @@ static void shmob_drm_clk_off(struct shmob_drm_device *sdev) if (sdev->meram_dev && sdev->meram_dev->pdev) pm_runtime_put_sync(&sdev->meram_dev->pdev->dev); #endif - if (sdev->clock) - clk_disable_unprepare(sdev->clock); + clk_disable_unprepare(sdev->clock); } /* ----------------------------------------------------------------------------- diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 88f16cd..af3a156 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -458,8 +458,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp) if (sti_vtg_unregister_client(gdp->vtg, &gdp->vtg_field_nb)) DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n"); - if (gdp->clk_pix) - clk_disable_unprepare(gdp->clk_pix); + clk_disable_unprepare(gdp->clk_pix); gdp->plane.status = STI_PLANE_DISABLED; gdp->vtg = NULL;