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: 2993761 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 329359F1C4 for ; Mon, 7 Oct 2013 01:56:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B1D220170 for ; Mon, 7 Oct 2013 01:56:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 444AB20121 for ; Mon, 7 Oct 2013 01:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753838Ab3JGB4j (ORCPT ); Sun, 6 Oct 2013 21:56:39 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:59760 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769Ab3JGB4i (ORCPT ); Sun, 6 Oct 2013 21:56:38 -0400 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>; 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 Cc: Antonios Motakis , Grant Grundler , Joerg Roedel , Kukjin Kim , Prathyush , Rahul Sharma , Sachin Kamat , Subash Patel , Varun Sethi , Sylwester Nawrocki , Tomasz Figa 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 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsVy+t8zY92rIkFBBlNXiFvcuXuO1WL+ESDx 6sgPJosF+60tOmdvYLfoXXCVzWLT42usFpd3zWGzmHF+H5PFhRUb2S2mLDrManH4TTurxck/ vYwWLdd7mSzWz3jNYjHz1hoWBwGPJwfnMXnMbrjI4vHvcD+Tx51re9g8Ni+p95h8YzmjR9+W VYwenzfJeVw5eoYpgDOKyyYlNSezLLVI3y6BK+NG7xaWggfiFctfHWZtYJwm3MXIwSEhYCIx 9a1mFyMnkCkmceHeerYuRi4OIYFljBIznz1jg0iYSPzqfcUKkVjEKHHjfTc7hDOJSaLv7jp2 kCoWAVWJ3q8zwDrYBLQkVs89zghSJCLQxiTxtfEQC4jDLHCaWWLV7hXMIFXCAj4SB7ougdm8 Ao4SHxu2MEPss5C40NTBDhEXlPgx+R4LiM0MNHXztiZWCFteYvOat8wgQyUEJ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gkOZiUR3kt1QCHelMTKqtSi/Pii0pzU4kOMyUB/T2SWEk3OByaxvJJ4Q2MT MyNLIzMLIxNzc9KElcR5D7ZaBwoJpCeWpGanphakFsFsYeLglGpgnBLzT9Fz1mMe3Q3NWrMe vU71ePtkztHp4k/fBhssjdbesuL6Ttbe3JuCqRekBPwNRAQ9TfXfpi57fPVd1tHiyttP5Q9V PdO6WpS2+M27NXpvWJ8eLzXkLd63J+SSQnfR0+LAK2aGrz5WtTz9f121olPmvsBMKRYDm5dV kkIusQsT9/ZuCa/iUWIpzkg01GIuKk4EANcSwe9YAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 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 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 = {