Commit 8164693d authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] ite_gpio region handling cleanups

parent 83142424
...@@ -391,12 +391,13 @@ int __init ite_gpio_init(void) ...@@ -391,12 +391,13 @@ int __init ite_gpio_init(void)
{ {
int i; int i;
misc_register(&ite_gpio_miscdev); if (misc_register(&ite_gpio_miscdev))
if (check_region(ite_gpio_base, 0x1c) < 0 ) {
return -ENODEV; return -ENODEV;
} else {
request_region(ite_gpio_base, 0x1c, "ITE GPIO"); if (!request_region(ite_gpio_base, 0x1c, "ITE GPIO"))
{
misc_deregister(&ite_gpio_miscdev);
return -EIO;
} }
/* initialize registers */ /* initialize registers */
...@@ -412,8 +413,13 @@ int __init ite_gpio_init(void) ...@@ -412,8 +413,13 @@ int __init ite_gpio_init(void)
ite_gpio_irq_pending[i]=0; ite_gpio_irq_pending[i]=0;
init_waitqueue_head(&ite_gpio_wait[i]); init_waitqueue_head(&ite_gpio_wait[i]);
} }
if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0)
if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0) {
misc_deregister(&ite_gpio_miscdev);
release_region(ite_gpio_base, 0x1c);
return 0; return 0;
}
printk("GPIO at 0x%x (irq = %d)\n", ite_gpio_base, ite_gpio_irq); printk("GPIO at 0x%x (irq = %d)\n", ite_gpio_base, ite_gpio_irq);
return 0; return 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