diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-05 20:39:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:16:40 -0400 |
commit | 996142e61d11fc1c1bea2834a36116c9a0fae029 (patch) | |
tree | 7806924963bc23fb09b11a2cfa8c048912ffbed7 | |
parent | 7294b0bb694c4376cad819bb97f2796626f50551 (diff) |
pxa3xx-gcu: quite playing silly buggers with ->f_op
misc device gets ->private_data pointing to struct miscdevice
on open(), so we can use that to get to per-device structure
instead of relying on file_operations being copied into it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/video/pxa3xx-gcu.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index 6c984eacc7e3..4c318a34dfeb 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c | |||
@@ -369,15 +369,20 @@ pxa3xx_gcu_wait_free(struct pxa3xx_gcu_priv *priv) | |||
369 | 369 | ||
370 | /* Misc device layer */ | 370 | /* Misc device layer */ |
371 | 371 | ||
372 | static inline struct pxa3xx_gcu_priv *file_dev(struct file *file) | ||
373 | { | ||
374 | struct miscdevice *dev = file->private_data; | ||
375 | return container_of(dev, struct pxa3xx_gcu_priv, misc_dev); | ||
376 | } | ||
377 | |||
372 | static ssize_t | 378 | static ssize_t |
373 | pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | 379 | pxa3xx_gcu_misc_write(struct file *file, const char *buff, |
374 | size_t count, loff_t *offp) | 380 | size_t count, loff_t *offp) |
375 | { | 381 | { |
376 | int ret; | 382 | int ret; |
377 | unsigned long flags; | 383 | unsigned long flags; |
378 | struct pxa3xx_gcu_batch *buffer; | 384 | struct pxa3xx_gcu_batch *buffer; |
379 | struct pxa3xx_gcu_priv *priv = | 385 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
380 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
381 | 386 | ||
382 | int words = count / 4; | 387 | int words = count / 4; |
383 | 388 | ||
@@ -450,11 +455,10 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | |||
450 | 455 | ||
451 | 456 | ||
452 | static long | 457 | static long |
453 | pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 458 | pxa3xx_gcu_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
454 | { | 459 | { |
455 | unsigned long flags; | 460 | unsigned long flags; |
456 | struct pxa3xx_gcu_priv *priv = | 461 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
457 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
458 | 462 | ||
459 | switch (cmd) { | 463 | switch (cmd) { |
460 | case PXA3XX_GCU_IOCTL_RESET: | 464 | case PXA3XX_GCU_IOCTL_RESET: |
@@ -471,11 +475,10 @@ pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
471 | } | 475 | } |
472 | 476 | ||
473 | static int | 477 | static int |
474 | pxa3xx_gcu_misc_mmap(struct file *filp, struct vm_area_struct *vma) | 478 | pxa3xx_gcu_misc_mmap(struct file *file, struct vm_area_struct *vma) |
475 | { | 479 | { |
476 | unsigned int size = vma->vm_end - vma->vm_start; | 480 | unsigned int size = vma->vm_end - vma->vm_start; |
477 | struct pxa3xx_gcu_priv *priv = | 481 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
478 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
479 | 482 | ||
480 | switch (vma->vm_pgoff) { | 483 | switch (vma->vm_pgoff) { |
481 | case 0: | 484 | case 0: |