提交 39d4ebb9 编写于 作者: J Joerg Roedel

iommu/core: Define iommu_ops and register_iommu only with CONFIG_IOMMU_API

This makes it impossible to compile an iommu driver into the
kernel without selecting CONFIG_IOMMU_API.
Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
上级 51acc0bc
...@@ -34,6 +34,8 @@ struct iommu_domain { ...@@ -34,6 +34,8 @@ struct iommu_domain {
#define IOMMU_CAP_CACHE_COHERENCY 0x1 #define IOMMU_CAP_CACHE_COHERENCY 0x1
#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
#ifdef CONFIG_IOMMU_API
struct iommu_ops { struct iommu_ops {
int (*domain_init)(struct iommu_domain *domain); int (*domain_init)(struct iommu_domain *domain);
void (*domain_destroy)(struct iommu_domain *domain); void (*domain_destroy)(struct iommu_domain *domain);
...@@ -49,8 +51,6 @@ struct iommu_ops { ...@@ -49,8 +51,6 @@ struct iommu_ops {
unsigned long cap); unsigned long cap);
}; };
#ifdef CONFIG_IOMMU_API
extern void register_iommu(struct iommu_ops *ops); extern void register_iommu(struct iommu_ops *ops);
extern bool iommu_found(void); extern bool iommu_found(void);
extern struct iommu_domain *iommu_domain_alloc(void); extern struct iommu_domain *iommu_domain_alloc(void);
...@@ -70,9 +70,7 @@ extern int iommu_domain_has_cap(struct iommu_domain *domain, ...@@ -70,9 +70,7 @@ extern int iommu_domain_has_cap(struct iommu_domain *domain,
#else /* CONFIG_IOMMU_API */ #else /* CONFIG_IOMMU_API */
static inline void register_iommu(struct iommu_ops *ops) struct iommu_ops {};
{
}
static inline bool iommu_found(void) static inline bool iommu_found(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册