[PATCH] iommu: change generic_device_group function

From: cn_wyl2003
Date: Fri Mar 25 2016 - 08:41:22 EST


From: yalin wang <yalin.wang2010@xxxxxxxxx>

change this function to return only iommu_group* pointer or
PTR_ERR(), never return NULL when failed.
The caller of this function only check IS_ERR() for its return value.

Signed-off-by: yalin wang <yalin.wang2010@xxxxxxxxx>
---
drivers/iommu/iommu.c | 15 ---------------
include/linux/iommu.h | 10 ++++++++--
2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index bfd4f7c..4984108 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -728,21 +728,6 @@ static int get_pci_alias_or_group(struct pci_dev *pdev, u16 alias, void *opaque)
}

/*
- * Generic device_group call-back function. It just allocates one
- * iommu-group per device.
- */
-struct iommu_group *generic_device_group(struct device *dev)
-{
- struct iommu_group *group;
-
- group = iommu_group_alloc();
- if (IS_ERR(group))
- return NULL;
-
- return group;
-}
-
-/*
* Use standard PCI bus topology, isolation features, and DMA alias quirks
* to find or create an IOMMU group for a device.
*/
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a5c539f..462280b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -327,8 +327,14 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain,

/* PCI device grouping function */
extern struct iommu_group *pci_device_group(struct device *dev);
-/* Generic device grouping function */
-extern struct iommu_group *generic_device_group(struct device *dev);
+/*
+ * Generic device_group call-back function. It just allocates one
+ * iommu-group per device.
+ */
+static inline struct iommu_group *generic_device_group(struct device *dev)
+{
+ return iommu_group_alloc();
+}

#else /* CONFIG_IOMMU_API */

--
1.9.1