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: 92935 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1766299qgi; Mon, 30 Jan 2017 21:03:28 -0800 (PST) X-Received: by 10.98.160.89 with SMTP id r86mr26956956pfe.170.1485839008588; Mon, 30 Jan 2017 21:03:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si10266758pgh.236.2017.01.30.21.03.28; Mon, 30 Jan 2017 21:03:28 -0800 (PST) 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=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751637AbdAaFDM (ORCPT + 25 others); Tue, 31 Jan 2017 00:03:12 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:34984 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbdAaFC1 (ORCPT ); Tue, 31 Jan 2017 00:02:27 -0500 Received: by mail-pf0-f175.google.com with SMTP id f144so99247398pfa.2 for ; Mon, 30 Jan 2017 21:02:27 -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=aQPWxHvlNHlpRmXInqQnm6OgU8bdnP2OsrIKHRcOOWjHUaLao08m32/jWwTS1wx34s khsOdWrkHelL8mlpvtNUYW3+jkNyxDYMSC3N3ohghbB2GJU4Nkc0pemb2KJDUKLVBrew +Ndwb2awiA8jflLwwBCVoM0BJjruDqigG3s3nhSHAwHnIpL8n4xG5A4zT+6sZXPJu8ry QJbcM5nL2kTBMj18in36iS322YeAOsgrCb8DZAoO9hKvR7IUZ17n07gxTOAK3yDehpCe OjxuLyox/UTKW+ozh3ySEqSUHV9ni5pr/onj1JXXPGSa2sV8f7W3OLQRaAMMsfIhtIVh oCCQ== X-Gm-Message-State: AIkVDXJBpcnQ7qRNEmJ6LEpqbfiCct6Nr8fSXs9vXk0uwA65i/waw0JpY6vF/zTj0zoQe8Hl 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 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 1/2] ASoC: qcom: lpass-cpu: Remove unnecessary clock checks 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.11.0 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)