From patchwork Sat May 20 17:42:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9738707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C2DC6034C for ; Sat, 20 May 2017 17:43:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03CBE28540 for ; Sat, 20 May 2017 17:43:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAD0C28542; Sat, 20 May 2017 17:43:51 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5274D28540 for ; Sat, 20 May 2017 17:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=gLDftL7ao6xGX0WFLtSCM0rlGnAzTtjbMR6U8/h8n+0=; b=I4z 3BKX1zHY0+0Rd+T8u9q7msEmwQ89E4g7zrarj+cSzlPKZo9u+3RB8fecSsallC55tthPSEjLxx1Jh OQvQZhnSBPZQRdz86lE6jcsD1tYouJF4UmMCjE/gyYb0TTiK/QWMbwIr7OXXrOZJe+Mt97m8ru7HR H3X9hRLz2OJvj968z/LoVQej5An5guaDrZ21eynBQF7/57B8T980sfw3m+sirBcP29U0d9HYElVP5 vJfLwr2p7nFPP2mNQONU/5b6lLFMPtA6/416LaDDRb3NfL9/n5trkSLXGaad4PVGTdP/WRyqHg593 Sl+44uXcFVvVn5n1KKsiKpRmFvvaA7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dC8Pt-0005lC-S4; Sat, 20 May 2017 17:43:49 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dC8Pm-0005hp-HO; Sat, 20 May 2017 17:43:47 +0000 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 v4KHgtt9004724; Sun, 21 May 2017 02:42:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v4KHgtt9004724 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495302179; bh=b14A1CUn+THkNJg2JdPaAlCmpsBIBw5UdxVN1BfFd0c=; h=From:To:Cc:Subject:Date:From; b=ekL1DKHsBdnK0WWtdIQehp4L0QG9CUQJoGmgjgURJp1PeCwgZ6Qrl5yaIEfqrE712 K+mmqY9UgYnL9UTlVdYOGy9S5ZHO87aU1/Pu7UVUFeDIOLbphHj0o0x142d3BvIrZn xVCS3s2QwTRwMFtSW0xlmhvhBUVSbQzE41EcNnf437yhwMafap6RovwnIXAHye4P8+ o3CaEcwnFONXowjaYotk+BkyW+ItV4PoQqV0k0e8gxxkUK+PHPRsXeogC72TUomtyc 4OTxeZuAky7KeDbu3iYCIM4yBJEGI5QfUFsqMTAx2uLBbmgFCU8yx8yvWvrbgx7lYj FtxPNXPOTo5Dw== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: alsa-devel@alsa-project.org, Jaroslav Kysela , Takashi Iwai Subject: [PATCH] ASoC: remove NULL pointer check for clk_disable_unprepare Date: Sun, 21 May 2017 02:42:38 +0900 Message-Id: <1495302158-30951-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170520_104342_807961_3A539E46 X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lars-Peter Clausen , Support Opensource , Xiubo Li , Sangbeom Kim , Liam Girdwood , patches@opensource.wolfsonmicro.com, Timur Tabi , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, Nicolin Chen , Masahiro Yamada , Mark Brown , linux-mediatek@lists.infradead.org, Sylwester Nawrocki , Fabio Estevam , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Matthias Brugger MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/soc/codecs/adau17x1.c | 3 +-- sound/soc/codecs/da7213.c | 3 +-- sound/soc/codecs/da7218.c | 3 +-- sound/soc/codecs/da7219-aad.c | 5 ++--- sound/soc/codecs/da7219.c | 3 +-- sound/soc/codecs/es8328.c | 3 +-- sound/soc/codecs/wm8731.c | 3 +-- sound/soc/davinci/davinci-evm.c | 3 +-- sound/soc/fsl/imx-audmux.c | 6 ++---- sound/soc/intel/boards/bytcr_rt5640.c | 2 +- sound/soc/intel/boards/cht_bsw_rt5645.c | 3 +-- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 6 ++---- sound/soc/samsung/i2s.c | 3 +-- 13 files changed, 16 insertions(+), 30 deletions(-) diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c index 2c1bd27..f50739b 100644 --- a/sound/soc/codecs/adau17x1.c +++ b/sound/soc/codecs/adau17x1.c @@ -977,8 +977,7 @@ void adau17x1_remove(struct device *dev) struct adau *adau = dev_get_drvdata(dev); snd_soc_unregister_codec(dev); - if (adau->mclk) - clk_disable_unprepare(adau->mclk); + clk_disable_unprepare(adau->mclk); } EXPORT_SYMBOL_GPL(adau17x1_remove); diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 6dd7578..130e16a 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -1516,8 +1516,7 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec, DA7213_VMID_EN | DA7213_BIAS_EN); } else { /* Remove MCLK */ - if (da7213->mclk) - clk_disable_unprepare(da7213->mclk); + clk_disable_unprepare(da7213->mclk); } break; case SND_SOC_BIAS_OFF: diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c index d256ebf..eeb0bb6 100644 --- a/sound/soc/codecs/da7218.c +++ b/sound/soc/codecs/da7218.c @@ -2611,8 +2611,7 @@ static int da7218_set_bias_level(struct snd_soc_codec *codec, DA7218_LDO_EN_MASK); } else { /* Remove MCLK */ - if (da7218->mclk) - clk_disable_unprepare(da7218->mclk); + clk_disable_unprepare(da7218->mclk); } break; case SND_SOC_BIAS_OFF: diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c index 6274d79..31518df 100644 --- a/sound/soc/codecs/da7219-aad.c +++ b/sound/soc/codecs/da7219-aad.c @@ -302,9 +302,8 @@ static void da7219_aad_hptest_work(struct work_struct *work) snd_soc_update_bits(codec, DA7219_HP_R_CTRL, DA7219_HP_R_AMP_OE_MASK, DA7219_HP_R_AMP_OE_MASK); - /* Remove MCLK, if previously enabled */ - if (da7219->mclk) - clk_disable_unprepare(da7219->mclk); + /* Remove MCLK */ + clk_disable_unprepare(da7219->mclk); mutex_unlock(&da7219->lock); snd_soc_dapm_mutex_unlock(dapm); diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 9960162..307039e 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1630,8 +1630,7 @@ static int da7219_set_bias_level(struct snd_soc_codec *codec, if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) { /* Remove MCLK */ - if (da7219->mclk) - clk_disable_unprepare(da7219->mclk); + clk_disable_unprepare(da7219->mclk); } break; case SND_SOC_BIAS_OFF: diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index ed7cc42..848e0b3 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c @@ -812,8 +812,7 @@ static int es8328_remove(struct snd_soc_codec *codec) es8328 = snd_soc_codec_get_drvdata(codec); - if (es8328->clk) - clk_disable_unprepare(es8328->clk); + clk_disable_unprepare(es8328->clk); regulator_bulk_disable(ARRAY_SIZE(es8328->supplies), es8328->supplies); diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 4f9a1eb..302ed88 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -517,8 +517,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, snd_soc_write(codec, WM8731_PWR, reg | 0x0040); break; case SND_SOC_BIAS_OFF: - if (wm8731->mclk) - clk_disable_unprepare(wm8731->mclk); + clk_disable_unprepare(wm8731->mclk); snd_soc_write(codec, WM8731_PWR, 0xffff); regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 7a369e0..07a91c7 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -49,8 +49,7 @@ static void evm_shutdown(struct snd_pcm_substream *substream) struct snd_soc_card_drvdata_davinci *drvdata = snd_soc_card_get_drvdata(soc_card); - if (drvdata->mclk) - clk_disable_unprepare(drvdata->mclk); + clk_disable_unprepare(drvdata->mclk); } static int evm_hw_params(struct snd_pcm_substream *substream, diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index fc57da3..a7561e3 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -79,8 +79,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); - if (audmux_clk) - clk_disable_unprepare(audmux_clk); + clk_disable_unprepare(audmux_clk); buf = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) @@ -245,8 +244,7 @@ int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr, writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port)); writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port)); - if (audmux_clk) - clk_disable_unprepare(audmux_clk); + clk_disable_unprepare(audmux_clk); return 0; } diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index 4a76b09..8c2a7a8 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -199,7 +199,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, 48000 * 512, SND_SOC_CLOCK_IN); if (!ret) { - if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk) + if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) clk_disable_unprepare(priv->mclk); } } diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index 5bcde01..cb6f587 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -122,8 +122,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, return ret; } - if (ctx->mclk) - clk_disable_unprepare(ctx->mclk); + clk_disable_unprepare(ctx->mclk); } return 0; diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index 8a643a3..8857c08 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -294,10 +294,8 @@ static int mt8173_afe_dais_set_clks(struct mtk_base_afe *afe, static void mt8173_afe_dais_disable_clks(struct mtk_base_afe *afe, struct clk *m_ck, struct clk *b_ck) { - if (m_ck) - clk_disable_unprepare(m_ck); - if (b_ck) - clk_disable_unprepare(b_ck); + clk_disable_unprepare(m_ck); + clk_disable_unprepare(b_ck); } static int mt8173_afe_i2s_startup(struct snd_pcm_substream *substream, diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index af3ba4d..3a06acd 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1122,8 +1122,7 @@ static int i2s_runtime_suspend(struct device *dev) i2s->suspend_i2scon = readl(i2s->addr + I2SCON); i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR); - if (i2s->op_clk) - clk_disable_unprepare(i2s->op_clk); + clk_disable_unprepare(i2s->op_clk); clk_disable_unprepare(i2s->clk); return 0;