diff options
author | David Härdeman <david@hardeman.nu> | 2017-05-01 19:04:06 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-06 15:02:20 +0300 |
commit | e0e3c77cc218d754eae9ddcc62d8ede5b31cf7c2 (patch) | |
tree | 792559880dd028a8a93a0087b03d2a5859d47305 | |
parent | 258232269590cee2acd4bb28b8e027ad340a85f9 (diff) | |
download | linux-e0e3c77cc218d754eae9ddcc62d8ede5b31cf7c2.tar.xz |
[media] lirc_dev: make fops mandatory
Every caller of lirc_register_driver() passes their own fops and there
are no users of lirc_dev_fop_write() in the kernel tree. Thus we can
make fops mandatory and remove lirc_dev_fop_write().
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/rc/lirc_dev.c | 41 | ||||
-rw-r--r-- | include/media/lirc_dev.h | 3 |
2 files changed, 5 insertions, 39 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 7d04f83c1ab6..de7de0865a10 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -91,17 +91,6 @@ static void lirc_release(struct device *ld) kfree(ir); } -static const struct file_operations lirc_dev_fops = { - .owner = THIS_MODULE, - .read = lirc_dev_fop_read, - .write = lirc_dev_fop_write, - .poll = lirc_dev_fop_poll, - .unlocked_ioctl = lirc_dev_fop_ioctl, - .open = lirc_dev_fop_open, - .release = lirc_dev_fop_close, - .llseek = noop_llseek, -}; - static int lirc_cdev_add(struct irctl *ir) { struct lirc_driver *d = &ir->d; @@ -110,13 +99,11 @@ static int lirc_cdev_add(struct irctl *ir) cdev = &ir->cdev; - if (d->fops) { - cdev_init(cdev, d->fops); - cdev->owner = d->owner; - } else { - cdev_init(cdev, &lirc_dev_fops); - cdev->owner = THIS_MODULE; - } + if (!d->fops) + return -EINVAL; + + cdev_init(cdev, d->fops); + cdev->owner = d->owner; retval = kobject_set_name(&cdev->kobj, "lirc%d", d->minor); if (retval) return retval; @@ -638,24 +625,6 @@ void *lirc_get_pdata(struct file *file) EXPORT_SYMBOL(lirc_get_pdata); -ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, - size_t length, loff_t *ppos) -{ - struct irctl *ir = irctls[iminor(file_inode(file))]; - - if (!ir) { - pr_err("called with invalid irctl\n"); - return -ENODEV; - } - - if (!ir->attached) - return -ENODEV; - - return -EINVAL; -} -EXPORT_SYMBOL(lirc_dev_fop_write); - - static int __init lirc_dev_init(void) { int retval; diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 01649b009922..1f327e25a9be 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h @@ -210,7 +210,4 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait); long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg); ssize_t lirc_dev_fop_read(struct file *file, char __user *buffer, size_t length, loff_t *ppos); -ssize_t lirc_dev_fop_write(struct file *file, const char __user *buffer, - size_t length, loff_t *ppos); - #endif |