From patchwork Wed Jun 5 06:13:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 17538 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 367C625A2B for ; Wed, 5 Jun 2013 06:27:28 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id hm9sf1093079wib.8 for ; Tue, 04 Jun 2013 23:27:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=+UbDQDFV9f34nZXh7u4vcaeRWS7sG+c8g6OR6Ebq3bg=; b=gsXLOO9PnbXD64yySOSllq71CUWrNXefw0qntK8oxZcVI1aJhTiBYhFfIQINMAbgSg N+lYv1lP2AiQwotIV04fi9rxaFdOG3HTrYuYVLe6KYPkBt6bVK9m+58gZyFrGYsdddOq Yov1xIOo5hX+a9ZkL57GS8rj6HQQDTJjjkjTqiNyy3/yT4cH5bKGU9Sq9WT6GPRhuCLy LaC52g7oVFA1YkO/CD05FdHV4KotIwRPi0P2JROSd5LSpcQMHDENHMKiSwAg1wR4xlQ0 OwjnXCO3wAyZGdMEXOH5bblHhz7allQXO4ePqtdh4HK4cC4pBZ2gJwIszIpj1rgTzKKu 3QBQ== X-Received: by 10.180.76.115 with SMTP id j19mr1856295wiw.2.1370413647473; Tue, 04 Jun 2013 23:27:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.8.40 with SMTP id o8ls1448008wia.40.canary; Tue, 04 Jun 2013 23:27:27 -0700 (PDT) X-Received: by 10.180.90.70 with SMTP id bu6mr4898473wib.34.1370413647377; Tue, 04 Jun 2013 23:27:27 -0700 (PDT) Received: from mail-ve0-x22d.google.com (mail-ve0-x22d.google.com [2607:f8b0:400c:c01::22d]) by mx.google.com with ESMTPS id ch10si24822691wjc.256.2013.06.04.23.27.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Jun 2013 23:27:27 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22d; Received: by mail-ve0-f173.google.com with SMTP id jw11so919406veb.4 for ; Tue, 04 Jun 2013 23:27:26 -0700 (PDT) X-Received: by 10.220.91.9 with SMTP id k9mr3097017vcm.41.1370413646292; Tue, 04 Jun 2013 23:27:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp4040vcb; Tue, 4 Jun 2013 23:27:25 -0700 (PDT) X-Received: by 10.66.117.98 with SMTP id kd2mr23868579pab.160.1370413645491; Tue, 04 Jun 2013 23:27:25 -0700 (PDT) Received: from mail-pb0-x235.google.com (mail-pb0-x235.google.com [2607:f8b0:400e:c01::235]) by mx.google.com with ESMTPS id pt5si44752472pac.243.2013.06.04.23.27.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Jun 2013 23:27:25 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::235 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=2607:f8b0:400e:c01::235; Received: by mail-pb0-f53.google.com with SMTP id xb12so1274324pbc.12 for ; Tue, 04 Jun 2013 23:27:25 -0700 (PDT) X-Received: by 10.66.192.7 with SMTP id hc7mr32297918pac.206.1370413645061; Tue, 04 Jun 2013 23:27:25 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id vb8sm66600749pbc.11.2013.06.04.23.27.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Jun 2013 23:27:24 -0700 (PDT) From: Sachin Kamat To: linux-pm@vger.kernel.org Cc: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, a.kesavan@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 3/3] PM / devfreq: Use devm_* APIs in exynos5_bus.c Date: Wed, 5 Jun 2013 11:43:01 +0530 Message-Id: <1370412781-20683-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1370412781-20683-1-git-send-email-sachin.kamat@linaro.org> References: <1370412781-20683-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQm7uPJDQOL5C2WxGVwsVEL4mGfLKnD5Uw/L0TwNz9eA8IMwK7SjMCofgByY4Hb38qIYJmFF X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22d is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , devm_* APIs are device managed and make clean up and exit codes simpler. Signed-off-by: Sachin Kamat --- drivers/devfreq/exynos/exynos5_bus.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c index 9a82419..102d1f0 100644 --- a/drivers/devfreq/exynos/exynos5_bus.c +++ b/drivers/devfreq/exynos/exynos5_bus.c @@ -351,20 +351,18 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) err = exynos5250_init_int_tables(data); if (err) - goto err_regulator; + return err; - data->vdd_int = regulator_get(dev, "vdd_int"); + data->vdd_int = devm_regulator_get(dev, "vdd_int"); if (IS_ERR(data->vdd_int)) { dev_err(dev, "Cannot get the regulator \"vdd_int\"\n"); - err = PTR_ERR(data->vdd_int); - goto err_regulator; + return PTR_ERR(data->vdd_int); } - data->int_clk = clk_get(dev, "int_clk"); + data->int_clk = devm_clk_get(dev, "int_clk"); if (IS_ERR(data->int_clk)) { dev_err(dev, "Cannot get clock \"int_clk\"\n"); - err = PTR_ERR(data->int_clk); - goto err_clock; + return PTR_ERR(data->int_clk); } rcu_read_lock(); @@ -374,8 +372,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) rcu_read_unlock(); dev_err(dev, "Invalid initial frequency %lu kHz.\n", exynos5_devfreq_int_profile.initial_freq); - err = PTR_ERR(opp); - goto err_opp_add; + return PTR_ERR(opp); } initial_freq = opp_get_freq(opp); initial_volt = opp_get_voltage(opp); @@ -385,12 +382,12 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) err = clk_set_rate(data->int_clk, initial_freq * 1000); if (err) { dev_err(dev, "Failed to set initial frequency\n"); - goto err_opp_add; + return err; } err = exynos5_int_setvolt(data, initial_volt); if (err) - goto err_opp_add; + return err; platform_set_drvdata(pdev, data); @@ -419,11 +416,6 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) err_devfreq_add: devfreq_remove_device(data->devfreq); -err_opp_add: - clk_put(data->int_clk); -err_clock: - regulator_put(data->vdd_int); -err_regulator: return err; } @@ -434,8 +426,6 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev) pm_qos_remove_request(&data->int_req); unregister_pm_notifier(&data->pm_notifier); devfreq_remove_device(data->devfreq); - regulator_put(data->vdd_int); - clk_put(data->int_clk); return 0; }