sh: Merge the legacy PMB mapping and entry synchronization code.
[safe/jmp/linux-2.6] / arch / sh / mm / cache-debugfs.c
index c5b56d5..690ed01 100644 (file)
@@ -22,8 +22,7 @@ enum cache_type {
        CACHE_TYPE_UNIFIED,
 };
 
-static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
-                                                 void *iter)
+static int cache_seq_show(struct seq_file *file, void *iter)
 {
        unsigned int cache_type = (unsigned int)file->private;
        struct cache_info *cache;
@@ -37,7 +36,7 @@ static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
         */
        jump_to_uncached();
 
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
        if ((ccr & CCR_CACHE_ENABLE) == 0) {
                back_to_cached();
 
@@ -90,7 +89,7 @@ static int __uses_jump_to_uncached cache_seq_show(struct seq_file *file,
                for (addr = addrstart, line = 0;
                     addr < addrstart + waysize;
                     addr += cache->linesz, line++) {
-                       unsigned long data = ctrl_inl(addr);
+                       unsigned long data = __raw_readl(addr);
 
                        /* Check the V bit, ignore invalid cachelines */
                        if ((data & 1) == 0)
@@ -120,7 +119,7 @@ static const struct file_operations cache_debugfs_fops = {
        .open           = cache_debugfs_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 static int __init cache_debugfs_init(void)
@@ -130,12 +129,18 @@ static int __init cache_debugfs_init(void)
        dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root,
                                            (unsigned int *)CACHE_TYPE_DCACHE,
                                            &cache_debugfs_fops);
+       if (!dcache_dentry)
+               return -ENOMEM;
        if (IS_ERR(dcache_dentry))
                return PTR_ERR(dcache_dentry);
 
        icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root,
                                            (unsigned int *)CACHE_TYPE_ICACHE,
                                            &cache_debugfs_fops);
+       if (!icache_dentry) {
+               debugfs_remove(dcache_dentry);
+               return -ENOMEM;
+       }
        if (IS_ERR(icache_dentry)) {
                debugfs_remove(dcache_dentry);
                return PTR_ERR(icache_dentry);