aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/kernel/cplbinfo.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c
index 26d181943001..0bdaa517a501 100644
--- a/arch/blackfin/kernel/cplbinfo.c
+++ b/arch/blackfin/kernel/cplbinfo.c
@@ -112,24 +112,21 @@ static const struct seq_operations cplbinfo_sops = {
112 .show = cplbinfo_show, 112 .show = cplbinfo_show,
113}; 113};
114 114
115#define CPLBINFO_DCPLB_FLAG 0x80000000
116
115static int cplbinfo_open(struct inode *inode, struct file *file) 117static int cplbinfo_open(struct inode *inode, struct file *file)
116{ 118{
117 char buf[256], *path, *p; 119 struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
120 char cplb_type;
118 unsigned int cpu; 121 unsigned int cpu;
119 char *s_cpu, *s_cplb;
120 int ret; 122 int ret;
121 struct seq_file *m; 123 struct seq_file *m;
122 struct cplbinfo_data *cdata; 124 struct cplbinfo_data *cdata;
123 125
124 path = d_path(&file->f_path, buf, sizeof(buf)); 126 cpu = (unsigned int)pde->data;
125 if (IS_ERR(path)) 127 cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I';
126 return PTR_ERR(path); 128 cpu &= ~CPLBINFO_DCPLB_FLAG;
127 s_cpu = strstr(path, "/cpu");
128 s_cplb = strrchr(path, '/');
129 if (!s_cpu || !s_cplb)
130 return -EINVAL;
131 129
132 cpu = simple_strtoul(s_cpu + 4, &p, 10);
133 if (!cpu_online(cpu)) 130 if (!cpu_online(cpu))
134 return -ENODEV; 131 return -ENODEV;
135 132
@@ -140,7 +137,7 @@ static int cplbinfo_open(struct inode *inode, struct file *file)
140 cdata = m->private; 137 cdata = m->private;
141 138
142 cdata->pos = 0; 139 cdata->pos = 0;
143 cdata->cplb_type = toupper(s_cplb[1]); 140 cdata->cplb_type = cplb_type;
144 cplbinfo_seq_init(cdata, cpu); 141 cplbinfo_seq_init(cdata, cpu);
145 142
146 return 0; 143 return 0;
@@ -169,8 +166,10 @@ static int __init cplbinfo_init(void)
169 if (!cpu_dir) 166 if (!cpu_dir)
170 return -ENOMEM; 167 return -ENOMEM;
171 168
172 proc_create("icplb", S_IRUGO, cpu_dir, &cplbinfo_fops); 169 proc_create_data("icplb", S_IRUGO, cpu_dir, &cplbinfo_fops,
173 proc_create("dcplb", S_IRUGO, cpu_dir, &cplbinfo_fops); 170 (void *)cpu);
171 proc_create_data("dcplb", S_IRUGO, cpu_dir, &cplbinfo_fops,
172 (void *)(cpu | CPLBINFO_DCPLB_FLAG));
174 } 173 }
175 174
176 return 0; 175 return 0;