ChangeSet 1.2231.1.31, 2005/03/28 19:24:56-08:00, [EMAIL PROTECTED]

        [PATCH] ppc64: pSeries_iommu.c: use pSeries reconfig notifier
        
        Use the pSeries_reconfig notifier chain for tearing down the iommu 
table when
        a device node is removed.
        
        Signed-off-by: Nathan Lynch <[EMAIL PROTECTED]>
        Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 pSeries_iommu.c    |   25 +++++++++++++++++++++++++
 pSeries_reconfig.c |   12 ------------
 2 files changed, 25 insertions(+), 12 deletions(-)


diff -Nru a/arch/ppc64/kernel/pSeries_iommu.c 
b/arch/ppc64/kernel/pSeries_iommu.c
--- a/arch/ppc64/kernel/pSeries_iommu.c 2005-03-28 21:13:11 -08:00
+++ b/arch/ppc64/kernel/pSeries_iommu.c 2005-03-28 21:13:11 -08:00
@@ -43,6 +43,7 @@
 #include <asm/machdep.h>
 #include <asm/abs_addr.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/pSeries_reconfig.h>
 #include <asm/systemcfg.h>
 #include "pci.h"
 
@@ -455,6 +456,28 @@
        }
 }
 
+static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long 
action, void *node)
+{
+       int err = NOTIFY_OK;
+       struct device_node *np = node;
+
+       switch (action) {
+       case PSERIES_RECONFIG_REMOVE:
+               if (np->iommu_table &&
+                   get_property(np, "ibm,dma-window", NULL))
+                       iommu_free_table(np);
+               break;
+       default:
+               err = NOTIFY_DONE;
+               break;
+       }
+       return err;
+}
+
+static struct notifier_block iommu_reconfig_nb = {
+       .notifier_call = iommu_reconfig_notifier,
+};
+
 static void iommu_bus_setup_null(struct pci_bus *b) { }
 static void iommu_dev_setup_null(struct pci_dev *d) { }
 
@@ -486,6 +509,8 @@
        }
 
        ppc_md.iommu_dev_setup = iommu_dev_setup_pSeries;
+
+       pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
 
        pci_iommu_init();
 }
diff -Nru a/arch/ppc64/kernel/pSeries_reconfig.c 
b/arch/ppc64/kernel/pSeries_reconfig.c
--- a/arch/ppc64/kernel/pSeries_reconfig.c      2005-03-28 21:13:11 -08:00
+++ b/arch/ppc64/kernel/pSeries_reconfig.c      2005-03-28 21:13:11 -08:00
@@ -164,16 +164,6 @@
        return err;
 }
 
-/*
- * Prepare an OF node for removal from system
- * XXX move this to pSeries_iommu.c
- */
-static void of_cleanup_node(struct device_node *np)
-{
-       if (np->iommu_table && get_property(np, "ibm,dma-window", NULL))
-               iommu_free_table(np);
-}
-
 static int pSeries_reconfig_remove_node(struct device_node *np)
 {
        struct device_node *parent, *child;
@@ -186,8 +176,6 @@
                of_node_put(child);
                return -EBUSY;
        }
-
-       of_cleanup_node(np);
 
        remove_node_proc_entries(np);
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to