Commit 07f4f047 authored by Juha Yrjola's avatar Juha Yrjola

CBUS: Convert Retu power button driver to use input_allocate_device()

parent 45d102b9
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define PWRBTN_PRESSED 1 #define PWRBTN_PRESSED 1
static int pwrbtn_state; static int pwrbtn_state;
static struct input_dev pwrbtn_dev; static struct input_dev *pwrbtn_dev;
static struct timer_list pwrbtn_timer; static struct timer_list pwrbtn_timer;
static void retubutton_timer_func(unsigned long arg) static void retubutton_timer_func(unsigned long arg)
...@@ -54,7 +54,7 @@ static void retubutton_timer_func(unsigned long arg) ...@@ -54,7 +54,7 @@ static void retubutton_timer_func(unsigned long arg)
state = PWRBTN_PRESSED; state = PWRBTN_PRESSED;
if (pwrbtn_state != state) { if (pwrbtn_state != state) {
input_report_key(&pwrbtn_dev, KEY_POWER, state); input_report_key(pwrbtn_dev, KEY_POWER, state);
pwrbtn_state = state; pwrbtn_state = state;
} }
} }
...@@ -89,11 +89,15 @@ static int __init retubutton_init(void) ...@@ -89,11 +89,15 @@ static int __init retubutton_init(void)
return -EBUSY; return -EBUSY;
} }
pwrbtn_dev.evbit[0] = BIT(EV_KEY); pwrbtn_dev = input_allocate_device();
pwrbtn_dev.keybit[LONG(KEY_POWER)] = BIT(KEY_POWER); if (!pwrbtn_dev)
pwrbtn_dev.name = "retu-pwrbutton"; return -ENOMEM;
input_register_device(&pwrbtn_dev); pwrbtn_dev->evbit[0] = BIT(EV_KEY);
pwrbtn_dev->keybit[LONG(KEY_POWER)] = BIT(KEY_POWER);
pwrbtn_dev->name = "retu-pwrbutton";
input_register_device(pwrbtn_dev);
return 0; return 0;
} }
...@@ -105,7 +109,7 @@ static void __exit retubutton_exit(void) ...@@ -105,7 +109,7 @@ static void __exit retubutton_exit(void)
{ {
retu_free_irq(RETU_INT_PWR); retu_free_irq(RETU_INT_PWR);
del_timer_sync(&pwrbtn_timer); del_timer_sync(&pwrbtn_timer);
input_unregister_device(&pwrbtn_dev); input_unregister_device(pwrbtn_dev);
} }
module_init(retubutton_init); module_init(retubutton_init);
......
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