aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@aristanetworks.com>2010-09-14 14:37:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:16:43 -0400
commit6427a7655afd7f07dfa83736defd1d94656c83e5 (patch)
tree248b7db4c38f5f537a57f62dd099097fd1233c27
parent70a9156bad9d9d1476df35dde582b9f411bf5914 (diff)
uio: Cleanup irq handling.
Change the value of UIO_IRQ_NONE -2 to 0. 0 is well defined in the rest of the kernel as the value to indicate an irq has not been assigned. Update the calls to request_irq and free_irq to only ignore UIO_IRQ_NONE and UIO_IRQ_CUSTOM allowing the rest of the kernel's possible irq numbers to be used. Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Hans J. Koch <hjk@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/uio/uio.c14
-rw-r--r--include/linux/uio_driver.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 8132288920b2..0fd2cda74244 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -512,7 +512,7 @@ static unsigned int uio_poll(struct file *filep, poll_table *wait)
512 struct uio_listener *listener = filep->private_data; 512 struct uio_listener *listener = filep->private_data;
513 struct uio_device *idev = listener->dev; 513 struct uio_device *idev = listener->dev;
514 514
515 if (idev->info->irq == UIO_IRQ_NONE) 515 if (!idev->info->irq)
516 return -EIO; 516 return -EIO;
517 517
518 poll_wait(filep, &idev->wait, wait); 518 poll_wait(filep, &idev->wait, wait);
@@ -530,7 +530,7 @@ static ssize_t uio_read(struct file *filep, char __user *buf,
530 ssize_t retval; 530 ssize_t retval;
531 s32 event_count; 531 s32 event_count;
532 532
533 if (idev->info->irq == UIO_IRQ_NONE) 533 if (!idev->info->irq)
534 return -EIO; 534 return -EIO;
535 535
536 if (count != sizeof(s32)) 536 if (count != sizeof(s32))
@@ -578,7 +578,7 @@ static ssize_t uio_write(struct file *filep, const char __user *buf,
578 ssize_t retval; 578 ssize_t retval;
579 s32 irq_on; 579 s32 irq_on;
580 580
581 if (idev->info->irq == UIO_IRQ_NONE) 581 if (!idev->info->irq)
582 return -EIO; 582 return -EIO;
583 583
584 if (count != sizeof(s32)) 584 if (count != sizeof(s32))
@@ -825,9 +825,9 @@ int __uio_register_device(struct module *owner,
825 825
826 info->uio_dev = idev; 826 info->uio_dev = idev;
827 827
828 if (idev->info->irq >= 0) { 828 if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) {
829 ret = request_irq(idev->info->irq, uio_interrupt, 829 ret = request_irq(info->irq, uio_interrupt,
830 idev->info->irq_flags, idev->info->name, idev); 830 info->irq_flags, info->name, idev);
831 if (ret) 831 if (ret)
832 goto err_request_irq; 832 goto err_request_irq;
833 } 833 }
@@ -863,7 +863,7 @@ void uio_unregister_device(struct uio_info *info)
863 863
864 uio_free_minor(idev); 864 uio_free_minor(idev);
865 865
866 if (info->irq >= 0) 866 if (info->irq && (info->irq != UIO_IRQ_CUSTOM))
867 free_irq(info->irq, idev); 867 free_irq(info->irq, idev);
868 868
869 uio_dev_del_attributes(idev); 869 uio_dev_del_attributes(idev);
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 5dcc9ff72f69..d6188e5a52df 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -108,7 +108,7 @@ extern void uio_event_notify(struct uio_info *info);
108 108
109/* defines for uio_info->irq */ 109/* defines for uio_info->irq */
110#define UIO_IRQ_CUSTOM -1 110#define UIO_IRQ_CUSTOM -1
111#define UIO_IRQ_NONE -2 111#define UIO_IRQ_NONE 0
112 112
113/* defines for uio_mem->memtype */ 113/* defines for uio_mem->memtype */
114#define UIO_MEM_NONE 0 114#define UIO_MEM_NONE 0