From patchwork Thu Aug 8 09:41:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2840936 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 E0563BF535 for ; Thu, 8 Aug 2013 09:42:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 000262047E for ; Thu, 8 Aug 2013 09:42:46 +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 837E72047C for ; Thu, 8 Aug 2013 09:42:45 +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 1V7Mjg-00047O-IS; Thu, 08 Aug 2013 09:42:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7MjX-0005Lz-5t; Thu, 08 Aug 2013 09:42:15 +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 1V7MjS-0005JP-Ai for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 09:42:11 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MR700L5XHLP9DH0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 18:41:49 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.49]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id D6.99.11618.DD763025; Thu, 08 Aug 2013 18:41:49 +0900 (KST) X-AuditID: cbfee691-b7fef6d000002d62-db-520367dd4ef0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id CB.CD.31505.DD763025; Thu, 08 Aug 2013 18:41:49 +0900 (KST) Received: from DOPULLIPCHO07 ([12.23.118.94]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MR700848HLP0F90@mmp2.samsung.com>; Thu, 08 Aug 2013 18:41:49 +0900 (KST) From: Cho KyongHo To: 'Linux ARM Kernel' , 'Linux IOMMU' , 'Linux Kernel' , 'Linux Samsung SOC' , devicetree@vger.kernel.org Subject: [PATCH v9 16/16] iommu/exynos: return 0 if iommu_attach_device() successes Date: Thu, 08 Aug 2013 18:41:49 +0900 Message-id: <003401ce941b$8113a820$833af860$@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac6UF8kdvkQgXH7hS9Wbiyk5M4q1dQ== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsVy+t8zQ9276cxBBl/ei1jcuXuO1WL+ESDx 6sgPJosF+60tOmdvYLfoXXCVzeLjqePsFpseX2O1uLxrDpvFjPP7mCwurNjIbjFl0WFWi5N/ ehktWq73MjnweTw5OI/JY3bDRRaPO9f2sHmc37SG2WPzknqPyTeWM3r0bVnF6PF5k5zHlaNn mAI4o7hsUlJzMstSi/TtErgyXt7bx14wgbfiwzudBsZXXF2MnBwSAiYSE/a2MkPYYhIX7q1n 62Lk4hASWMYosXjJRFaYoim3J7NAJKYzSjyf9A6q6i+jxKIZH8Cq2AS0JFbPPc4IkhAR+M0o cevZHFYQh1ngP5PE1ttN7CBVwgKhEg92HgXrYBFQlTg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3jFO YBSYhWTULCSjZiEZNQtJywJGllWMoqkFyQXFSem5RnrFibnFpXnpesn5uZsYwYnlmfQOxlUN FocYBTgYlXh4F7oxBwmxJpYVV+YeYpTgYFYS4b1YzBQkxJuSWFmVWpQfX1Sak1p8iDEZ6NGJ zFKiyfnApJdXEm9obGJmZGlkZmFkYm5OmrCSOO/BVutAIYH0xJLU7NTUgtQimC1MHJxSDYxb WOY5JNeoz0x9+jujdavkqwmhj4w3/5mvs+x0rbCZlwrbdokrn1r/XXbLOWvT6n9KOMj9pL3/ BHf2c0ZbnIvLisV0OyYf0Duo+ypVjL/JtNqpUTe751RFQmCwk6F43r5N0bMXd0uZbd0QMMlh v/u7abz1E2MMtNiEWe++cH5RwPmmsrPxshJLcUaioRZzUXEiAGrpqq9wAwAA 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-20130808_054210_769557_4EBCEA66 X-CRM114-Status: GOOD ( 11.47 ) X-Spam-Score: -5.1 (-----) Cc: 'Kukjin Kim' , 'Prathyush' , 'Grant Grundler' , 'Joerg Roedel' , 'Subash Patel' , 'Sachin Kamat' , 'Antonios Motakis' , kvmarm@lists.cs.columbia.edu, '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=-2.4 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 iommu_attach_device() against exynos-iommu positive integer on success if the caller calls iommu_attach_device() with the same iommu_domain multiple times without call to iommu_detach_device() to inform the caller how many calls to iommu_detach_device() to really detach iommu. However the convention of the return value of success of common API is zero, this patch makes iommu_attach_device() call against exynos-iommu always return zero if the given device is successfully attached to the given iommu_domain even though it is already attached to the same iommu_domain. Reviewed-by: Grant Grundler Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 2d16fc0..d959e95 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -891,15 +891,16 @@ static int exynos_iommu_attach_device(struct iommu_domain *domain, spin_unlock_irqrestore(&priv->lock, flags); - if (ret < 0) + if (ret < 0) { dev_err(dev, "%s: Failed to attach IOMMU with pgtable %#lx\n", __func__, __pa(priv->pgtable)); - else - dev_dbg(dev, "%s: Attached IOMMU with pgtable 0x%lx%s\n", - __func__, __pa(priv->pgtable), - (ret == 0) ? "" : ", again"); + return ret; + } - return ret; + dev_dbg(dev, "%s: Attached IOMMU with pgtable 0x%lx%s\n", + __func__, __pa(priv->pgtable), (ret == 0) ? "" : ", again"); + + return 0; } static void exynos_iommu_detach_device(struct iommu_domain *domain,