aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/elf.h2
-rw-r--r--arch/powerpc/kernel/proc_powerpc.c6
-rw-r--r--arch/powerpc/kernel/rtas_flash.c16
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c66
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c2
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c8
9 files changed, 42 insertions, 70 deletions
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 6abf0a163233..ac9790fc3836 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -103,8 +103,6 @@ do { \
103# define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \ 103# define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \
104 (exec_stk == EXSTACK_DEFAULT) : 0) 104 (exec_stk == EXSTACK_DEFAULT) : 0)
105#else 105#else
106# define SET_PERSONALITY(ex) \
107 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
108# define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT) 106# define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT)
109#endif /* __powerpc64__ */ 107#endif /* __powerpc64__ */
110 108
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
index c8ae3714e79b..f19d0bdc3241 100644
--- a/arch/powerpc/kernel/proc_powerpc.c
+++ b/arch/powerpc/kernel/proc_powerpc.c
@@ -32,7 +32,7 @@
32static loff_t page_map_seek( struct file *file, loff_t off, int whence) 32static loff_t page_map_seek( struct file *file, loff_t off, int whence)
33{ 33{
34 loff_t new; 34 loff_t new;
35 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 35 struct proc_dir_entry *dp = PDE(file_inode(file));
36 36
37 switch(whence) { 37 switch(whence) {
38 case 0: 38 case 0:
@@ -55,13 +55,13 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
55static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, 55static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
56 loff_t *ppos) 56 loff_t *ppos)
57{ 57{
58 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 58 struct proc_dir_entry *dp = PDE(file_inode(file));
59 return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); 59 return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size);
60} 60}
61 61
62static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) 62static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
63{ 63{
64 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 64 struct proc_dir_entry *dp = PDE(file_inode(file));
65 65
66 if ((vma->vm_end - vma->vm_start) > dp->size) 66 if ((vma->vm_end - vma->vm_start) > dp->size)
67 return -EINVAL; 67 return -EINVAL;
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 8329190312c1..c642f0132988 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -191,7 +191,7 @@ static void free_flash_list(struct flash_block_list *f)
191 191
192static int rtas_flash_release(struct inode *inode, struct file *file) 192static int rtas_flash_release(struct inode *inode, struct file *file)
193{ 193{
194 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 194 struct proc_dir_entry *dp = PDE(file_inode(file));
195 struct rtas_update_flash_t *uf; 195 struct rtas_update_flash_t *uf;
196 196
197 uf = (struct rtas_update_flash_t *) dp->data; 197 uf = (struct rtas_update_flash_t *) dp->data;
@@ -253,7 +253,7 @@ static void get_flash_status_msg(int status, char *buf)
253static ssize_t rtas_flash_read(struct file *file, char __user *buf, 253static ssize_t rtas_flash_read(struct file *file, char __user *buf,
254 size_t count, loff_t *ppos) 254 size_t count, loff_t *ppos)
255{ 255{
256 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 256 struct proc_dir_entry *dp = PDE(file_inode(file));
257 struct rtas_update_flash_t *uf; 257 struct rtas_update_flash_t *uf;
258 char msg[RTAS_MSG_MAXLEN]; 258 char msg[RTAS_MSG_MAXLEN];
259 259
@@ -282,7 +282,7 @@ void rtas_block_ctor(void *ptr)
282static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, 282static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
283 size_t count, loff_t *off) 283 size_t count, loff_t *off)
284{ 284{
285 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 285 struct proc_dir_entry *dp = PDE(file_inode(file));
286 struct rtas_update_flash_t *uf; 286 struct rtas_update_flash_t *uf;
287 char *p; 287 char *p;
288 int next_free; 288 int next_free;
@@ -374,7 +374,7 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf)
374static ssize_t manage_flash_read(struct file *file, char __user *buf, 374static ssize_t manage_flash_read(struct file *file, char __user *buf,
375 size_t count, loff_t *ppos) 375 size_t count, loff_t *ppos)
376{ 376{
377 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 377 struct proc_dir_entry *dp = PDE(file_inode(file));
378 struct rtas_manage_flash_t *args_buf; 378 struct rtas_manage_flash_t *args_buf;
379 char msg[RTAS_MSG_MAXLEN]; 379 char msg[RTAS_MSG_MAXLEN];
380 int msglen; 380 int msglen;
@@ -391,7 +391,7 @@ static ssize_t manage_flash_read(struct file *file, char __user *buf,
391static ssize_t manage_flash_write(struct file *file, const char __user *buf, 391static ssize_t manage_flash_write(struct file *file, const char __user *buf,
392 size_t count, loff_t *off) 392 size_t count, loff_t *off)
393{ 393{
394 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 394 struct proc_dir_entry *dp = PDE(file_inode(file));
395 struct rtas_manage_flash_t *args_buf; 395 struct rtas_manage_flash_t *args_buf;
396 const char reject_str[] = "0"; 396 const char reject_str[] = "0";
397 const char commit_str[] = "1"; 397 const char commit_str[] = "1";
@@ -462,7 +462,7 @@ static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf,
462static ssize_t validate_flash_read(struct file *file, char __user *buf, 462static ssize_t validate_flash_read(struct file *file, char __user *buf,
463 size_t count, loff_t *ppos) 463 size_t count, loff_t *ppos)
464{ 464{
465 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 465 struct proc_dir_entry *dp = PDE(file_inode(file));
466 struct rtas_validate_flash_t *args_buf; 466 struct rtas_validate_flash_t *args_buf;
467 char msg[RTAS_MSG_MAXLEN]; 467 char msg[RTAS_MSG_MAXLEN];
468 int msglen; 468 int msglen;
@@ -477,7 +477,7 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
477static ssize_t validate_flash_write(struct file *file, const char __user *buf, 477static ssize_t validate_flash_write(struct file *file, const char __user *buf,
478 size_t count, loff_t *off) 478 size_t count, loff_t *off)
479{ 479{
480 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 480 struct proc_dir_entry *dp = PDE(file_inode(file));
481 struct rtas_validate_flash_t *args_buf; 481 struct rtas_validate_flash_t *args_buf;
482 int rc; 482 int rc;
483 483
@@ -526,7 +526,7 @@ done:
526 526
527static int validate_flash_release(struct inode *inode, struct file *file) 527static int validate_flash_release(struct inode *inode, struct file *file)
528{ 528{
529 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 529 struct proc_dir_entry *dp = PDE(file_inode(file));
530 struct rtas_validate_flash_t *args_buf; 530 struct rtas_validate_flash_t *args_buf;
531 531
532 args_buf = (struct rtas_validate_flash_t *) dp->data; 532 args_buf = (struct rtas_validate_flash_t *) dp->data;
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 657e3f233a64..c9500ea7be2f 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -111,7 +111,7 @@ static int match_context(const void *v, struct file *file, unsigned fd)
111 struct spu_context *ctx; 111 struct spu_context *ctx;
112 if (file->f_op != &spufs_context_fops) 112 if (file->f_op != &spufs_context_fops)
113 return 0; 113 return 0;
114 ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; 114 ctx = SPUFS_I(file_inode(file))->i_ctx;
115 if (ctx->flags & SPU_CREATE_NOSCHED) 115 if (ctx->flags & SPU_CREATE_NOSCHED)
116 return 0; 116 return 0;
117 return fd + 1; 117 return fd + 1;
@@ -137,7 +137,7 @@ static struct spu_context *coredump_next_context(int *fd)
137 return NULL; 137 return NULL;
138 *fd = n - 1; 138 *fd = n - 1;
139 file = fcheck(*fd); 139 file = fcheck(*fd);
140 return SPUFS_I(file->f_dentry->d_inode)->i_ctx; 140 return SPUFS_I(file_inode(file))->i_ctx;
141} 141}
142 142
143int spufs_coredump_extra_notes_size(void) 143int spufs_coredump_extra_notes_size(void)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 0cfece4cf6ef..68c57d38745a 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1852,7 +1852,7 @@ out:
1852 1852
1853static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync) 1853static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1854{ 1854{
1855 struct inode *inode = file->f_path.dentry->d_inode; 1855 struct inode *inode = file_inode(file);
1856 int err = filemap_write_and_wait_range(inode->i_mapping, start, end); 1856 int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
1857 if (!err) { 1857 if (!err) {
1858 mutex_lock(&inode->i_mutex); 1858 mutex_lock(&inode->i_mutex);
@@ -2501,7 +2501,7 @@ static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n)
2501static ssize_t spufs_switch_log_read(struct file *file, char __user *buf, 2501static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2502 size_t len, loff_t *ppos) 2502 size_t len, loff_t *ppos)
2503{ 2503{
2504 struct inode *inode = file->f_path.dentry->d_inode; 2504 struct inode *inode = file_inode(file);
2505 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2505 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2506 int error = 0, cnt = 0; 2506 int error = 0, cnt = 0;
2507 2507
@@ -2571,7 +2571,7 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2571 2571
2572static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) 2572static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
2573{ 2573{
2574 struct inode *inode = file->f_path.dentry->d_inode; 2574 struct inode *inode = file_inode(file);
2575 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2575 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2576 unsigned int mask = 0; 2576 unsigned int mask = 0;
2577 int rc; 2577 int rc;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index dba1ce235da5..863184b182f4 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -199,37 +199,18 @@ static int spufs_fill_dir(struct dentry *dir,
199 const struct spufs_tree_descr *files, umode_t mode, 199 const struct spufs_tree_descr *files, umode_t mode,
200 struct spu_context *ctx) 200 struct spu_context *ctx)
201{ 201{
202 struct dentry *dentry, *tmp;
203 int ret;
204
205 while (files->name && files->name[0]) { 202 while (files->name && files->name[0]) {
206 ret = -ENOMEM; 203 int ret;
207 dentry = d_alloc_name(dir, files->name); 204 struct dentry *dentry = d_alloc_name(dir, files->name);
208 if (!dentry) 205 if (!dentry)
209 goto out; 206 return -ENOMEM;
210 ret = spufs_new_file(dir->d_sb, dentry, files->ops, 207 ret = spufs_new_file(dir->d_sb, dentry, files->ops,
211 files->mode & mode, files->size, ctx); 208 files->mode & mode, files->size, ctx);
212 if (ret) 209 if (ret)
213 goto out; 210 return ret;
214 files++; 211 files++;
215 } 212 }
216 return 0; 213 return 0;
217out:
218 /*
219 * remove all children from dir. dir->inode is not set so don't
220 * just simply use spufs_prune_dir() and panic afterwards :)
221 * dput() looks like it will do the right thing:
222 * - dec parent's ref counter
223 * - remove child from parent's child list
224 * - free child's inode if possible
225 * - free child
226 */
227 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
228 dput(dentry);
229 }
230
231 shrink_dcache_parent(dir);
232 return ret;
233} 214}
234 215
235static int spufs_dir_close(struct inode *inode, struct file *file) 216static int spufs_dir_close(struct inode *inode, struct file *file)
@@ -269,10 +250,9 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
269 struct inode *inode; 250 struct inode *inode;
270 struct spu_context *ctx; 251 struct spu_context *ctx;
271 252
272 ret = -ENOSPC;
273 inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR); 253 inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);
274 if (!inode) 254 if (!inode)
275 goto out; 255 return -ENOSPC;
276 256
277 if (dir->i_mode & S_ISGID) { 257 if (dir->i_mode & S_ISGID) {
278 inode->i_gid = dir->i_gid; 258 inode->i_gid = dir->i_gid;
@@ -280,40 +260,38 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
280 } 260 }
281 ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */ 261 ctx = alloc_spu_context(SPUFS_I(dir)->i_gang); /* XXX gang */
282 SPUFS_I(inode)->i_ctx = ctx; 262 SPUFS_I(inode)->i_ctx = ctx;
283 if (!ctx) 263 if (!ctx) {
284 goto out_iput; 264 iput(inode);
265 return -ENOSPC;
266 }
285 267
286 ctx->flags = flags; 268 ctx->flags = flags;
287 inode->i_op = &simple_dir_inode_operations; 269 inode->i_op = &simple_dir_inode_operations;
288 inode->i_fop = &simple_dir_operations; 270 inode->i_fop = &simple_dir_operations;
271
272 mutex_lock(&inode->i_mutex);
273
274 dget(dentry);
275 inc_nlink(dir);
276 inc_nlink(inode);
277
278 d_instantiate(dentry, inode);
279
289 if (flags & SPU_CREATE_NOSCHED) 280 if (flags & SPU_CREATE_NOSCHED)
290 ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents, 281 ret = spufs_fill_dir(dentry, spufs_dir_nosched_contents,
291 mode, ctx); 282 mode, ctx);
292 else 283 else
293 ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx); 284 ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx);
294 285
295 if (ret) 286 if (!ret && spufs_get_sb_info(dir->i_sb)->debug)
296 goto out_free_ctx;
297
298 if (spufs_get_sb_info(dir->i_sb)->debug)
299 ret = spufs_fill_dir(dentry, spufs_dir_debug_contents, 287 ret = spufs_fill_dir(dentry, spufs_dir_debug_contents,
300 mode, ctx); 288 mode, ctx);
301 289
302 if (ret) 290 if (ret)
303 goto out_free_ctx; 291 spufs_rmdir(dir, dentry);
304 292
305 d_instantiate(dentry, inode); 293 mutex_unlock(&inode->i_mutex);
306 dget(dentry);
307 inc_nlink(dir);
308 inc_nlink(dentry->d_inode);
309 goto out;
310 294
311out_free_ctx:
312 spu_forget(ctx);
313 put_spu_context(ctx);
314out_iput:
315 iput(inode);
316out:
317 return ret; 295 return ret;
318} 296}
319 297
@@ -368,7 +346,7 @@ spufs_assert_affinity(unsigned int flags, struct spu_gang *gang,
368 return ERR_PTR(-EINVAL); 346 return ERR_PTR(-EINVAL);
369 347
370 neighbor = get_spu_context( 348 neighbor = get_spu_context(
371 SPUFS_I(filp->f_dentry->d_inode)->i_ctx); 349 SPUFS_I(file_inode(filp))->i_ctx);
372 350
373 if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) && 351 if (!list_empty(&neighbor->aff_list) && !(neighbor->aff_head) &&
374 !list_is_last(&neighbor->aff_list, &gang->aff_list_head) && 352 !list_is_last(&neighbor->aff_list, &gang->aff_list_head) &&
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index baee994fe810..b045fdda4845 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -47,7 +47,7 @@ static long do_spu_run(struct file *filp,
47 if (filp->f_op != &spufs_context_fops) 47 if (filp->f_op != &spufs_context_fops)
48 goto out; 48 goto out;
49 49
50 i = SPUFS_I(filp->f_path.dentry->d_inode); 50 i = SPUFS_I(file_inode(filp));
51 ret = spufs_run_spu(i->i_ctx, &npc, &status); 51 ret = spufs_run_spu(i->i_ctx, &npc, &status);
52 52
53 if (put_user(npc, unpc)) 53 if (put_user(npc, unpc))
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index c9311cfdfcac..cf4e7736e4f1 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -86,7 +86,7 @@ static int hcall_inst_seq_open(struct inode *inode, struct file *file)
86 86
87 rc = seq_open(file, &hcall_inst_seq_ops); 87 rc = seq_open(file, &hcall_inst_seq_ops);
88 seq = file->private_data; 88 seq = file->private_data;
89 seq->private = file->f_path.dentry->d_inode->i_private; 89 seq->private = file_inode(file)->i_private;
90 90
91 return rc; 91 return rc;
92} 92}
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 554457294a2b..47f3cda2a68b 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -46,16 +46,12 @@ static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */
46static ssize_t scanlog_read(struct file *file, char __user *buf, 46static ssize_t scanlog_read(struct file *file, char __user *buf,
47 size_t count, loff_t *ppos) 47 size_t count, loff_t *ppos)
48{ 48{
49 struct inode * inode = file->f_path.dentry->d_inode; 49 struct proc_dir_entry *dp = PDE(file_inode(file));
50 struct proc_dir_entry *dp; 50 unsigned int *data = (unsigned int *)dp->data;
51 unsigned int *data;
52 int status; 51 int status;
53 unsigned long len, off; 52 unsigned long len, off;
54 unsigned int wait_time; 53 unsigned int wait_time;
55 54
56 dp = PDE(inode);
57 data = (unsigned int *)dp->data;
58
59 if (count > RTAS_DATA_BUF_SIZE) 55 if (count > RTAS_DATA_BUF_SIZE)
60 count = RTAS_DATA_BUF_SIZE; 56 count = RTAS_DATA_BUF_SIZE;
61 57