sh: Merge the legacy PMB mapping and entry synchronization code.
[safe/jmp/linux-2.6] / arch / sh / mm / cache-debugfs.c
index a22d914..690ed01 100644 (file)
@@ -34,11 +34,11 @@ static int cache_seq_show(struct seq_file *file, void *iter)
         * Go uncached immediately so we don't skew the results any
         * more than we already are..
         */
-       jump_to_P2();
+       jump_to_uncached();
 
-       ccr = ctrl_inl(CCR);
+       ccr = __raw_readl(CCR);
        if ((ccr & CCR_CACHE_ENABLE) == 0) {
-               back_to_P1();
+               back_to_cached();
 
                seq_printf(file, "disabled\n");
                return 0;
@@ -46,10 +46,10 @@ static int cache_seq_show(struct seq_file *file, void *iter)
 
        if (cache_type == CACHE_TYPE_DCACHE) {
                base = CACHE_OC_ADDRESS_ARRAY;
-               cache = &cpu_data->dcache;
+               cache = &current_cpu_data.dcache;
        } else {
                base = CACHE_IC_ADDRESS_ARRAY;
-               cache = &cpu_data->icache;
+               cache = &current_cpu_data.icache;
        }
 
        /*
@@ -89,7 +89,7 @@ static int cache_seq_show(struct seq_file *file, void *iter)
                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)
@@ -104,37 +104,43 @@ static int cache_seq_show(struct seq_file *file, void *iter)
                addrstart += cache->way_incr;
        }
 
-       back_to_P1();
+       back_to_cached();
 
        return 0;
 }
 
 static int cache_debugfs_open(struct inode *inode, struct file *file)
 {
-       return single_open(file, cache_seq_show, inode->u.generic_ip);
+       return single_open(file, cache_seq_show, inode->i_private);
 }
 
-static struct file_operations cache_debugfs_fops = {
+static const struct file_operations cache_debugfs_fops = {
        .owner          = THIS_MODULE,
        .open           = cache_debugfs_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 static int __init cache_debugfs_init(void)
 {
        struct dentry *dcache_dentry, *icache_dentry;
 
-       dcache_dentry = debugfs_create_file("dcache", S_IRUSR, NULL,
+       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, NULL,
+       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);