All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: change generic_device_group function
@ 2016-03-25 12:06 cn_wyl2003
       [not found] ` <1458907611-19694-1-git-send-email-cn_wyl2003-KN7UnAbNpbg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: cn_wyl2003 @ 2016-03-25 12:06 UTC (permalink / raw)
  To: joro, will.deacon, alex.williamson, renesas, yalin.wang2010,
	nicolas.iooss_linux, robin.murphy, iommu, linux-kernel

From: yalin wang <yalin.wang2010@gmail.com>

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@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: change generic_device_group function
  2016-03-25 12:06 [PATCH] iommu: change generic_device_group function cn_wyl2003
@ 2016-04-05 15:04     ` Joerg Roedel
  0 siblings, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2016-04-05 15:04 UTC (permalink / raw)
  To: cn_wyl2003-KN7UnAbNpbg
  Cc: will.deacon-5wv7dgnIgG8,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	yalin.wang2010-Re5JQEeQqe8AvxtiuMwx3w,
	nicolas.iooss_linux-oWGTIYur0i8, renesas-yzvPICuk2ACczHhG9Qg4qA

On Fri, Mar 25, 2016 at 08:06:51PM +0800, cn_wyl2003-KN7UnAbNpbg@public.gmane.org wrote:
> From: yalin wang <yalin.wang2010-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

You are right, thanks for catching this. But please leave the
generic_device_group function in iommu.c. It is assigned to a function
pointer by drivers, so inlining it doesn't make sense anyway.


	Joerg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: change generic_device_group function
@ 2016-04-05 15:04     ` Joerg Roedel
  0 siblings, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2016-04-05 15:04 UTC (permalink / raw)
  To: cn_wyl2003
  Cc: will.deacon, alex.williamson, renesas, yalin.wang2010,
	nicolas.iooss_linux, robin.murphy, iommu, linux-kernel

On Fri, Mar 25, 2016 at 08:06:51PM +0800, cn_wyl2003@126.com wrote:
> From: yalin wang <yalin.wang2010@gmail.com>
> 
> 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@gmail.com>

You are right, thanks for catching this. But please leave the
generic_device_group function in iommu.c. It is assigned to a function
pointer by drivers, so inlining it doesn't make sense anyway.


	Joerg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-05 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 12:06 [PATCH] iommu: change generic_device_group function cn_wyl2003
     [not found] ` <1458907611-19694-1-git-send-email-cn_wyl2003-KN7UnAbNpbg@public.gmane.org>
2016-04-05 15:04   ` Joerg Roedel
2016-04-05 15:04     ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.