From patchwork Wed Jun 11 01:17:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonghwa Lee X-Patchwork-Id: 4333051 Return-Path: X-Original-To: patchwork-linux-pm@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 ADC28BEEAA for ; Wed, 11 Jun 2014 01:18:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7B33201FE for ; Wed, 11 Jun 2014 01:18:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF01620256 for ; Wed, 11 Jun 2014 01:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753219AbaFKBSP (ORCPT ); Tue, 10 Jun 2014 21:18:15 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:61587 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753058AbaFKBSO (ORCPT ); Tue, 10 Jun 2014 21:18:14 -0400 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 <0N6Z00HRLCY0V4C0@mailout4.samsung.com> for linux-pm@vger.kernel.org; Wed, 11 Jun 2014 10:18:00 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 6F.AD.19452.84EA7935; Wed, 11 Jun 2014 10:18:00 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-ca-5397ae48b82f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EA.6C.07139.74EA7935; Wed, 11 Jun 2014 10:18:00 +0900 (KST) Received: from localhost.localdomain ([10.252.82.199]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N6Z00LDBCXX4280@mmp1.samsung.com>; Wed, 11 Jun 2014 10:17:59 +0900 (KST) From: Jonghwa Lee To: linux-pm@vger.kernel.org Cc: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, Jonghwa Lee Subject: [PATCH 2/3] devfreq: exynos4_bus: Access memory mapped I/O region via dynamic allocation. Date: Wed, 11 Jun 2014 10:17:55 +0900 Message-id: <1402449476-6782-3-git-send-email-jonghwa3.lee@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1402449476-6782-1-git-send-email-jonghwa3.lee@samsung.com> References: <1402449476-6782-1-git-send-email-jonghwa3.lee@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkUNdj3fRggz9b+Syuf3nOatF59gmz xdmmN+wWn3uPMFrcblzB5sDq0bdlFaPH501yAUxRXDYpqTmZZalF+nYJXBmT9wYWTBSsaHxb 28C4lq+LkZNDQsBEYsbpf8wQtpjEhXvr2boYuTiEBJYyShxb8JsFpujPtK1MEIlFjBKXPj1h gXDamCQO7JnMClLFJqAj8X/fTXYQW0RARmLqlf1gcWaBConmSyCTODiEBVIkNj+VBwmzCKhK dJ6dBFbCK+Au8fv/bmaQEgkBBYk5k2xAwpwCHhJPv/5hA7GFgEq2nVsEdoOEwHc2ibPf97BC zBGQ+Db5EAtEr6zEpgNQz0hKHFxxg2UCo/ACRoZVjKKpBckFxUnpRUZ6xYm5xaV56XrJ+bmb GIHhevrfs74djDcPWB9iTAYaN5FZSjQ5HxjueSXxhsZmRhamJqbGRuaWZqQJK4nzLnqYFCQk kJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qBMTxko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MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Instead of using statically allocated MMIO(Memory Mapped IO) region, it makes driver to use ioremap() to allocate the SFR region dynamically. This patch also includes minor code clean. WARNING: line over 80 characters 907: FILE: drivers/devfreq/exynos/exynos4_bus.c:907: Signed-off-by: Jonghwa Lee Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- drivers/devfreq/exynos/exynos4_bus.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c index cadad03..7c5e940 100644 --- a/drivers/devfreq/exynos/exynos4_bus.c +++ b/drivers/devfreq/exynos/exynos4_bus.c @@ -25,8 +25,7 @@ #include #include #include - -#include +#include #include "exynos_ppmu.h" #include "exynos4_bus.h" @@ -902,9 +901,9 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) struct busfreq_ppmu_data *ppmu_data; struct dev_pm_opp *opp; struct device *dev = &pdev->dev; - int err = 0; + int i, err = 0; - data = devm_kzalloc(&pdev->dev, sizeof(struct busfreq_data), GFP_KERNEL); + data = devm_kzalloc(dev, sizeof(struct busfreq_data), GFP_KERNEL); if (data == NULL) { dev_err(dev, "Cannot allocate memory.\n"); return -ENOMEM; @@ -921,8 +920,20 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) } data->type = pdev->id_entry->driver_data; - ppmu_data->ppmu[PPMU_DMC0].hw_base = S5P_VA_DMC0; - ppmu_data->ppmu[PPMU_DMC1].hw_base = S5P_VA_DMC1; + + /* Allocate MMIO region for PPMU SFRs */ + for (i = 0; i < PPMU_END; i++) { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) { + dev_err(dev, "No mem resource for ppmu[%d]\n", i); + return -ENOENT; + } + + ppmu_data->ppmu[i].hw_base = devm_ioremap_resource(dev, res); + } + data->pm_notifier.notifier_call = exynos4_busfreq_pm_notifier_event; data->dev = dev; mutex_init(&data->lock);