From patchwork Mon Oct 7 01:56:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2993791 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 A7D13BF924 for ; Mon, 7 Oct 2013 01:57:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB1A820136 for ; Mon, 7 Oct 2013 01:57:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B25F120121 for ; Mon, 7 Oct 2013 01:57:08 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT04H-0004Lw-SW; Mon, 07 Oct 2013 01:57:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT04E-0006ta-KU; Mon, 07 Oct 2013 01:57:02 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT04A-0006sK-R6 for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2013 01:57:00 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUA00AS901VLV80@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2013 10:56:37 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id A3.2B.30629.5D412525; Mon, 07 Oct 2013 10:56:37 +0900 (KST) X-AuditID: cbfee68d-b7fe86d0000077a5-de-525214d5031d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B7.AE.05832.5D412525; Mon, 07 Oct 2013 10:56:37 +0900 (KST) Received: from DO-PULLIP-CHO07.dsn.sec.samsung.com ([12.23.118.94]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MUA00H4Q02CVZD0@mmp1.samsung.com>; Mon, 07 Oct 2013 10:56:36 +0900 (KST) Date: Mon, 07 Oct 2013 10:56:36 +0900 From: Cho KyongHo To: Linux ARM Kernel , Linux DeviceTree , Linux IOMMU , Linux Kernel , Linux Samsung SOC Subject: [PATCH v10 09/20] iommu/exynos: use managed device helper functions Message-id: <20131007105636.d3eabb5be87899116cca4a99@samsung.com> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.10.14; i686-pc-mingw32) MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsVy+t8zY92rIkFBBlNXiFvcuXuO1WL+ESDx 6sgPJosF+60tOmdvYLfoXXCVzWLT42usFpd3zWGzmHF+H5PFhRUb2S2mLDrManH4TTurxck/ vYwWLdd7mSzWz3jNYjHz1hoWBwGPJwfnMXnMbrjI4vHvcD+Tx51re9g8Ni+p95h8YzmjR9+W VYwenzfJeVw5eoYpgDOKyyYlNSezLLVI3y6BK+NG7xaWggfiFctfHWZtYJwm3MXIwSEhYCIx 9a1mFyMnkCkmceHeerYuRi4OIYFljBIznz1jg0iYSPzqfcUKkVjEKHHjfTc7hDOJSaLv7jp2 kCoWAVWJ3q8zwDrYBLQkVs89zghSJCLQxiTxtfEQC4jDLHCaWWLV7hXMIFXCAj4SB7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S1ILihOSs810itOzC0uzUvXS87P3cQIThTPpHcwrmqwOMQowMGoxMO7435g kBBrYllxZe4hRgkOZiUR3kt1QCHelMTKqtSi/Pii0pzU4kOMyUB/T2SWEk3OByaxvJJ4Q2MT MyNLIzMLIxNzc9KElcR5D7ZaBwoJpCeWpGanphakFsFsYeLglGpgnBLzT9Fz1mMe3Q3NWrMe vU71ePtkztHp4k/fBhssjdbesuL6Ttbe3JuCqRekBPwNRAQ9TfXfpi57fPVd1tHiyttP5Q9V PdO6WpS2+M27NXpvWJ8eLzXkLd63J+SSQnfR0+LAK2aGrz5WtTz9f121olPmvsBMKRYDm5dV kkIusQsT9/ZuCa/iUWIpzkg01GIuKk4EANcSwe9YAwAA 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-20131006_215659_582291_048DC659 X-CRM114-Status: GOOD ( 14.00 ) X-Spam-Score: -6.9 (------) Cc: Kukjin Kim , Prathyush , Grant Grundler , Joerg Roedel , Subash Patel , Sachin Kamat , Sylwester Nawrocki , Varun Sethi , Antonios Motakis , Tomasz Figa , Rahul Sharma 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 managed device helper functions in the probe(). Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 64 ++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 39 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 735d75e..6fdb3836 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -510,53 +510,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) static int exynos_sysmmu_probe(struct platform_device *pdev) { - int ret; + int irq, ret; struct device *dev = &pdev->dev; struct sysmmu_drvdata *data; struct resource *res; - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (!data) { - dev_dbg(dev, "Not enough memory\n"); - ret = -ENOMEM; - goto err_alloc; - } + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { - dev_dbg(dev, "Unable to find IOMEM region\n"); - ret = -ENOENT; - goto err_res; + dev_err(dev, "Unable to find IOMEM region\n"); + return -ENOENT; } - data->sfrbase = ioremap(res->start, resource_size(res)); - if (!data->sfrbase) { - dev_dbg(dev, "Unable to map IOMEM @ PA:%#x\n", res->start); - ret = -ENOENT; - goto err_res; - } + data->sfrbase = devm_ioremap_resource(dev, res); + if (IS_ERR(data->sfrbase)) + return PTR_ERR(data->sfrbase); - ret = platform_get_irq(pdev, 0); - if (ret <= 0) { + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { dev_dbg(dev, "Unable to find IRQ resource\n"); - goto err_irq; + return irq; } - ret = request_irq(ret, exynos_sysmmu_irq, 0, + ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0, dev_name(dev), data); if (ret) { - dev_dbg(dev, "Unabled to register interrupt handler\n"); - goto err_irq; + dev_err(dev, "Unabled to register handler of irq %d\n", irq); + return ret; } - if (dev_get_platdata(dev)) { - struct sysmmu_platform_data *platdata = dev_get_platdata(dev); + data->clk = devm_clk_get(dev, "sysmmu"); + if (IS_ERR(data->clk)) { + dev_info(dev, "No gate clock found!\n"); + data->clk = NULL; + } - data->clk = clk_get(dev, "sysmmu"); - if (IS_ERR(data->clk)) { - data->clk = NULL; - dev_dbg(dev, "No clock descriptor registered\n"); - } + ret = clk_prepare(data->clk); + if (ret) { + dev_err(dev, "Failed to prepare clk\n"); + return ret; } data->sysmmu = dev; @@ -569,17 +564,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) pm_runtime_enable(dev); - dev_dbg(dev, "Initialized\n"); + dev_dbg(dev, "Probed and initialized\n"); return 0; -err_irq: - free_irq(platform_get_irq(pdev, 0), data); -err_res: - iounmap(data->sfrbase); -err_init: - kfree(data); -err_alloc: - dev_err(dev, "Failed to initialize\n"); - return ret; } static struct platform_driver exynos_sysmmu_driver = {