aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uio/uio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uio/uio.c')
-rw-r--r--drivers/uio/uio.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 5a7ca2e6094d..3a6934bf7131 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -427,6 +427,31 @@ static ssize_t uio_read(struct file *filep, char __user *buf,
427 return retval; 427 return retval;
428} 428}
429 429
430static ssize_t uio_write(struct file *filep, const char __user *buf,
431 size_t count, loff_t *ppos)
432{
433 struct uio_listener *listener = filep->private_data;
434 struct uio_device *idev = listener->dev;
435 ssize_t retval;
436 s32 irq_on;
437
438 if (idev->info->irq == UIO_IRQ_NONE)
439 return -EIO;
440
441 if (count != sizeof(s32))
442 return -EINVAL;
443
444 if (!idev->info->irqcontrol)
445 return -ENOSYS;
446
447 if (copy_from_user(&irq_on, buf, count))
448 return -EFAULT;
449
450 retval = idev->info->irqcontrol(idev->info, irq_on);
451
452 return retval ? retval : sizeof(s32);
453}
454
430static int uio_find_mem_index(struct vm_area_struct *vma) 455static int uio_find_mem_index(struct vm_area_struct *vma)
431{ 456{
432 int mi; 457 int mi;
@@ -546,6 +571,7 @@ static const struct file_operations uio_fops = {
546 .open = uio_open, 571 .open = uio_open,
547 .release = uio_release, 572 .release = uio_release,
548 .read = uio_read, 573 .read = uio_read,
574 .write = uio_write,
549 .mmap = uio_mmap, 575 .mmap = uio_mmap,
550 .poll = uio_poll, 576 .poll = uio_poll,
551 .fasync = uio_fasync, 577 .fasync = uio_fasync,