From patchwork Fri May 9 07:43:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 4140591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EFC17BFF02 for ; Fri, 9 May 2014 07:45:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 26FA6201FA for ; Fri, 9 May 2014 07:45:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C116201F7 for ; Fri, 9 May 2014 07:45:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WifT6-0007Yc-EW; Fri, 09 May 2014 07:43:44 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WifT3-0007RJ-9N for linux-arm-kernel@lists.infradead.org; Fri, 09 May 2014 07:43:41 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5A00MXNQS6FJ50@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 09 May 2014 16:43:18 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.112]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 49.BE.14563.6178C635; Fri, 09 May 2014 16:43:18 +0900 (KST) X-AuditID: cbfee68e-b7fd86d0000038e3-a1-536c87165745 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 63.EE.25708.6178C635; Fri, 09 May 2014 16:43:18 +0900 (KST) Received: from chan.10.32.193.11 ([10.252.81.195]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5A00E1UQS10880@mmp1.samsung.com>; Fri, 09 May 2014 16:43:18 +0900 (KST) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com Subject: [PATCHv2 5/5] devfreq: exynos5: Use devm_devfreq_* function using device resource management Date: Fri, 09 May 2014 16:43:11 +0900 Message-id: <1399621391-27228-6-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1399621391-27228-1-git-send-email-cw00.choi@samsung.com> References: <1399621391-27228-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWyRsSkQFesPSfYYOFmKYvHaxYzWWycsZ7V Yt7Et+wW1788Z7XYPWcxi0XvgqtsFmeb3rBbrF+wkM1i0+NrrBaXd81hs/jce4TRYsb5fUwW txtXsFm8+XGWyeLxCqDek396GS0OPlzA7CDosXPWXXaPxXteMnncubaHzWPzknqPvi2rGD3O LDjC7nH8xnYmj8+b5AI4orhsUlJzMstSi/TtErgy5v55x17QLV6x5sYqlgbGI8JdjJwcEgIm Ev0XTrNA2GISF+6tZ+ti5OIQEljKKPFvzhH2LkYOsKKrX9gh4osYJbqXz4EqamKSmHiyiR2k m01AS2L/ixtsILaIgLnErqU/wWxmgRfMEs8Wy4EMEhZIlzh7Uw8kzCKgKjHp515GkDCvgKvE gpsCEDfISXzY8whsIqeAm8T6tgnMILYQUMnkZV1gayUEfrJLNN/dzAgxR0Di2+RDLBB3ykps OsAMMUdS4uCKGywTGIUXMDKsYh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LYyMzUkTVhLnPdhq HSgkkJ5YkpqdmlqQWgSzhYmDU6qBMfZaxN4ndcrJCjc269p+/fiXL8dejHWyYlmZmfXyRffW X2QJ1DgQ9p456WO7AePmHTts+TIY3OOFjzVN3N6Xc+/F4zMfgrMmnJUWaQqcyC+5VNrA2dsi 9VDizIsC9d/W/tukLZdqHzrZj0eMaZaM1bZD5QuWWwcoTfhx9cGZb7N9yqwP6f2do8RSnJFo qMVcVJwIAPiVPWUkAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140509_004341_492059_458C3511 X-CRM114-Status: GOOD ( 13.22 ) X-Spam-Score: -5.7 (-----) Cc: nm@ti.com, sreekumar.c@samsung.com, Manish Badarkhe , Kukjin Kim , linux-pm@vger.kernel.org, Sachin Kamat , jkosina@suse.cz, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org, Chanwoo Choi , labbe.montjoie@gmail.com, linux-samsung-soc@vger.kernel.org, a.kesavan@samsung.com, linux-arm-kernel@lists.infradead.org, Bartlomiej Zolnierkiewicz X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch uses devm_devfreq_add_device()/devm_devfreq_register_opp_notifier() to control automatically the resource of devfreq. Signed-off-by: Chanwoo Choi Cc: Kukjin Kim Cc: Sachin Kamat Cc: Bartlomiej Zolnierkiewicz Cc: Manish Badarkhe Cc: Abhilash Kesavan Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org --- drivers/devfreq/exynos/exynos5_bus.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c index ab54a69..6cd0392 100644 --- a/drivers/devfreq/exynos/exynos5_bus.c +++ b/drivers/devfreq/exynos/exynos5_bus.c @@ -163,21 +163,12 @@ static int exynos5_int_get_dev_status(struct device *dev, return 0; } -static void exynos5_int_exit(struct device *dev) -{ - struct platform_device *pdev = container_of(dev, struct platform_device, - dev); - struct busfreq_data_int *data = platform_get_drvdata(pdev); - - devfreq_unregister_opp_notifier(dev, data->devfreq); -} static struct devfreq_dev_profile exynos5_devfreq_int_profile = { .initial_freq = 160000, .polling_ms = 100, .target = exynos5_busfreq_int_target, .get_dev_status = exynos5_int_get_dev_status, - .exit = exynos5_int_exit, }; static int exynos5250_init_int_tables(struct busfreq_data_int *data) @@ -343,30 +334,27 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) busfreq_mon_reset(ppmu_data); - data->devfreq = devfreq_add_device(dev, &exynos5_devfreq_int_profile, + data->devfreq = devm_devfreq_add_device(dev, &exynos5_devfreq_int_profile, "simple_ondemand", NULL); + if (IS_ERR(data->devfreq)) + return PTR_ERR(data->devfreq); - if (IS_ERR(data->devfreq)) { - err = PTR_ERR(data->devfreq); - goto err_devfreq_add; + err = devm_devfreq_register_opp_notifier(dev, data->devfreq); + if (err < 0) { + dev_err(dev, "Failed to register opp notifier\n"); + return err; } - devfreq_register_opp_notifier(dev, data->devfreq); - err = register_pm_notifier(&data->pm_notifier); if (err) { dev_err(dev, "Failed to setup pm notifier\n"); - goto err_devfreq_add; + return err; } /* TODO: Add a new QOS class for int/mif bus */ pm_qos_add_request(&data->int_req, PM_QOS_NETWORK_THROUGHPUT, -1); return 0; - -err_devfreq_add: - devfreq_remove_device(data->devfreq); - return err; } static int exynos5_busfreq_int_remove(struct platform_device *pdev) @@ -375,7 +363,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); return 0; }