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)
{
int i;
misc_register(&ite_gpio_miscdev);
if (check_region(ite_gpio_base, 0x1c) < 0 ) {
if (misc_register(&ite_gpio_miscdev))
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 */
......@@ -412,8 +413,13 @@ int __init ite_gpio_init(void)
ite_gpio_irq_pending[i]=0;
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;
}
printk("GPIO at 0x%x (irq = %d)\n", ite_gpio_base, ite_gpio_irq);
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