From patchwork Mon Jan 30 21:03:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9548625 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 0DA1860425 for ; Tue, 31 Jan 2017 21:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3DDE281A7 for ; Tue, 31 Jan 2017 21:22:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E711028304; Tue, 31 Jan 2017 21:22:38 +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=0.3 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20856281A7 for ; Tue, 31 Jan 2017 21:22:38 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 74134266A65; Tue, 31 Jan 2017 22:19:07 +0100 (CET) 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 AEA5A2670E1; Tue, 31 Jan 2017 06:02:30 +0100 (CET) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by alsa0.perex.cz (Postfix) with ESMTP id EA8A726705F for ; Tue, 31 Jan 2017 06:02:28 +0100 (CET) Received: by mail-pf0-f181.google.com with SMTP id y143so99254103pfb.0 for ; Mon, 30 Jan 2017 21:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=LkFw3FdUJza8fnR6JhvLiguCxj/Tx220b/SOQZzvfKI=; b=DzfuRPmuW4XYq66egswIKwpz6HtO5CYzNFar0+a9eWPl4sFgkF5CgcZCam/KTgHLf/ +JeSPIh254zfWvHB4Jc61vFJxHaf4oUEOH9+0mqMX10Lzr55u/By5nXzYyijmLrScCgA z+tjcJYNzuukrvY512q6rgPgw3I+UmAK2XHDM= 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; bh=LkFw3FdUJza8fnR6JhvLiguCxj/Tx220b/SOQZzvfKI=; b=k1ehbCdLqgQwrQQapUBUWLqqQDsMzPC3cV58VuIA+GiHX2duxhHAjLMVtIeqUzBerz 9PILAAqJBRzkgYbWRlJRRGeFDN8xgX0XaWgx/TNAhRhDe8zg7tOg8q4lHO5kT8RUwQln SrRRSupnXWz7xWj6UMzrkBf+hFo0KPnEHK2b/10uI6f8LvoWZLJ60oTJaJd7M9vcRjb8 7VzK2V4I2lT6MvWHVQ3vK3VUtdfVXCLV94/J8O4VmW2W+USgbzlfkGU8RB7CwTG/03Ug W0rr/DgZmIgCWQoyzSST/vYJubexUd2NRpd8FsOk7oDz0swAK1BQFn1LZ1XBxICf5UMV nEZw== X-Gm-Message-State: AIkVDXLE+YwJ3+GB0EqfrL7HI18/mXiCm7LVMP2Wraab/aIZziQSzh2KzplueJURhs2O8GHn X-Received: by 10.98.12.77 with SMTP id u74mr27112598pfi.116.1485838947220; Mon, 30 Jan 2017 21:02:27 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id 88sm36459423pfr.41.2017.01.30.21.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jan 2017 21:02:26 -0800 (PST) From: Bjorn Andersson To: Patrick Lai , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Date: Mon, 30 Jan 2017 13:03:36 -0800 Message-Id: <20170130210337.28417-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Tue, 31 Jan 2017 22:19:04 +0100 Cc: alsa-devel@alsa-project.org, Srinivas Kandagatla , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 1/2] ASoC: qcom: lpass-cpu: Remove unnecessary clock checks 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 X-Virus-Scanned: ClamAV using ClamSMTP Clean up the clock calling code by removing numerous IS_ERR() checks by just assigning the clock NULL; as this turn all used functions in the clk API to nops. Also include the word "optional" in the error message when failing to acquire the optional osr clocks. Cc: Banajit Goswami Cc: Patrick Lai Cc: Srinivas Kandagatla Signed-off-by: Bjorn Andersson --- sound/soc/qcom/lpass-cpu.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index eff3f9a8b685..1b912a9bb791 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -33,9 +33,6 @@ static int lpass_cpu_daiops_set_sysclk(struct snd_soc_dai *dai, int clk_id, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; - if (IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - return 0; - ret = clk_set_rate(drvdata->mi2s_osr_clk[dai->driver->id], freq); if (ret) dev_err(dai->dev, "%s() error setting mi2s osrclk to %u: %d\n", @@ -50,23 +47,18 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) { - ret = clk_prepare_enable( - drvdata->mi2s_osr_clk[dai->driver->id]); - if (ret) { - dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", - __func__, ret); - return ret; - } + ret = clk_prepare_enable(drvdata->mi2s_osr_clk[dai->driver->id]); + if (ret) { + dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", + __func__, ret); + return ret; } ret = clk_prepare_enable(drvdata->mi2s_bit_clk[dai->driver->id]); if (ret) { dev_err(dai->dev, "%s() error in enabling mi2s bit clk: %d\n", __func__, ret); - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - clk_disable_unprepare( - drvdata->mi2s_osr_clk[dai->driver->id]); + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); return ret; } @@ -80,8 +72,7 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]); - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); } static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, @@ -505,9 +496,11 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) clk_name); if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) { dev_warn(&pdev->dev, - "%s() error getting mi2s-osr-clk: %ld\n", + "%s() error getting optional mi2s-osr-clk: %ld\n", __func__, PTR_ERR(drvdata->mi2s_osr_clk[dai_id])); + + drvdata->mi2s_osr_clk[dai_id] = NULL; } if (variant->num_dai > 1)