X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Finput%2Fpower.c;h=ee82464a2fa73c5bfd2b203fdfe68a8cd6ccfb61;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=f7469b55e1cadc8e9a14ad1d4fc4246e643e77da;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/drivers/input/power.c b/drivers/input/power.c index f7469b55e..ee82464a2 100644 --- a/drivers/input/power.c +++ b/drivers/input/power.c @@ -28,7 +28,6 @@ */ #include -#include #include #include #include @@ -58,8 +57,6 @@ static void power_event(struct input_handle *handle, unsigned int type, printk("Entering power_event\n"); - if (type != EV_KEY || type != EV_PWR) return; - if (type == EV_PWR) { switch (code) { case KEY_SUSPEND: @@ -76,7 +73,9 @@ static void power_event(struct input_handle *handle, unsigned int type, default: return; } - } else { + } + + if (type == EV_KEY) { switch (code) { case KEY_SUSPEND: printk("Powering down input device\n"); @@ -99,19 +98,12 @@ static void power_event(struct input_handle *handle, unsigned int type, static struct input_handle *power_connect(struct input_handler *handler, struct input_dev *dev, - struct input_device_id *id) + const struct input_device_id *id) { struct input_handle *handle; - if (!test_bit(EV_KEY, dev->evbit) || !test_bit(EV_PWR, dev->evbit)) - return NULL; - - if (!test_bit(KEY_SUSPEND, dev->keybit) || (!test_bit(KEY_POWER, dev->keybit))) - return NULL; - - if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) + if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) return NULL; - memset(handle, 0, sizeof(struct input_handle)); handle->dev = dev; handle->handler = handler; @@ -128,7 +120,7 @@ static void power_disconnect(struct input_handle *handle) kfree(handle); } -static struct input_device_id power_ids[] = { +static const struct input_device_id power_ids[] = { { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, .evbit = { BIT(EV_KEY) }, @@ -158,8 +150,7 @@ static struct input_handler power_handler = { static int __init power_init(void) { - input_register_handler(&power_handler); - return 0; + return input_register_handler(&power_handler); } static void __exit power_exit(void)