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: 100232 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp808812qge; Sat, 20 May 2017 10:43:17 -0700 (PDT) X-Received: by 10.28.198.13 with SMTP id w13mr20444038wmf.9.1495302197366; Sat, 20 May 2017 10:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495302197; cv=none; d=google.com; s=arc-20160816; b=g4WiZrD28LELudR518ktumEBq4KHmvmVgRRYGhq1dXfRQhAbDaYwUfLRRJW1zi9miE 169TQ8FF1EubvHJJTxAUckyjPxNgBrS2t75Xerl+OyzxxtO/0aKgxF8ey0vR6qES9BHd iBGWcLUgHEMilz0UmWWPf305bHkgdEJIS6eqIIHdREKP1xBt2WvkE0jeh1wibQlNCl94 I089Me1IQnpjebQzEw8hgn3kGg9tVKhYamDOKAmFyVOL00ywTWxc4/6BtNvNFp0S94oX 8Utm0hATx2XcAoEl8Mbg6Jy94AtMJCdIKQ1TIIbRZNoFnQv2XXScOZs1idnIJVfSCJLm ow0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:dkim-filter:delivered-to:arc-authentication-results; bh=Hspf1kyBfKXsML+6BMoox5hOG5C58Kr4G1M5ruytvo0=; b=EYIYegtQ1WjCniXj+SrxN5X7CtgsDFSptlF7xLlYVQuhmY/tUI9jQGHQjdDPzhL5LR Bqg1zG53bLzfnQUS8JFzpj8e7xk3GDq1JvTZAVijAVMq5brzg78EWu4rj1UotLdv2Xw7 VlYlnXjvXVAMlHgala7Yzg7gq8Y5K1BqipSnQoWkeP5xpA71HkjpKyELV80636UjgjpG aAOgyPQ3+PVit+CaIyIx1PcoSbodJ3xUGs2bpZ7ZofulFt5t6N0MMQMupbORS0wpho5F +1iIPOjdUX3vKMM5nWvOB67HYW+iVDHDUdjmq4DC8PXvW4a6mhPUKe2XBxIg0LsUHR6Z jFDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id 66si28802445wmo.85.2017.05.20.10.43.15; Sat, 20 May 2017 10:43:17 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EB6DB2668BF; Sat, 20 May 2017 19:43:14 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF9282668E2; Sat, 20 May 2017 19:43:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_SOFTFAIL autolearn=disabled version=3.4.0 Received: from conuserg-09.nifty.com (conuserg-09.nifty.com [210.131.2.76]) by alsa0.perex.cz (Postfix) with ESMTP id 5AAC126684C for ; Sat, 20 May 2017 19:43:06 +0200 (CEST) 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 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 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 Subject: [alsa-devel] [PATCH] ASoC: remove NULL pointer check for clk_disable_unprepare X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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 --- 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(-) -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel 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;