Commit 996142e6 authored by Al Viro's avatar Al Viro

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7294b0bb
...@@ -369,15 +369,20 @@ pxa3xx_gcu_wait_free(struct pxa3xx_gcu_priv *priv) ...@@ -369,15 +369,20 @@ pxa3xx_gcu_wait_free(struct pxa3xx_gcu_priv *priv)
/* Misc device layer */ /* Misc device layer */
static inline struct pxa3xx_gcu_priv *file_dev(struct file *file)
{
struct miscdevice *dev = file->private_data;
return container_of(dev, struct pxa3xx_gcu_priv, misc_dev);
}
static ssize_t static ssize_t
pxa3xx_gcu_misc_write(struct file *filp, const char *buff, pxa3xx_gcu_misc_write(struct file *file, const char *buff,
size_t count, loff_t *offp) size_t count, loff_t *offp)
{ {
int ret; int ret;
unsigned long flags; unsigned long flags;
struct pxa3xx_gcu_batch *buffer; struct pxa3xx_gcu_batch *buffer;
struct pxa3xx_gcu_priv *priv = struct pxa3xx_gcu_priv *priv = file_dev(file);
container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops);
int words = count / 4; int words = count / 4;
...@@ -450,11 +455,10 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff, ...@@ -450,11 +455,10 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff,
static long static long
pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) pxa3xx_gcu_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
unsigned long flags; unsigned long flags;
struct pxa3xx_gcu_priv *priv = struct pxa3xx_gcu_priv *priv = file_dev(file);
container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops);
switch (cmd) { switch (cmd) {
case PXA3XX_GCU_IOCTL_RESET: case PXA3XX_GCU_IOCTL_RESET:
...@@ -471,11 +475,10 @@ pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -471,11 +475,10 @@ pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
static int static int
pxa3xx_gcu_misc_mmap(struct file *filp, struct vm_area_struct *vma) pxa3xx_gcu_misc_mmap(struct file *file, struct vm_area_struct *vma)
{ {
unsigned int size = vma->vm_end - vma->vm_start; unsigned int size = vma->vm_end - vma->vm_start;
struct pxa3xx_gcu_priv *priv = struct pxa3xx_gcu_priv *priv = file_dev(file);
container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops);
switch (vma->vm_pgoff) { switch (vma->vm_pgoff) {
case 0: case 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment