linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 02/12] iommu: Convert iommu-caps from define to enum
Date: Fri,  5 Sep 2014 12:52:54 +0200	[thread overview]
Message-ID: <1409914384-21191-3-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1409914384-21191-1-git-send-email-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

Allow compile-time type-checking.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/iommu.c |  2 +-
 include/linux/iommu.h | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1bc882e..319d40e 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -955,7 +955,7 @@ phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
 EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
 
 int iommu_domain_has_cap(struct iommu_domain *domain,
-			 unsigned long cap)
+			 enum iommu_cap cap)
 {
 	if (domain->ops->domain_has_cap != NULL)
 		return domain->ops->domain_has_cap(domain, cap);
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index d43146a..d5534d5 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -57,8 +57,11 @@ struct iommu_domain {
 	struct iommu_domain_geometry geometry;
 };
 
-#define IOMMU_CAP_CACHE_COHERENCY	0x1
-#define IOMMU_CAP_INTR_REMAP		0x2	/* isolates device intrs */
+enum iommu_cap {
+	IOMMU_CAP_CACHE_COHERENCY,	/* IOMMU can enforce cache coherent DMA
+					   transactions */
+	IOMMU_CAP_INTR_REMAP,		/* IOMMU supports interrupt isolation */
+};
 
 /*
  * Following constraints are specifc to FSL_PAMUV1:
@@ -157,7 +160,7 @@ extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
 		       size_t size);
 extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
 extern int iommu_domain_has_cap(struct iommu_domain *domain,
-				unsigned long cap);
+				enum iommu_cap cap);
 extern void iommu_set_fault_handler(struct iommu_domain *domain,
 			iommu_fault_handler_t handler, void *token);
 
@@ -312,7 +315,7 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
 }
 
 static inline int iommu_domain_has_cap(struct iommu_domain *domain,
-				       unsigned long cap)
+				       enum iommu_cap cap)
 {
 	return 0;
 }
-- 
1.9.1


  parent reply	other threads:[~2014-09-05 10:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:52 [PATCH 00/12] iommu: Convert iommu_domain_has_cap() to iommu_capable() Joerg Roedel
2014-09-05 10:52 ` [PATCH 01/12] iommu: Introduce iommu_capable API function Joerg Roedel
2014-09-05 10:52 ` Joerg Roedel [this message]
2014-09-05 10:52 ` [PATCH 03/12] iommu/amd: Convert to iommu_capable() " Joerg Roedel
2014-09-05 10:52 ` [PATCH 04/12] iommu/arm-smmu: " Joerg Roedel
2014-09-08 16:51   ` Will Deacon
2014-09-09 13:57     ` Joerg Roedel
2014-09-17  8:53     ` [PATCH 04/13 v2] iommu/arm-smmu: Convert to iommu_capable() API function function Joerg Roedel
2014-09-19 16:42       ` Will Deacon
2014-09-22 15:36         ` Joerg Roedel
2014-09-05 10:52 ` [PATCH 05/12] iommu/fsl: Convert to iommu_capable() API function Joerg Roedel
2014-09-09 18:38   ` Varun Sethi
2014-09-05 10:52 ` [PATCH 06/12] iommu/vt-d: " Joerg Roedel
2014-09-05 10:52 ` [PATCH 07/12] iommu/msm: " Joerg Roedel
2014-09-05 10:53 ` [PATCH 08/12] iommu/tegra: " Joerg Roedel
2014-09-05 10:53 ` [PATCH 09/12] kvm: iommu: Convert to use new " Joerg Roedel
2014-09-17  8:29   ` Joerg Roedel
2014-09-05 10:53 ` [PATCH 10/12] vfio: " Joerg Roedel
2014-09-08 23:14   ` Alex Williamson
2014-09-05 10:53 ` [PATCH 11/12] IB/usnic: " Joerg Roedel
2014-09-17  8:30   ` Joerg Roedel
2014-09-05 10:53 ` [PATCH 12/12] iommu: Remove iommu_domain_has_cap() " Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409914384-21191-3-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).