From patchwork Mon Aug 3 11:57:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 6928871 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02DEDC05AC for ; Mon, 3 Aug 2015 11:58:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BEA820567 for ; Mon, 3 Aug 2015 11:58:01 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 835A120380 for ; Mon, 3 Aug 2015 11:57:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 254EF265259; Mon, 3 Aug 2015 13:57:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 9A5F0260616; Mon, 3 Aug 2015 13:57:49 +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 9F4A326061A; Mon, 3 Aug 2015 13:57:48 +0200 (CEST) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by alsa0.perex.cz (Postfix) with ESMTP id 4598C260612 for ; Mon, 3 Aug 2015 13:57:41 +0200 (CEST) Received: by pacgq8 with SMTP id gq8so23546036pac.3 for ; Mon, 03 Aug 2015 04:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=zjDvwGIARd902PF/8YsA4izhrUsH6fq++RBG97TQvLg=; b=OtsU+UEYXmfXTJWFYPeBTjw8NBN/zBPyVft1Trb3M9etz4ivRf8fgNAgTMJYTe72Rl ppGwOGSA1TDaB+5d1rFLJWNMPY0QUdcKqREATFOP+gGwuEDor9X4lf+TC3f/rZK14W/g iovMMQAC/OY/NW6NBirF2pQEHRfs9C+U0HegGbgIVgR5yXhepUm+7zX60dgzdX4hS2j1 md244aHfmb0htQohxKpdtYu2v2kNeBEgFmOfD8cP7R+GOESjQXkQIXZK51gOrh1oEBrj pVhtNWVgW5oLJW42VYAHXWbvkOvwwmPmysJQTAdEHpRvTuzuamzOFzPmO6tqXzP38Vju 9Bew== X-Received: by 10.68.68.197 with SMTP id y5mr22719298pbt.164.1438603060002; Mon, 03 Aug 2015 04:57:40 -0700 (PDT) Received: from vaishali-Ideapad-Z570 ([150.107.241.2]) by smtp.gmail.com with ESMTPSA id xr5sm17390003pac.38.2015.08.03.04.57.37 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Aug 2015 04:57:38 -0700 (PDT) Date: Mon, 3 Aug 2015 17:27:34 +0530 From: Vaishali Thakkar To: Liam Girdwood Message-ID: <20150803115734.GA32440@localhost> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Alexandre Courbot , alsa-devel@alsa-project.org, Stephen Warren , linux-kernel@vger.kernel.org, Takashi Iwai , Mark Brown , Thierry Reding , linux-tegra@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: tegra: Use devm_clk_get 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces the use of managed resource function devm_clk_get instead of clk_get and removes corresponding calls to clk_put in the probe and remove functions. To be compatible with the change various gotos are replaced with direct returns, and unneeded labels are dropped. Signed-off-by: Vaishali Thakkar --- sound/soc/tegra/tegra30_ahub.c | 49 ++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index bc94e5d..989b1e8 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -549,54 +549,51 @@ static int tegra30_ahub_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Can't get reset %s\n", configlink_mods[i].rst_name); ret = PTR_ERR(rst); - goto err; + return ret; } ret = reset_control_deassert(rst); reset_control_put(rst); if (ret) - goto err; + return ret; } ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), GFP_KERNEL); if (!ahub) { dev_err(&pdev->dev, "Can't allocate tegra30_ahub\n"); - ret = -ENOMEM; - goto err; + return -ENOMEM; } dev_set_drvdata(&pdev->dev, ahub); ahub->soc_data = soc_data; ahub->dev = &pdev->dev; - ahub->clk_d_audio = clk_get(&pdev->dev, "d_audio"); + ahub->clk_d_audio = devm_clk_get(&pdev->dev, "d_audio"); if (IS_ERR(ahub->clk_d_audio)) { dev_err(&pdev->dev, "Can't retrieve ahub d_audio clock\n"); ret = PTR_ERR(ahub->clk_d_audio); - goto err; + return ret; } - ahub->clk_apbif = clk_get(&pdev->dev, "apbif"); + ahub->clk_apbif = devm_clk_get(&pdev->dev, "apbif"); if (IS_ERR(ahub->clk_apbif)) { dev_err(&pdev->dev, "Can't retrieve ahub apbif clock\n"); ret = PTR_ERR(ahub->clk_apbif); - goto err_clk_put_d_audio; + return ret; } res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res0) { dev_err(&pdev->dev, "No apbif memory resource\n"); - ret = -ENODEV; - goto err_clk_put_apbif; + return -ENODEV; } region = devm_request_mem_region(&pdev->dev, res0->start, resource_size(res0), DRV_NAME); if (!region) { dev_err(&pdev->dev, "request region apbif failed\n"); - ret = -EBUSY; - goto err_clk_put_apbif; + return -EBUSY; } ahub->apbif_addr = res0->start; @@ -604,8 +601,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev) resource_size(res0)); if (!regs_apbif) { dev_err(&pdev->dev, "ioremap apbif failed\n"); - ret = -ENOMEM; - goto err_clk_put_apbif; + return -ENOMEM; } ahub->regmap_apbif = devm_regmap_init_mmio(&pdev->dev, regs_apbif, @@ -613,31 +609,28 @@ static int tegra30_ahub_probe(struct platform_device *pdev) if (IS_ERR(ahub->regmap_apbif)) { dev_err(&pdev->dev, "apbif regmap init failed\n"); ret = PTR_ERR(ahub->regmap_apbif); - goto err_clk_put_apbif; + return ret; } regcache_cache_only(ahub->regmap_apbif, true); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (!res1) { dev_err(&pdev->dev, "No ahub memory resource\n"); - ret = -ENODEV; - goto err_clk_put_apbif; + return -ENODEV; } region = devm_request_mem_region(&pdev->dev, res1->start, resource_size(res1), DRV_NAME); if (!region) { dev_err(&pdev->dev, "request region ahub failed\n"); - ret = -EBUSY; - goto err_clk_put_apbif; + return -EBUSY; } regs_ahub = devm_ioremap(&pdev->dev, res1->start, resource_size(res1)); if (!regs_ahub) { dev_err(&pdev->dev, "ioremap ahub failed\n"); - ret = -ENOMEM; - goto err_clk_put_apbif; + return -ENOMEM; } ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub, @@ -645,7 +638,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev) if (IS_ERR(ahub->regmap_ahub)) { dev_err(&pdev->dev, "ahub regmap init failed\n"); ret = PTR_ERR(ahub->regmap_ahub); - goto err_clk_put_apbif; + return ret; } regcache_cache_only(ahub->regmap_ahub, true); @@ -662,12 +655,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put_apbif: - clk_put(ahub->clk_apbif); -err_clk_put_d_audio: - clk_put(ahub->clk_d_audio); - ahub = NULL; -err: + return ret; } @@ -680,11 +668,6 @@ static int tegra30_ahub_remove(struct platform_device *pdev) if (!pm_runtime_status_suspended(&pdev->dev)) tegra30_ahub_runtime_suspend(&pdev->dev); - clk_put(ahub->clk_apbif); - clk_put(ahub->clk_d_audio); - - ahub = NULL; - return 0; }