]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sh/mm/pmb.c
sh: fix seq_file memory leak
[linux-2.6-omap-h63xx.git] / arch / sh / mm / pmb.c
index 1d45b82f0a638e12ef1afb939feafc2a39b95612..cef727669c8759dde6ce20ceb9ecc138d71a28bb 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
 #include <asm/io.h>
+#include <asm/mmu_context.h>
 
 #define NR_PMB_ENTRIES 16
 
@@ -162,18 +163,18 @@ repeat:
        return 0;
 }
 
-int set_pmb_entry(struct pmb_entry *pmbe)
+int __uses_jump_to_uncached set_pmb_entry(struct pmb_entry *pmbe)
 {
        int ret;
 
-       jump_to_P2();
+       jump_to_uncached();
        ret = __set_pmb_entry(pmbe->vpn, pmbe->ppn, pmbe->flags, &pmbe->entry);
-       back_to_P1();
+       back_to_cached();
 
        return ret;
 }
 
-void clear_pmb_entry(struct pmb_entry *pmbe)
+void __uses_jump_to_uncached clear_pmb_entry(struct pmb_entry *pmbe)
 {
        unsigned int entry = pmbe->entry;
        unsigned long addr;
@@ -187,7 +188,7 @@ void clear_pmb_entry(struct pmb_entry *pmbe)
                     entry >= NR_PMB_ENTRIES))
                return;
 
-       jump_to_P2();
+       jump_to_uncached();
 
        /* Clear V-bit */
        addr = mk_pmb_addr(entry);
@@ -196,7 +197,7 @@ void clear_pmb_entry(struct pmb_entry *pmbe)
        addr = mk_pmb_data(entry);
        ctrl_outl(ctrl_inl(addr) & ~PMB_V, addr);
 
-       back_to_P1();
+       back_to_cached();
 
        clear_bit(entry, &pmb_map);
 }
@@ -292,7 +293,7 @@ void pmb_unmap(unsigned long addr)
        } while (pmbe);
 }
 
-static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
+static void pmb_cache_ctor(void *pmb)
 {
        struct pmb_entry *pmbe = pmb;
 
@@ -301,17 +302,17 @@ static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
        pmbe->entry = PMB_NO_ENTRY;
 }
 
-static int __init pmb_init(void)
+static int __uses_jump_to_uncached pmb_init(void)
 {
        unsigned int nr_entries = ARRAY_SIZE(pmb_init_map);
-       unsigned int entry;
+       unsigned int entry, i;
 
        BUG_ON(unlikely(nr_entries >= NR_PMB_ENTRIES));
 
        pmb_cache = kmem_cache_create("pmb", sizeof(struct pmb_entry), 0,
                                      SLAB_PANIC, pmb_cache_ctor);
 
-       jump_to_P2();
+       jump_to_uncached();
 
        /*
         * Ordering is important, P2 must be mapped in the PMB before we
@@ -329,7 +330,12 @@ static int __init pmb_init(void)
        /* PMB.SE and UB[7] */
        ctrl_outl((1 << 31) | (1 << 7), PMB_PASCR);
 
-       back_to_P1();
+       /* Flush out the TLB */
+       i =  ctrl_inl(MMUCR);
+       i |= MMUCR_TI;
+       ctrl_outl(i, MMUCR);
+
+       back_to_cached();
 
        return 0;
 }
@@ -379,7 +385,7 @@ static const struct file_operations pmb_debugfs_fops = {
        .open           = pmb_debugfs_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 static int __init pmb_debugfs_init(void)
@@ -387,7 +393,7 @@ static int __init pmb_debugfs_init(void)
        struct dentry *dentry;
 
        dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
-                                    NULL, NULL, &pmb_debugfs_fops);
+                                    sh_debugfs_root, NULL, &pmb_debugfs_fops);
        if (IS_ERR(dentry))
                return PTR_ERR(dentry);