Commit 044e5878 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mauro Carvalho Chehab

V4L/DVB: lirc: use unlocked_ioctl

New code should not rely on the big kernel lock,
so use the unlocked_ioctl file operation in lirc.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarJarod Wilson <jarod@redhat.com>
Acked-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f9839da0
...@@ -97,8 +97,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, ...@@ -97,8 +97,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
return ret; return ret;
} }
static int ir_lirc_ioctl(struct inode *node, struct file *filep, static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
struct lirc_codec *lirc; struct lirc_codec *lirc;
struct ir_input_dev *ir_dev; struct ir_input_dev *ir_dev;
...@@ -154,7 +153,7 @@ static int ir_lirc_ioctl(struct inode *node, struct file *filep, ...@@ -154,7 +153,7 @@ static int ir_lirc_ioctl(struct inode *node, struct file *filep,
break; break;
default: default:
return lirc_dev_fop_ioctl(node, filep, cmd, arg); return lirc_dev_fop_ioctl(filep, cmd, arg);
} }
return ret; return ret;
...@@ -173,7 +172,7 @@ static void ir_lirc_close(void *data) ...@@ -173,7 +172,7 @@ static void ir_lirc_close(void *data)
static struct file_operations lirc_fops = { static struct file_operations lirc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = ir_lirc_transmit_ir, .write = ir_lirc_transmit_ir,
.ioctl = ir_lirc_ioctl, .unlocked_ioctl = ir_lirc_ioctl,
.read = lirc_dev_fop_read, .read = lirc_dev_fop_read,
.poll = lirc_dev_fop_poll, .poll = lirc_dev_fop_poll,
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
......
...@@ -160,7 +160,7 @@ static struct file_operations fops = { ...@@ -160,7 +160,7 @@ static struct file_operations fops = {
.read = lirc_dev_fop_read, .read = lirc_dev_fop_read,
.write = lirc_dev_fop_write, .write = lirc_dev_fop_write,
.poll = lirc_dev_fop_poll, .poll = lirc_dev_fop_poll,
.ioctl = lirc_dev_fop_ioctl, .unlocked_ioctl = lirc_dev_fop_ioctl,
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
.release = lirc_dev_fop_close, .release = lirc_dev_fop_close,
}; };
...@@ -242,9 +242,9 @@ int lirc_register_driver(struct lirc_driver *d) ...@@ -242,9 +242,9 @@ int lirc_register_driver(struct lirc_driver *d)
goto out; goto out;
} else if (!d->rbuf) { } else if (!d->rbuf) {
if (!(d->fops && d->fops->read && d->fops->poll && if (!(d->fops && d->fops->read && d->fops->poll &&
d->fops->ioctl)) { d->fops->unlocked_ioctl)) {
dev_err(d->dev, "lirc_dev: lirc_register_driver: " dev_err(d->dev, "lirc_dev: lirc_register_driver: "
"neither read, poll nor ioctl can be NULL!\n"); "neither read, poll nor unlocked_ioctl can be NULL!\n");
err = -EBADRQC; err = -EBADRQC;
goto out; goto out;
} }
...@@ -425,6 +425,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) ...@@ -425,6 +425,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
file->private_data = ir;
dev_dbg(ir->d.dev, LOGHEAD "open called\n", ir->d.name, ir->d.minor); dev_dbg(ir->d.dev, LOGHEAD "open called\n", ir->d.name, ir->d.minor);
...@@ -516,12 +517,11 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) ...@@ -516,12 +517,11 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
} }
EXPORT_SYMBOL(lirc_dev_fop_poll); EXPORT_SYMBOL(lirc_dev_fop_poll);
int lirc_dev_fop_ioctl(struct inode *inode, struct file *file, long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned long mode; unsigned long mode;
int result = 0; int result = 0;
struct irctl *ir = irctls[iminor(inode)]; struct irctl *ir = file->private_data;
dev_dbg(ir->d.dev, LOGHEAD "ioctl called (0x%x)\n", dev_dbg(ir->d.dev, LOGHEAD "ioctl called (0x%x)\n",
ir->d.name, ir->d.minor, cmd); ir->d.name, ir->d.minor, cmd);
......
...@@ -216,8 +216,7 @@ void *lirc_get_pdata(struct file *file); ...@@ -216,8 +216,7 @@ void *lirc_get_pdata(struct file *file);
int lirc_dev_fop_open(struct inode *inode, struct file *file); int lirc_dev_fop_open(struct inode *inode, struct file *file);
int lirc_dev_fop_close(struct inode *inode, struct file *file); int lirc_dev_fop_close(struct inode *inode, struct file *file);
unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait); unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait);
int lirc_dev_fop_ioctl(struct inode *inode, struct file *file, long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned int cmd, unsigned long arg);
ssize_t lirc_dev_fop_read(struct file *file, char *buffer, size_t length, ssize_t lirc_dev_fop_read(struct file *file, char *buffer, size_t length,
loff_t *ppos); loff_t *ppos);
ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, size_t length, ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, size_t length,
......
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