include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / arm / plat-omap / iommu.c
index 4b60127..0e13766 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * omap iommu: tlb and pagetable primitives
  *
- * Copyright (C) 2008-2009 Nokia Corporation
+ * Copyright (C) 2008-2010 Nokia Corporation
  *
  * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
  *             Paul Mundt and Toshihiro Kobayashi
@@ -13,6 +13,7 @@
 
 #include <linux/err.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/clk.h>
@@ -20,7 +21,7 @@
 
 #include <asm/cacheflush.h>
 
-#include <mach/iommu.h>
+#include <plat/iommu.h>
 
 #include "iopgtable.h"
 
@@ -646,7 +647,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
                if (*iopte & IOPTE_LARGE) {
                        nent *= 16;
                        /* rewind to the 1st entry */
-                       iopte = (u32 *)((u32)iopte & IOLARGE_MASK);
+                       iopte = iopte_offset(iopgd, (da & IOLARGE_MASK));
                }
                bytes *= nent;
                memset(iopte, 0, nent * sizeof(*iopte));
@@ -664,10 +665,10 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
                nent = 1; /* for the next L1 entry */
        } else {
                bytes = IOPGD_SIZE;
-               if (*iopgd & IOPGD_SUPER) {
+               if ((*iopgd & IOPGD_SUPER) == IOPGD_SUPER) {
                        nent *= 16;
                        /* rewind to the 1st entry */
-                       iopgd = (u32 *)((u32)iopgd & IOSUPER_MASK);
+                       iopgd = iopgd_offset(obj, (da & IOSUPER_MASK));
                }
                bytes *= nent;
        }
@@ -827,7 +828,7 @@ EXPORT_SYMBOL_GPL(iommu_get);
  **/
 void iommu_put(struct iommu *obj)
 {
-       if (!obj && IS_ERR(obj))
+       if (!obj || IS_ERR(obj))
                return;
 
        mutex_lock(&obj->iommu_lock);