Re: [PATCH 1/2] input: misc: add twl4030-pwrbutton driver

From
Trilok Soni <hidden>
Date
2009-02-28 05:51:49
Also in
lkml
Reply to
Felipe Balbi, 2009-02-27
Hi Felipe,
quoted hunk ↗ jump to hunk
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -0,0 +1,147 @@
+/**
+ * drivers/i2c/chips/twl4030-pwrbutton.c
+ *
Please remove this file path.
quoted hunk ↗ jump to hunk
+
+static struct input_dev *powerbutton_dev;
+static struct device *dbg_dev;
+
+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)  {
+               input_report_key(powerbutton_dev, KEY_POWER,
+                                value & PWR_PWRON_IRQ);

input_sync(...) please.
quoted hunk ↗ jump to hunk
+       } else {
+               dev_err(dbg_dev, "twl4030: i2c error %d while reading TWL4030"
+                       " PM_MASTER STS_HW_CONDITIONS register\n", err);
+       }
+
quoted hunk ↗ jump to hunk
+static int __devexit twl4030_pwrbutton_remove(struct platform_device *pdev)
+{
+       int irq = platform_get_irq(pdev, 0);
+
+       free_irq(irq, NULL);
+       input_unregister_device(powerbutton_dev);
+       input_free_device(powerbutton_dev);
No need of input_free_device after input_unregister_device.
quoted hunk ↗ jump to hunk
+
+       return 0;
+}
+
+struct platform_driver twl4030_pwrbutton_driver = {
+       .probe          = twl4030_pwrbutton_probe,
+       .remove         = twl4030_pwrbutton_remove,
__devexit_p(...)



-- 
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni
Thread (96 messages) 96 messages, 12 authors, last reply 2009-07-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help