Thread (4 messages) flat view 4 messages, 2 authors, 2014-08-11

Re: [PATCH 2/2] powerpc/powernv: Remove duplicate check in tce_iommu_bus_notifier()

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2014-08-11 03:12:06

On Wed, 2014-08-06 at 17:10 +1000, Gavin Shan wrote:
The called function iommu_del_device() checks if the device has
attached IOMMU group, we needn't check it again in the parent
function call tce_iommu_bus_notifier().
The patch does more than that... it also refactors the function, which
it should either not do or document.
quoted hunk ↗ jump to hunk
Signed-off-by: Gavin Shan <redacted>
---
 arch/powerpc/platforms/powernv/pci.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index f91a4e5..b562b0d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -820,17 +820,18 @@ static int tce_iommu_bus_notifier(struct notifier_block *nb,
 		unsigned long action, void *data)
 {
 	struct device *dev = data;
+	int ret = 0;
 
 	switch (action) {
 	case BUS_NOTIFY_ADD_DEVICE:
-		return iommu_add_device(dev);
+		ret = iommu_add_device(dev);
+		break;
 	case BUS_NOTIFY_DEL_DEVICE:
-		if (dev->iommu_group)
-			iommu_del_device(dev);
-		return 0;
-	default:
-		return 0;
+		iommu_del_device(dev);
+		break;
 	}
+
+	return ret;
 }
 
 static struct notifier_block tce_iommu_bus_nb = {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help