From eb8437884637c44ffb3f635afb407320ca2455cb Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Sep 2009 16:12:05 +0000 Subject: [PATCH] --- yaml --- r: 167189 b: refs/heads/master c: 48dee09325fbc5ffb9d4a780e765538c0e9cc794 h: refs/heads/master i: 167187: cc150934468735952d01ab29e41434f242ff5846 v: v3 --- [refs] | 2 +- trunk/arch/blackfin/kernel/cplbinfo.c | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index bfd1c7b0ac1f..e0b16184e42b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d586e833f970dfb4768e6c872b621f4cfc555267 +refs/heads/master: 48dee09325fbc5ffb9d4a780e765538c0e9cc794 diff --git a/trunk/arch/blackfin/kernel/cplbinfo.c b/trunk/arch/blackfin/kernel/cplbinfo.c index 26d181943001..0bdaa517a501 100644 --- a/trunk/arch/blackfin/kernel/cplbinfo.c +++ b/trunk/arch/blackfin/kernel/cplbinfo.c @@ -112,24 +112,21 @@ static const struct seq_operations cplbinfo_sops = { .show = cplbinfo_show, }; +#define CPLBINFO_DCPLB_FLAG 0x80000000 + static int cplbinfo_open(struct inode *inode, struct file *file) { - char buf[256], *path, *p; + struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); + char cplb_type; unsigned int cpu; - char *s_cpu, *s_cplb; int ret; struct seq_file *m; struct cplbinfo_data *cdata; - path = d_path(&file->f_path, buf, sizeof(buf)); - if (IS_ERR(path)) - return PTR_ERR(path); - s_cpu = strstr(path, "/cpu"); - s_cplb = strrchr(path, '/'); - if (!s_cpu || !s_cplb) - return -EINVAL; + cpu = (unsigned int)pde->data; + cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I'; + cpu &= ~CPLBINFO_DCPLB_FLAG; - cpu = simple_strtoul(s_cpu + 4, &p, 10); if (!cpu_online(cpu)) return -ENODEV; @@ -140,7 +137,7 @@ static int cplbinfo_open(struct inode *inode, struct file *file) cdata = m->private; cdata->pos = 0; - cdata->cplb_type = toupper(s_cplb[1]); + cdata->cplb_type = cplb_type; cplbinfo_seq_init(cdata, cpu); return 0; @@ -169,8 +166,10 @@ static int __init cplbinfo_init(void) if (!cpu_dir) return -ENOMEM; - proc_create("icplb", S_IRUGO, cpu_dir, &cplbinfo_fops); - proc_create("dcplb", S_IRUGO, cpu_dir, &cplbinfo_fops); + proc_create_data("icplb", S_IRUGO, cpu_dir, &cplbinfo_fops, + (void *)cpu); + proc_create_data("dcplb", S_IRUGO, cpu_dir, &cplbinfo_fops, + (void *)(cpu | CPLBINFO_DCPLB_FLAG)); } return 0;