diff options
author | Denis V. Lunev <den@openvz.org> | 2008-05-02 16:34:05 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-05-05 02:47:14 -0400 |
commit | 9185ef6787f1c8f1c06aa0cb3c7746fb4f101f50 (patch) | |
tree | 02c8dd5bd96606d752af795d4903ab76bef80da1 /arch/powerpc/platforms/pseries/scanlog.c | |
parent | b41e5fffe8b81fc939067d8c1c195cc79115d5a3 (diff) |
[POWERPC] Assign PDE->data before gluing PDE into /proc tree
Simply replace proc_create and further data assigned with proc_create_data.
No need to check for data!=NULL after that.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/pseries/scanlog.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/scanlog.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index bec3803f0618..417eca79df69 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -55,11 +55,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf, | |||
55 | dp = PDE(inode); | 55 | dp = PDE(inode); |
56 | data = (unsigned int *)dp->data; | 56 | data = (unsigned int *)dp->data; |
57 | 57 | ||
58 | if (!data) { | ||
59 | printk(KERN_ERR "scanlog: read failed no data\n"); | ||
60 | return -EIO; | ||
61 | } | ||
62 | |||
63 | if (count > RTAS_DATA_BUF_SIZE) | 58 | if (count > RTAS_DATA_BUF_SIZE) |
64 | count = RTAS_DATA_BUF_SIZE; | 59 | count = RTAS_DATA_BUF_SIZE; |
65 | 60 | ||
@@ -146,11 +141,6 @@ static int scanlog_open(struct inode * inode, struct file * file) | |||
146 | struct proc_dir_entry *dp = PDE(inode); | 141 | struct proc_dir_entry *dp = PDE(inode); |
147 | unsigned int *data = (unsigned int *)dp->data; | 142 | unsigned int *data = (unsigned int *)dp->data; |
148 | 143 | ||
149 | if (!data) { | ||
150 | printk(KERN_ERR "scanlog: open failed no data\n"); | ||
151 | return -EIO; | ||
152 | } | ||
153 | |||
154 | if (data[0] != 0) { | 144 | if (data[0] != 0) { |
155 | /* This imperfect test stops a second copy of the | 145 | /* This imperfect test stops a second copy of the |
156 | * data (or a reset while data is being copied) | 146 | * data (or a reset while data is being copied) |
@@ -168,10 +158,6 @@ static int scanlog_release(struct inode * inode, struct file * file) | |||
168 | struct proc_dir_entry *dp = PDE(inode); | 158 | struct proc_dir_entry *dp = PDE(inode); |
169 | unsigned int *data = (unsigned int *)dp->data; | 159 | unsigned int *data = (unsigned int *)dp->data; |
170 | 160 | ||
171 | if (!data) { | ||
172 | printk(KERN_ERR "scanlog: release failed no data\n"); | ||
173 | return -EIO; | ||
174 | } | ||
175 | data[0] = 0; | 161 | data[0] = 0; |
176 | 162 | ||
177 | return 0; | 163 | return 0; |
@@ -200,12 +186,11 @@ static int __init scanlog_init(void) | |||
200 | if (!data) | 186 | if (!data) |
201 | goto err; | 187 | goto err; |
202 | 188 | ||
203 | ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, | 189 | ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, |
204 | &scanlog_fops); | 190 | &scanlog_fops, data); |
205 | if (!ent) | 191 | if (!ent) |
206 | goto err; | 192 | goto err; |
207 | 193 | ||
208 | ent->data = data; | ||
209 | proc_ppc64_scan_log_dump = ent; | 194 | proc_ppc64_scan_log_dump = ent; |
210 | 195 | ||
211 | return 0; | 196 | return 0; |