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

[PATCH] ite_gpio region handling cleanups

parent 83142424
...@@ -391,13 +391,14 @@ int __init ite_gpio_init(void) ...@@ -391,13 +391,14 @@ int __init ite_gpio_init(void)
{ {
int i; int i;
misc_register(&ite_gpio_miscdev); if (misc_register(&ite_gpio_miscdev))
return -ENODEV;
if (check_region(ite_gpio_base, 0x1c) < 0 ) { if (!request_region(ite_gpio_base, 0x1c, "ITE GPIO"))
return -ENODEV; {
} else { misc_deregister(&ite_gpio_miscdev);
request_region(ite_gpio_base, 0x1c, "ITE GPIO"); return -EIO;
} }
/* initialize registers */ /* initialize registers */
ITE_GPACR = 0xffff; ITE_GPACR = 0xffff;
...@@ -407,13 +408,18 @@ int __init ite_gpio_init(void) ...@@ -407,13 +408,18 @@ int __init ite_gpio_init(void)
ITE_GPBICR = 0x00ff; ITE_GPBICR = 0x00ff;
ITE_GPCICR = 0x00ff; ITE_GPCICR = 0x00ff;
ITE_GCR = 0; ITE_GCR = 0;
for (i = 0; i < MAX_GPIO_LINE; i++) { for (i = 0; i < MAX_GPIO_LINE; i++) {
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