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