]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/chips/twl4030-pwrbutton.c
twl4030-pwrirq simplification, cleanup
[linux-2.6-omap-h63xx.git] / drivers / i2c / chips / twl4030-pwrbutton.c
index 9a361b3b6d1fb1afc4bdc01c303a50aa5987357d..cd4d06e8c9626b4a8057e2dd4afff5ccb91ce66f 100644 (file)
@@ -49,6 +49,14 @@ static irqreturn_t powerbutton_irq(int irq, void *dev_id)
        int err;
        u8 value;
 
+#ifdef CONFIG_LOCKDEP
+       /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
+        * we don't want and can't tolerate.  Although it might be
+        * friendlier not to borrow this thread context...
+        */
+       local_irq_enable();
+#endif
+
        err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
                                  STS_HW_CONDITIONS);
        if (!err)  {
@@ -67,6 +75,7 @@ static int __init twl4030_pwrbutton_init(void)
        int err = 0;
        u8 value;
 
+       /* PWRBTN == PWRON */
        if (request_irq(TWL4030_PWRIRQ_PWRBTN, powerbutton_irq, 0,
                        "PwrButton", NULL) < 0) {
                printk(KERN_ERR "Unable to allocate IRQ for power button\n");
@@ -92,22 +101,9 @@ static int __init twl4030_pwrbutton_init(void)
                goto free_irq_and_out;
        }
 
-       err = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &value, PWR_IMR1);
-       if (err) {
-               printk(KERN_WARNING "I2C error %d while reading TWL4030"
-                                       " INT PWR_IMR1 register\n", err);
-
-               goto free_input_dev;
-       }
-
-       err = twl4030_i2c_write_u8(TWL4030_MODULE_INT,
-                                  value & (~PWR_PWRON_IRQ), PWR_IMR1);
-       if (err) {
-               printk(KERN_WARNING "I2C error %d while writing TWL4030"
-                                   " INT PWR_IMR1 register\n", err);
-               goto free_input_dev;
-       }
-
+       /* FIXME just pass IRQF_EDGE_FALLING | IRQF_EDGE_RISING
+        * to request_irq(), once MODULE_INT supports them...
+        */
        err = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &value, PWR_EDR1);
        if (err) {
                printk(KERN_WARNING "I2C error %d while reading TWL4030"
@@ -136,19 +132,16 @@ free_irq_and_out:
 out:
        return err;
 }
+module_init(twl4030_pwrbutton_init);
 
 static void __exit twl4030_pwrbutton_exit(void)
 {
        free_irq(TWL4030_PWRIRQ_PWRBTN, NULL);
        input_unregister_device(powerbutton_dev);
        input_free_device(powerbutton_dev);
-
 }
-
-module_init(twl4030_pwrbutton_init);
 module_exit(twl4030_pwrbutton_exit);
 
-MODULE_ALIAS("i2c:twl4030-pwrbutton");
 MODULE_DESCRIPTION("Triton2 Power Button");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Peter De Schrijver");