diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 20:16:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 20:16:10 -0400 |
commit | fc47912d9cda50ae6bd9ca30e97e8c03de5b7b60 (patch) | |
tree | d7da6ce3b23c1524e681ee33aa6e21d3c0586108 | |
parent | 06fe918e9f177dc2a0592b0ad40a6ce4920b2033 (diff) | |
parent | dde3ada3d0069855eeb353707b2b0f946191cfd6 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
"A few drivers were updated with device tree bindings and others got a
few small cleanups and fixes."
Fix trivial conflict in drivers/input/keyboard/omap-keypad.c due to
changes clashing with a whitespace cleanup.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (28 commits)
Input: wacom - mark Intuos5 pad as in-prox when touching buttons
Input: synaptics - adjust threshold for treating position values as negative
Input: hgpk - use %*ph to dump small buffer
Input: gpio_keys_polled - fix dt pdata->nbuttons
Input: Add KD[GS]KBDIACRUC ioctls to the compatible list
Input: omap-keypad - fixed formatting
Input: tegra - move platform data header
Input: wacom - add support for EMR on Cintiq 24HD touch
Input: s3c2410_ts - make s3c_ts_pmops const
Input: samsung-keypad - use of_get_child_count() helper
Input: samsung-keypad - use of_match_ptr()
Input: uinput - fix formatting
Input: uinput - specify exact bit sizes on userspace APIs
Input: uinput - mark failed submission requests as free
Input: uinput - fix race that can block nonblocking read
Input: uinput - return -EINVAL when read buffer size is too small
Input: uinput - take event lock when fetching events from buffer
Input: get rid of MATCH_BIT() macro
Input: rotary-encoder - add DT bindings
Input: rotary-encoder - constify platform data pointers
...
24 files changed, 610 insertions, 287 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt new file mode 100644 index 000000000000..313abefa37cc --- /dev/null +++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | Device-Tree bindings for input/gpio_keys_polled.c keyboard driver | ||
2 | |||
3 | Required properties: | ||
4 | - compatible = "gpio-keys-polled"; | ||
5 | - poll-interval: Poll interval time in milliseconds | ||
6 | |||
7 | Optional properties: | ||
8 | - autorepeat: Boolean, Enable auto repeat feature of Linux input | ||
9 | subsystem. | ||
10 | |||
11 | Each button (key) is represented as a sub-node of "gpio-keys-polled": | ||
12 | Subnode properties: | ||
13 | |||
14 | - gpios: OF device-tree gpio specification. | ||
15 | - label: Descriptive name of the key. | ||
16 | - linux,code: Keycode to emit. | ||
17 | |||
18 | Optional subnode-properties: | ||
19 | - linux,input-type: Specify event type this button/key generates. | ||
20 | If not specified defaults to <1> == EV_KEY. | ||
21 | - debounce-interval: Debouncing interval time in milliseconds. | ||
22 | If not specified defaults to 5. | ||
23 | - gpio-key,wakeup: Boolean, button can wake-up the system. | ||
24 | |||
25 | Example nodes: | ||
26 | |||
27 | gpio_keys_polled { | ||
28 | compatible = "gpio-keys-polled"; | ||
29 | #address-cells = <1>; | ||
30 | #size-cells = <0>; | ||
31 | poll-interval = <100>; | ||
32 | autorepeat; | ||
33 | button@21 { | ||
34 | label = "GPIO Key UP"; | ||
35 | linux,code = <103>; | ||
36 | gpios = <&gpio1 0 1>; | ||
37 | }; | ||
38 | ... | ||
diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt new file mode 100644 index 000000000000..331549593ed5 --- /dev/null +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt | |||
@@ -0,0 +1,36 @@ | |||
1 | Rotary encoder DT bindings | ||
2 | |||
3 | Required properties: | ||
4 | - gpios: a spec for two GPIOs to be used | ||
5 | |||
6 | Optional properties: | ||
7 | - linux,axis: the input subsystem axis to map to this rotary encoder. | ||
8 | Defaults to 0 (ABS_X / REL_X) | ||
9 | - rotary-encoder,steps: Number of steps in a full turnaround of the | ||
10 | encoder. Only relevant for absolute axis. Defaults to 24 which is a | ||
11 | typical value for such devices. | ||
12 | - rotary-encoder,relative-axis: register a relative axis rather than an | ||
13 | absolute one. Relative axis will only generate +1/-1 events on the input | ||
14 | device, hence no steps need to be passed. | ||
15 | - rotary-encoder,rollover: Automatic rollove when the rotary value becomes | ||
16 | greater than the specified steps or smaller than 0. For absolute axis only. | ||
17 | - rotary-encoder,half-period: Makes the driver work on half-period mode. | ||
18 | |||
19 | See Documentation/input/rotary-encoder.txt for more information. | ||
20 | |||
21 | Example: | ||
22 | |||
23 | rotary@0 { | ||
24 | compatible = "rotary-encoder"; | ||
25 | gpios = <&gpio 19 1>, <&gpio 20 0>; /* GPIO19 is inverted */ | ||
26 | linux,axis = <0>; /* REL_X */ | ||
27 | rotary-encoder,relative-axis; | ||
28 | }; | ||
29 | |||
30 | rotary@1 { | ||
31 | compatible = "rotary-encoder"; | ||
32 | gpios = <&gpio 21 0>, <&gpio 22 0>; | ||
33 | linux,axis = <1>; /* ABS_Y */ | ||
34 | rotary-encoder,steps = <24>; | ||
35 | rotary-encoder,rollover; | ||
36 | }; | ||
diff --git a/drivers/input/apm-power.c b/drivers/input/apm-power.c index e90ee3d30613..650177a3c858 100644 --- a/drivers/input/apm-power.c +++ b/drivers/input/apm-power.c | |||
@@ -33,7 +33,7 @@ static void system_power_event(unsigned int keycode) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | static void apmpower_event(struct input_handle *handle, unsigned int type, | 35 | static void apmpower_event(struct input_handle *handle, unsigned int type, |
36 | unsigned int code, int value) | 36 | unsigned int code, int value) |
37 | { | 37 | { |
38 | /* only react on key down events */ | 38 | /* only react on key down events */ |
39 | if (value != 1) | 39 | if (value != 1) |
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c index 480eb9d9876a..f50f6dd92274 100644 --- a/drivers/input/ff-core.c +++ b/drivers/input/ff-core.c | |||
@@ -138,8 +138,8 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, | |||
138 | 138 | ||
139 | if (effect->id == -1) { | 139 | if (effect->id == -1) { |
140 | for (id = 0; id < ff->max_effects; id++) | 140 | for (id = 0; id < ff->max_effects; id++) |
141 | if (!ff->effect_owners[id]) | 141 | if (!ff->effect_owners[id]) |
142 | break; | 142 | break; |
143 | 143 | ||
144 | if (id >= ff->max_effects) { | 144 | if (id >= ff->max_effects) { |
145 | ret = -ENOSPC; | 145 | ret = -ENOSPC; |
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index b107922514fb..74c0d8c6002a 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c | |||
@@ -72,12 +72,14 @@ static const struct ff_envelope *get_envelope(const struct ff_effect *effect) | |||
72 | static const struct ff_envelope empty_envelope; | 72 | static const struct ff_envelope empty_envelope; |
73 | 73 | ||
74 | switch (effect->type) { | 74 | switch (effect->type) { |
75 | case FF_PERIODIC: | 75 | case FF_PERIODIC: |
76 | return &effect->u.periodic.envelope; | 76 | return &effect->u.periodic.envelope; |
77 | case FF_CONSTANT: | 77 | |
78 | return &effect->u.constant.envelope; | 78 | case FF_CONSTANT: |
79 | default: | 79 | return &effect->u.constant.envelope; |
80 | return &empty_envelope; | 80 | |
81 | default: | ||
82 | return &empty_envelope; | ||
81 | } | 83 | } |
82 | } | 84 | } |
83 | 85 | ||
diff --git a/drivers/input/input.c b/drivers/input/input.c index 5244f3d05b12..ace3f7c4226d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -918,18 +918,10 @@ int input_set_keycode(struct input_dev *dev, | |||
918 | } | 918 | } |
919 | EXPORT_SYMBOL(input_set_keycode); | 919 | EXPORT_SYMBOL(input_set_keycode); |
920 | 920 | ||
921 | #define MATCH_BIT(bit, max) \ | ||
922 | for (i = 0; i < BITS_TO_LONGS(max); i++) \ | ||
923 | if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \ | ||
924 | break; \ | ||
925 | if (i != BITS_TO_LONGS(max)) \ | ||
926 | continue; | ||
927 | |||
928 | static const struct input_device_id *input_match_device(struct input_handler *handler, | 921 | static const struct input_device_id *input_match_device(struct input_handler *handler, |
929 | struct input_dev *dev) | 922 | struct input_dev *dev) |
930 | { | 923 | { |
931 | const struct input_device_id *id; | 924 | const struct input_device_id *id; |
932 | int i; | ||
933 | 925 | ||
934 | for (id = handler->id_table; id->flags || id->driver_info; id++) { | 926 | for (id = handler->id_table; id->flags || id->driver_info; id++) { |
935 | 927 | ||
@@ -949,15 +941,32 @@ static const struct input_device_id *input_match_device(struct input_handler *ha | |||
949 | if (id->version != dev->id.version) | 941 | if (id->version != dev->id.version) |
950 | continue; | 942 | continue; |
951 | 943 | ||
952 | MATCH_BIT(evbit, EV_MAX); | 944 | if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX)) |
953 | MATCH_BIT(keybit, KEY_MAX); | 945 | continue; |
954 | MATCH_BIT(relbit, REL_MAX); | 946 | |
955 | MATCH_BIT(absbit, ABS_MAX); | 947 | if (!bitmap_subset(id->keybit, dev->keybit, KEY_MAX)) |
956 | MATCH_BIT(mscbit, MSC_MAX); | 948 | continue; |
957 | MATCH_BIT(ledbit, LED_MAX); | 949 | |
958 | MATCH_BIT(sndbit, SND_MAX); | 950 | if (!bitmap_subset(id->relbit, dev->relbit, REL_MAX)) |
959 | MATCH_BIT(ffbit, FF_MAX); | 951 | continue; |
960 | MATCH_BIT(swbit, SW_MAX); | 952 | |
953 | if (!bitmap_subset(id->absbit, dev->absbit, ABS_MAX)) | ||
954 | continue; | ||
955 | |||
956 | if (!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX)) | ||
957 | continue; | ||
958 | |||
959 | if (!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX)) | ||
960 | continue; | ||
961 | |||
962 | if (!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX)) | ||
963 | continue; | ||
964 | |||
965 | if (!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX)) | ||
966 | continue; | ||
967 | |||
968 | if (!bitmap_subset(id->swbit, dev->swbit, SW_MAX)) | ||
969 | continue; | ||
961 | 970 | ||
962 | if (!handler->match || handler->match(handler, dev)) | 971 | if (!handler->match || handler->match(handler, dev)) |
963 | return id; | 972 | return id; |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 26043cc6a016..78f323ea1e4b 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -711,7 +711,7 @@ static long joydev_ioctl(struct file *file, | |||
711 | 711 | ||
712 | case JS_SET_ALL: | 712 | case JS_SET_ALL: |
713 | retval = copy_from_user(&joydev->glue, argp, | 713 | retval = copy_from_user(&joydev->glue, argp, |
714 | sizeof(joydev->glue)) ? -EFAULT: 0; | 714 | sizeof(joydev->glue)) ? -EFAULT : 0; |
715 | break; | 715 | break; |
716 | 716 | ||
717 | case JS_GET_ALL: | 717 | case JS_GET_ALL: |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index cbb1add43d5e..6a68041c261d 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -43,11 +43,9 @@ struct gpio_button_data { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct gpio_keys_drvdata { | 45 | struct gpio_keys_drvdata { |
46 | const struct gpio_keys_platform_data *pdata; | ||
46 | struct input_dev *input; | 47 | struct input_dev *input; |
47 | struct mutex disable_lock; | 48 | struct mutex disable_lock; |
48 | unsigned int n_buttons; | ||
49 | int (*enable)(struct device *dev); | ||
50 | void (*disable)(struct device *dev); | ||
51 | struct gpio_button_data data[0]; | 49 | struct gpio_button_data data[0]; |
52 | }; | 50 | }; |
53 | 51 | ||
@@ -171,7 +169,7 @@ static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata, | |||
171 | if (!bits) | 169 | if (!bits) |
172 | return -ENOMEM; | 170 | return -ENOMEM; |
173 | 171 | ||
174 | for (i = 0; i < ddata->n_buttons; i++) { | 172 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
175 | struct gpio_button_data *bdata = &ddata->data[i]; | 173 | struct gpio_button_data *bdata = &ddata->data[i]; |
176 | 174 | ||
177 | if (bdata->button->type != type) | 175 | if (bdata->button->type != type) |
@@ -219,7 +217,7 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, | |||
219 | goto out; | 217 | goto out; |
220 | 218 | ||
221 | /* First validate */ | 219 | /* First validate */ |
222 | for (i = 0; i < ddata->n_buttons; i++) { | 220 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
223 | struct gpio_button_data *bdata = &ddata->data[i]; | 221 | struct gpio_button_data *bdata = &ddata->data[i]; |
224 | 222 | ||
225 | if (bdata->button->type != type) | 223 | if (bdata->button->type != type) |
@@ -234,7 +232,7 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, | |||
234 | 232 | ||
235 | mutex_lock(&ddata->disable_lock); | 233 | mutex_lock(&ddata->disable_lock); |
236 | 234 | ||
237 | for (i = 0; i < ddata->n_buttons; i++) { | 235 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
238 | struct gpio_button_data *bdata = &ddata->data[i]; | 236 | struct gpio_button_data *bdata = &ddata->data[i]; |
239 | 237 | ||
240 | if (bdata->button->type != type) | 238 | if (bdata->button->type != type) |
@@ -346,6 +344,9 @@ static void gpio_keys_gpio_work_func(struct work_struct *work) | |||
346 | container_of(work, struct gpio_button_data, work); | 344 | container_of(work, struct gpio_button_data, work); |
347 | 345 | ||
348 | gpio_keys_gpio_report_event(bdata); | 346 | gpio_keys_gpio_report_event(bdata); |
347 | |||
348 | if (bdata->button->wakeup) | ||
349 | pm_relax(bdata->input->dev.parent); | ||
349 | } | 350 | } |
350 | 351 | ||
351 | static void gpio_keys_gpio_timer(unsigned long _data) | 352 | static void gpio_keys_gpio_timer(unsigned long _data) |
@@ -361,6 +362,8 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) | |||
361 | 362 | ||
362 | BUG_ON(irq != bdata->irq); | 363 | BUG_ON(irq != bdata->irq); |
363 | 364 | ||
365 | if (bdata->button->wakeup) | ||
366 | pm_stay_awake(bdata->input->dev.parent); | ||
364 | if (bdata->timer_debounce) | 367 | if (bdata->timer_debounce) |
365 | mod_timer(&bdata->timer, | 368 | mod_timer(&bdata->timer, |
366 | jiffies + msecs_to_jiffies(bdata->timer_debounce)); | 369 | jiffies + msecs_to_jiffies(bdata->timer_debounce)); |
@@ -397,6 +400,9 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) | |||
397 | spin_lock_irqsave(&bdata->lock, flags); | 400 | spin_lock_irqsave(&bdata->lock, flags); |
398 | 401 | ||
399 | if (!bdata->key_pressed) { | 402 | if (!bdata->key_pressed) { |
403 | if (bdata->button->wakeup) | ||
404 | pm_wakeup_event(bdata->input->dev.parent, 0); | ||
405 | |||
400 | input_event(input, EV_KEY, button->code, 1); | 406 | input_event(input, EV_KEY, button->code, 1); |
401 | input_sync(input); | 407 | input_sync(input); |
402 | 408 | ||
@@ -523,56 +529,64 @@ fail: | |||
523 | static int gpio_keys_open(struct input_dev *input) | 529 | static int gpio_keys_open(struct input_dev *input) |
524 | { | 530 | { |
525 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); | 531 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); |
532 | const struct gpio_keys_platform_data *pdata = ddata->pdata; | ||
526 | 533 | ||
527 | return ddata->enable ? ddata->enable(input->dev.parent) : 0; | 534 | return pdata->enable ? pdata->enable(input->dev.parent) : 0; |
528 | } | 535 | } |
529 | 536 | ||
530 | static void gpio_keys_close(struct input_dev *input) | 537 | static void gpio_keys_close(struct input_dev *input) |
531 | { | 538 | { |
532 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); | 539 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); |
540 | const struct gpio_keys_platform_data *pdata = ddata->pdata; | ||
533 | 541 | ||
534 | if (ddata->disable) | 542 | if (pdata->disable) |
535 | ddata->disable(input->dev.parent); | 543 | pdata->disable(input->dev.parent); |
536 | } | 544 | } |
537 | 545 | ||
538 | /* | 546 | /* |
539 | * Handlers for alternative sources of platform_data | 547 | * Handlers for alternative sources of platform_data |
540 | */ | 548 | */ |
549 | |||
541 | #ifdef CONFIG_OF | 550 | #ifdef CONFIG_OF |
542 | /* | 551 | /* |
543 | * Translate OpenFirmware node properties into platform_data | 552 | * Translate OpenFirmware node properties into platform_data |
544 | */ | 553 | */ |
545 | static int gpio_keys_get_devtree_pdata(struct device *dev, | 554 | static struct gpio_keys_platform_data * __devinit |
546 | struct gpio_keys_platform_data *pdata) | 555 | gpio_keys_get_devtree_pdata(struct device *dev) |
547 | { | 556 | { |
548 | struct device_node *node, *pp; | 557 | struct device_node *node, *pp; |
558 | struct gpio_keys_platform_data *pdata; | ||
559 | struct gpio_keys_button *button; | ||
560 | int error; | ||
561 | int nbuttons; | ||
549 | int i; | 562 | int i; |
550 | struct gpio_keys_button *buttons; | ||
551 | u32 reg; | ||
552 | 563 | ||
553 | node = dev->of_node; | 564 | node = dev->of_node; |
554 | if (node == NULL) | 565 | if (!node) { |
555 | return -ENODEV; | 566 | error = -ENODEV; |
556 | 567 | goto err_out; | |
557 | memset(pdata, 0, sizeof *pdata); | 568 | } |
558 | 569 | ||
559 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); | 570 | nbuttons = of_get_child_count(node); |
571 | if (nbuttons == 0) { | ||
572 | error = -ENODEV; | ||
573 | goto err_out; | ||
574 | } | ||
560 | 575 | ||
561 | /* First count the subnodes */ | 576 | pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), |
562 | pp = NULL; | 577 | GFP_KERNEL); |
563 | while ((pp = of_get_next_child(node, pp))) | 578 | if (!pdata) { |
564 | pdata->nbuttons++; | 579 | error = -ENOMEM; |
580 | goto err_out; | ||
581 | } | ||
565 | 582 | ||
566 | if (pdata->nbuttons == 0) | 583 | pdata->buttons = (struct gpio_keys_button *)(pdata + 1); |
567 | return -ENODEV; | 584 | pdata->nbuttons = nbuttons; |
568 | 585 | ||
569 | buttons = kzalloc(pdata->nbuttons * (sizeof *buttons), GFP_KERNEL); | 586 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); |
570 | if (!buttons) | ||
571 | return -ENOMEM; | ||
572 | 587 | ||
573 | pp = NULL; | ||
574 | i = 0; | 588 | i = 0; |
575 | while ((pp = of_get_next_child(node, pp))) { | 589 | for_each_child_of_node(node, pp) { |
576 | enum of_gpio_flags flags; | 590 | enum of_gpio_flags flags; |
577 | 591 | ||
578 | if (!of_find_property(pp, "gpios", NULL)) { | 592 | if (!of_find_property(pp, "gpios", NULL)) { |
@@ -580,39 +594,42 @@ static int gpio_keys_get_devtree_pdata(struct device *dev, | |||
580 | dev_warn(dev, "Found button without gpios\n"); | 594 | dev_warn(dev, "Found button without gpios\n"); |
581 | continue; | 595 | continue; |
582 | } | 596 | } |
583 | buttons[i].gpio = of_get_gpio_flags(pp, 0, &flags); | ||
584 | buttons[i].active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
585 | 597 | ||
586 | if (of_property_read_u32(pp, "linux,code", ®)) { | 598 | button = &pdata->buttons[i++]; |
587 | dev_err(dev, "Button without keycode: 0x%x\n", buttons[i].gpio); | ||
588 | goto out_fail; | ||
589 | } | ||
590 | buttons[i].code = reg; | ||
591 | 599 | ||
592 | buttons[i].desc = of_get_property(pp, "label", NULL); | 600 | button->gpio = of_get_gpio_flags(pp, 0, &flags); |
601 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
593 | 602 | ||
594 | if (of_property_read_u32(pp, "linux,input-type", ®) == 0) | 603 | if (of_property_read_u32(pp, "linux,code", &button->code)) { |
595 | buttons[i].type = reg; | 604 | dev_err(dev, "Button without keycode: 0x%x\n", |
596 | else | 605 | button->gpio); |
597 | buttons[i].type = EV_KEY; | 606 | error = -EINVAL; |
607 | goto err_free_pdata; | ||
608 | } | ||
598 | 609 | ||
599 | buttons[i].wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); | 610 | button->desc = of_get_property(pp, "label", NULL); |
600 | 611 | ||
601 | if (of_property_read_u32(pp, "debounce-interval", ®) == 0) | 612 | if (of_property_read_u32(pp, "linux,input-type", &button->type)) |
602 | buttons[i].debounce_interval = reg; | 613 | button->type = EV_KEY; |
603 | else | ||
604 | buttons[i].debounce_interval = 5; | ||
605 | 614 | ||
606 | i++; | 615 | button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); |
616 | |||
617 | if (of_property_read_u32(pp, "debounce-interval", | ||
618 | &button->debounce_interval)) | ||
619 | button->debounce_interval = 5; | ||
607 | } | 620 | } |
608 | 621 | ||
609 | pdata->buttons = buttons; | 622 | if (pdata->nbuttons == 0) { |
623 | error = -EINVAL; | ||
624 | goto err_free_pdata; | ||
625 | } | ||
610 | 626 | ||
611 | return 0; | 627 | return pdata; |
612 | 628 | ||
613 | out_fail: | 629 | err_free_pdata: |
614 | kfree(buttons); | 630 | kfree(pdata); |
615 | return -ENODEV; | 631 | err_out: |
632 | return ERR_PTR(error); | ||
616 | } | 633 | } |
617 | 634 | ||
618 | static struct of_device_id gpio_keys_of_match[] = { | 635 | static struct of_device_id gpio_keys_of_match[] = { |
@@ -623,14 +640,12 @@ MODULE_DEVICE_TABLE(of, gpio_keys_of_match); | |||
623 | 640 | ||
624 | #else | 641 | #else |
625 | 642 | ||
626 | static int gpio_keys_get_devtree_pdata(struct device *dev, | 643 | static inline struct gpio_keys_platform_data * |
627 | struct gpio_keys_platform_data *altp) | 644 | gpio_keys_get_devtree_pdata(struct device *dev) |
628 | { | 645 | { |
629 | return -ENODEV; | 646 | return ERR_PTR(-ENODEV); |
630 | } | 647 | } |
631 | 648 | ||
632 | #define gpio_keys_of_match NULL | ||
633 | |||
634 | #endif | 649 | #endif |
635 | 650 | ||
636 | static void gpio_remove_key(struct gpio_button_data *bdata) | 651 | static void gpio_remove_key(struct gpio_button_data *bdata) |
@@ -645,19 +660,17 @@ static void gpio_remove_key(struct gpio_button_data *bdata) | |||
645 | 660 | ||
646 | static int __devinit gpio_keys_probe(struct platform_device *pdev) | 661 | static int __devinit gpio_keys_probe(struct platform_device *pdev) |
647 | { | 662 | { |
648 | const struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | ||
649 | struct gpio_keys_drvdata *ddata; | ||
650 | struct device *dev = &pdev->dev; | 663 | struct device *dev = &pdev->dev; |
651 | struct gpio_keys_platform_data alt_pdata; | 664 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); |
665 | struct gpio_keys_drvdata *ddata; | ||
652 | struct input_dev *input; | 666 | struct input_dev *input; |
653 | int i, error; | 667 | int i, error; |
654 | int wakeup = 0; | 668 | int wakeup = 0; |
655 | 669 | ||
656 | if (!pdata) { | 670 | if (!pdata) { |
657 | error = gpio_keys_get_devtree_pdata(dev, &alt_pdata); | 671 | pdata = gpio_keys_get_devtree_pdata(dev); |
658 | if (error) | 672 | if (IS_ERR(pdata)) |
659 | return error; | 673 | return PTR_ERR(pdata); |
660 | pdata = &alt_pdata; | ||
661 | } | 674 | } |
662 | 675 | ||
663 | ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + | 676 | ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + |
@@ -670,10 +683,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
670 | goto fail1; | 683 | goto fail1; |
671 | } | 684 | } |
672 | 685 | ||
686 | ddata->pdata = pdata; | ||
673 | ddata->input = input; | 687 | ddata->input = input; |
674 | ddata->n_buttons = pdata->nbuttons; | ||
675 | ddata->enable = pdata->enable; | ||
676 | ddata->disable = pdata->disable; | ||
677 | mutex_init(&ddata->disable_lock); | 688 | mutex_init(&ddata->disable_lock); |
678 | 689 | ||
679 | platform_set_drvdata(pdev, ddata); | 690 | platform_set_drvdata(pdev, ddata); |
@@ -742,9 +753,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
742 | fail1: | 753 | fail1: |
743 | input_free_device(input); | 754 | input_free_device(input); |
744 | kfree(ddata); | 755 | kfree(ddata); |
745 | /* If we have no platform_data, we allocated buttons dynamically. */ | 756 | /* If we have no platform data, we allocated pdata dynamically. */ |
746 | if (!pdev->dev.platform_data) | 757 | if (!dev_get_platdata(&pdev->dev)) |
747 | kfree(pdata->buttons); | 758 | kfree(pdata); |
748 | 759 | ||
749 | return error; | 760 | return error; |
750 | } | 761 | } |
@@ -759,18 +770,14 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
759 | 770 | ||
760 | device_init_wakeup(&pdev->dev, 0); | 771 | device_init_wakeup(&pdev->dev, 0); |
761 | 772 | ||
762 | for (i = 0; i < ddata->n_buttons; i++) | 773 | for (i = 0; i < ddata->pdata->nbuttons; i++) |
763 | gpio_remove_key(&ddata->data[i]); | 774 | gpio_remove_key(&ddata->data[i]); |
764 | 775 | ||
765 | input_unregister_device(input); | 776 | input_unregister_device(input); |
766 | 777 | ||
767 | /* | 778 | /* If we have no platform data, we allocated pdata dynamically. */ |
768 | * If we had no platform_data, we allocated buttons dynamically, and | 779 | if (!dev_get_platdata(&pdev->dev)) |
769 | * must free them here. ddata->data[0].button is the pointer to the | 780 | kfree(ddata->pdata); |
770 | * beginning of the allocated array. | ||
771 | */ | ||
772 | if (!pdev->dev.platform_data) | ||
773 | kfree(ddata->data[0].button); | ||
774 | 781 | ||
775 | kfree(ddata); | 782 | kfree(ddata); |
776 | 783 | ||
@@ -784,7 +791,7 @@ static int gpio_keys_suspend(struct device *dev) | |||
784 | int i; | 791 | int i; |
785 | 792 | ||
786 | if (device_may_wakeup(dev)) { | 793 | if (device_may_wakeup(dev)) { |
787 | for (i = 0; i < ddata->n_buttons; i++) { | 794 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
788 | struct gpio_button_data *bdata = &ddata->data[i]; | 795 | struct gpio_button_data *bdata = &ddata->data[i]; |
789 | if (bdata->button->wakeup) | 796 | if (bdata->button->wakeup) |
790 | enable_irq_wake(bdata->irq); | 797 | enable_irq_wake(bdata->irq); |
@@ -799,7 +806,7 @@ static int gpio_keys_resume(struct device *dev) | |||
799 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); | 806 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); |
800 | int i; | 807 | int i; |
801 | 808 | ||
802 | for (i = 0; i < ddata->n_buttons; i++) { | 809 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
803 | struct gpio_button_data *bdata = &ddata->data[i]; | 810 | struct gpio_button_data *bdata = &ddata->data[i]; |
804 | if (bdata->button->wakeup && device_may_wakeup(dev)) | 811 | if (bdata->button->wakeup && device_may_wakeup(dev)) |
805 | disable_irq_wake(bdata->irq); | 812 | disable_irq_wake(bdata->irq); |
@@ -822,7 +829,7 @@ static struct platform_driver gpio_keys_device_driver = { | |||
822 | .name = "gpio-keys", | 829 | .name = "gpio-keys", |
823 | .owner = THIS_MODULE, | 830 | .owner = THIS_MODULE, |
824 | .pm = &gpio_keys_pm_ops, | 831 | .pm = &gpio_keys_pm_ops, |
825 | .of_match_table = gpio_keys_of_match, | 832 | .of_match_table = of_match_ptr(gpio_keys_of_match), |
826 | } | 833 | } |
827 | }; | 834 | }; |
828 | 835 | ||
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 20c8ab172214..f2142de789e7 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/gpio_keys.h> | 27 | #include <linux/gpio_keys.h> |
28 | #include <linux/of_platform.h> | ||
29 | #include <linux/of_gpio.h> | ||
28 | 30 | ||
29 | #define DRV_NAME "gpio-keys-polled" | 31 | #define DRV_NAME "gpio-keys-polled" |
30 | 32 | ||
@@ -38,7 +40,7 @@ struct gpio_keys_button_data { | |||
38 | struct gpio_keys_polled_dev { | 40 | struct gpio_keys_polled_dev { |
39 | struct input_polled_dev *poll_dev; | 41 | struct input_polled_dev *poll_dev; |
40 | struct device *dev; | 42 | struct device *dev; |
41 | struct gpio_keys_platform_data *pdata; | 43 | const struct gpio_keys_platform_data *pdata; |
42 | struct gpio_keys_button_data data[0]; | 44 | struct gpio_keys_button_data data[0]; |
43 | }; | 45 | }; |
44 | 46 | ||
@@ -67,11 +69,11 @@ static void gpio_keys_polled_check_state(struct input_dev *input, | |||
67 | static void gpio_keys_polled_poll(struct input_polled_dev *dev) | 69 | static void gpio_keys_polled_poll(struct input_polled_dev *dev) |
68 | { | 70 | { |
69 | struct gpio_keys_polled_dev *bdev = dev->private; | 71 | struct gpio_keys_polled_dev *bdev = dev->private; |
70 | struct gpio_keys_platform_data *pdata = bdev->pdata; | 72 | const struct gpio_keys_platform_data *pdata = bdev->pdata; |
71 | struct input_dev *input = dev->input; | 73 | struct input_dev *input = dev->input; |
72 | int i; | 74 | int i; |
73 | 75 | ||
74 | for (i = 0; i < bdev->pdata->nbuttons; i++) { | 76 | for (i = 0; i < pdata->nbuttons; i++) { |
75 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | 77 | struct gpio_keys_button_data *bdata = &bdev->data[i]; |
76 | 78 | ||
77 | if (bdata->count < bdata->threshold) | 79 | if (bdata->count < bdata->threshold) |
@@ -85,7 +87,7 @@ static void gpio_keys_polled_poll(struct input_polled_dev *dev) | |||
85 | static void gpio_keys_polled_open(struct input_polled_dev *dev) | 87 | static void gpio_keys_polled_open(struct input_polled_dev *dev) |
86 | { | 88 | { |
87 | struct gpio_keys_polled_dev *bdev = dev->private; | 89 | struct gpio_keys_polled_dev *bdev = dev->private; |
88 | struct gpio_keys_platform_data *pdata = bdev->pdata; | 90 | const struct gpio_keys_platform_data *pdata = bdev->pdata; |
89 | 91 | ||
90 | if (pdata->enable) | 92 | if (pdata->enable) |
91 | pdata->enable(bdev->dev); | 93 | pdata->enable(bdev->dev); |
@@ -94,31 +96,139 @@ static void gpio_keys_polled_open(struct input_polled_dev *dev) | |||
94 | static void gpio_keys_polled_close(struct input_polled_dev *dev) | 96 | static void gpio_keys_polled_close(struct input_polled_dev *dev) |
95 | { | 97 | { |
96 | struct gpio_keys_polled_dev *bdev = dev->private; | 98 | struct gpio_keys_polled_dev *bdev = dev->private; |
97 | struct gpio_keys_platform_data *pdata = bdev->pdata; | 99 | const struct gpio_keys_platform_data *pdata = bdev->pdata; |
98 | 100 | ||
99 | if (pdata->disable) | 101 | if (pdata->disable) |
100 | pdata->disable(bdev->dev); | 102 | pdata->disable(bdev->dev); |
101 | } | 103 | } |
102 | 104 | ||
105 | #ifdef CONFIG_OF | ||
106 | static struct gpio_keys_platform_data * __devinit | ||
107 | gpio_keys_polled_get_devtree_pdata(struct device *dev) | ||
108 | { | ||
109 | struct device_node *node, *pp; | ||
110 | struct gpio_keys_platform_data *pdata; | ||
111 | struct gpio_keys_button *button; | ||
112 | int error; | ||
113 | int nbuttons; | ||
114 | int i; | ||
115 | |||
116 | node = dev->of_node; | ||
117 | if (!node) | ||
118 | return NULL; | ||
119 | |||
120 | nbuttons = of_get_child_count(node); | ||
121 | if (nbuttons == 0) | ||
122 | return NULL; | ||
123 | |||
124 | pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), | ||
125 | GFP_KERNEL); | ||
126 | if (!pdata) { | ||
127 | error = -ENOMEM; | ||
128 | goto err_out; | ||
129 | } | ||
130 | |||
131 | pdata->buttons = (struct gpio_keys_button *)(pdata + 1); | ||
132 | pdata->nbuttons = nbuttons; | ||
133 | |||
134 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); | ||
135 | of_property_read_u32(node, "poll-interval", &pdata->poll_interval); | ||
136 | |||
137 | i = 0; | ||
138 | for_each_child_of_node(node, pp) { | ||
139 | enum of_gpio_flags flags; | ||
140 | |||
141 | if (!of_find_property(pp, "gpios", NULL)) { | ||
142 | pdata->nbuttons--; | ||
143 | dev_warn(dev, "Found button without gpios\n"); | ||
144 | continue; | ||
145 | } | ||
146 | |||
147 | button = &pdata->buttons[i++]; | ||
148 | |||
149 | button->gpio = of_get_gpio_flags(pp, 0, &flags); | ||
150 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
151 | |||
152 | if (of_property_read_u32(pp, "linux,code", &button->code)) { | ||
153 | dev_err(dev, "Button without keycode: 0x%x\n", | ||
154 | button->gpio); | ||
155 | error = -EINVAL; | ||
156 | goto err_free_pdata; | ||
157 | } | ||
158 | |||
159 | button->desc = of_get_property(pp, "label", NULL); | ||
160 | |||
161 | if (of_property_read_u32(pp, "linux,input-type", &button->type)) | ||
162 | button->type = EV_KEY; | ||
163 | |||
164 | button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); | ||
165 | |||
166 | if (of_property_read_u32(pp, "debounce-interval", | ||
167 | &button->debounce_interval)) | ||
168 | button->debounce_interval = 5; | ||
169 | } | ||
170 | |||
171 | if (pdata->nbuttons == 0) { | ||
172 | error = -EINVAL; | ||
173 | goto err_free_pdata; | ||
174 | } | ||
175 | |||
176 | return pdata; | ||
177 | |||
178 | err_free_pdata: | ||
179 | kfree(pdata); | ||
180 | err_out: | ||
181 | return ERR_PTR(error); | ||
182 | } | ||
183 | |||
184 | static struct of_device_id gpio_keys_polled_of_match[] = { | ||
185 | { .compatible = "gpio-keys-polled", }, | ||
186 | { }, | ||
187 | }; | ||
188 | MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); | ||
189 | |||
190 | #else | ||
191 | |||
192 | static inline struct gpio_keys_platform_data * | ||
193 | gpio_keys_polled_get_devtree_pdata(struct device *dev) | ||
194 | { | ||
195 | return NULL; | ||
196 | } | ||
197 | #endif | ||
198 | |||
103 | static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | 199 | static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) |
104 | { | 200 | { |
105 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | ||
106 | struct device *dev = &pdev->dev; | 201 | struct device *dev = &pdev->dev; |
202 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); | ||
107 | struct gpio_keys_polled_dev *bdev; | 203 | struct gpio_keys_polled_dev *bdev; |
108 | struct input_polled_dev *poll_dev; | 204 | struct input_polled_dev *poll_dev; |
109 | struct input_dev *input; | 205 | struct input_dev *input; |
110 | int error; | 206 | int error; |
111 | int i; | 207 | int i; |
112 | 208 | ||
113 | if (!pdata || !pdata->poll_interval) | 209 | if (!pdata) { |
114 | return -EINVAL; | 210 | pdata = gpio_keys_polled_get_devtree_pdata(dev); |
211 | if (IS_ERR(pdata)) | ||
212 | return PTR_ERR(pdata); | ||
213 | if (!pdata) { | ||
214 | dev_err(dev, "missing platform data\n"); | ||
215 | return -EINVAL; | ||
216 | } | ||
217 | } | ||
218 | |||
219 | if (!pdata->poll_interval) { | ||
220 | dev_err(dev, "missing poll_interval value\n"); | ||
221 | error = -EINVAL; | ||
222 | goto err_free_pdata; | ||
223 | } | ||
115 | 224 | ||
116 | bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) + | 225 | bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) + |
117 | pdata->nbuttons * sizeof(struct gpio_keys_button_data), | 226 | pdata->nbuttons * sizeof(struct gpio_keys_button_data), |
118 | GFP_KERNEL); | 227 | GFP_KERNEL); |
119 | if (!bdev) { | 228 | if (!bdev) { |
120 | dev_err(dev, "no memory for private data\n"); | 229 | dev_err(dev, "no memory for private data\n"); |
121 | return -ENOMEM; | 230 | error = -ENOMEM; |
231 | goto err_free_pdata; | ||
122 | } | 232 | } |
123 | 233 | ||
124 | poll_dev = input_allocate_polled_device(); | 234 | poll_dev = input_allocate_polled_device(); |
@@ -197,7 +307,7 @@ static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | |||
197 | /* report initial state of the buttons */ | 307 | /* report initial state of the buttons */ |
198 | for (i = 0; i < pdata->nbuttons; i++) | 308 | for (i = 0; i < pdata->nbuttons; i++) |
199 | gpio_keys_polled_check_state(input, &pdata->buttons[i], | 309 | gpio_keys_polled_check_state(input, &pdata->buttons[i], |
200 | &bdev->data[i]); | 310 | &bdev->data[i]); |
201 | 311 | ||
202 | return 0; | 312 | return 0; |
203 | 313 | ||
@@ -209,15 +319,20 @@ err_free_gpio: | |||
209 | 319 | ||
210 | err_free_bdev: | 320 | err_free_bdev: |
211 | kfree(bdev); | 321 | kfree(bdev); |
212 | |||
213 | platform_set_drvdata(pdev, NULL); | 322 | platform_set_drvdata(pdev, NULL); |
323 | |||
324 | err_free_pdata: | ||
325 | /* If we have no platform_data, we allocated pdata dynamically. */ | ||
326 | if (!dev_get_platdata(&pdev->dev)) | ||
327 | kfree(pdata); | ||
328 | |||
214 | return error; | 329 | return error; |
215 | } | 330 | } |
216 | 331 | ||
217 | static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) | 332 | static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) |
218 | { | 333 | { |
219 | struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); | 334 | struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); |
220 | struct gpio_keys_platform_data *pdata = bdev->pdata; | 335 | const struct gpio_keys_platform_data *pdata = bdev->pdata; |
221 | int i; | 336 | int i; |
222 | 337 | ||
223 | input_unregister_polled_device(bdev->poll_dev); | 338 | input_unregister_polled_device(bdev->poll_dev); |
@@ -227,6 +342,13 @@ static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) | |||
227 | 342 | ||
228 | input_free_polled_device(bdev->poll_dev); | 343 | input_free_polled_device(bdev->poll_dev); |
229 | 344 | ||
345 | /* | ||
346 | * If we had no platform_data, we allocated pdata dynamically and | ||
347 | * must free it here. | ||
348 | */ | ||
349 | if (!dev_get_platdata(&pdev->dev)) | ||
350 | kfree(pdata); | ||
351 | |||
230 | kfree(bdev); | 352 | kfree(bdev); |
231 | platform_set_drvdata(pdev, NULL); | 353 | platform_set_drvdata(pdev, NULL); |
232 | 354 | ||
@@ -239,6 +361,7 @@ static struct platform_driver gpio_keys_polled_driver = { | |||
239 | .driver = { | 361 | .driver = { |
240 | .name = DRV_NAME, | 362 | .name = DRV_NAME, |
241 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .of_match_table = of_match_ptr(gpio_keys_polled_of_match), | ||
242 | }, | 365 | }, |
243 | }; | 366 | }; |
244 | module_platform_driver(gpio_keys_polled_driver); | 367 | module_platform_driver(gpio_keys_polled_driver); |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 6d6b1427ae12..4a5fcc8026f5 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -179,7 +179,7 @@ static void omap_kp_tasklet(unsigned long data) | |||
179 | memcpy(keypad_state, new_state, sizeof(keypad_state)); | 179 | memcpy(keypad_state, new_state, sizeof(keypad_state)); |
180 | 180 | ||
181 | if (key_down) { | 181 | if (key_down) { |
182 | int delay = HZ / 20; | 182 | int delay = HZ / 20; |
183 | /* some key is pressed - keep irq disabled and use timer | 183 | /* some key is pressed - keep irq disabled and use timer |
184 | * to poll the keypad */ | 184 | * to poll the keypad */ |
185 | if (spurious) | 185 | if (spurious) |
@@ -346,9 +346,9 @@ err4: | |||
346 | err3: | 346 | err3: |
347 | device_remove_file(&pdev->dev, &dev_attr_enable); | 347 | device_remove_file(&pdev->dev, &dev_attr_enable); |
348 | err2: | 348 | err2: |
349 | for (i = row_idx - 1; i >=0; i--) | 349 | for (i = row_idx - 1; i >= 0; i--) |
350 | gpio_free(row_gpios[i]); | 350 | gpio_free(row_gpios[i]); |
351 | for (i = col_idx - 1; i >=0; i--) | 351 | for (i = col_idx - 1; i >= 0; i--) |
352 | gpio_free(col_gpios[i]); | 352 | gpio_free(col_gpios[i]); |
353 | 353 | ||
354 | kfree(omap_kp); | 354 | kfree(omap_kp); |
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index a061ba603a29..277e26dc910e 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c | |||
@@ -256,7 +256,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( | |||
256 | struct matrix_keymap_data *keymap_data; | 256 | struct matrix_keymap_data *keymap_data; |
257 | uint32_t *keymap, num_rows = 0, num_cols = 0; | 257 | uint32_t *keymap, num_rows = 0, num_cols = 0; |
258 | struct device_node *np = dev->of_node, *key_np; | 258 | struct device_node *np = dev->of_node, *key_np; |
259 | unsigned int key_count = 0; | 259 | unsigned int key_count; |
260 | 260 | ||
261 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 261 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
262 | if (!pdata) { | 262 | if (!pdata) { |
@@ -280,9 +280,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( | |||
280 | } | 280 | } |
281 | pdata->keymap_data = keymap_data; | 281 | pdata->keymap_data = keymap_data; |
282 | 282 | ||
283 | for_each_child_of_node(np, key_np) | 283 | key_count = of_get_child_count(np); |
284 | key_count++; | ||
285 | |||
286 | keymap_data->keymap_size = key_count; | 284 | keymap_data->keymap_size = key_count; |
287 | keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); | 285 | keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL); |
288 | if (!keymap) { | 286 | if (!keymap) { |
@@ -662,8 +660,6 @@ static const struct of_device_id samsung_keypad_dt_match[] = { | |||
662 | {}, | 660 | {}, |
663 | }; | 661 | }; |
664 | MODULE_DEVICE_TABLE(of, samsung_keypad_dt_match); | 662 | MODULE_DEVICE_TABLE(of, samsung_keypad_dt_match); |
665 | #else | ||
666 | #define samsung_keypad_dt_match NULL | ||
667 | #endif | 663 | #endif |
668 | 664 | ||
669 | static struct platform_device_id samsung_keypad_driver_ids[] = { | 665 | static struct platform_device_id samsung_keypad_driver_ids[] = { |
@@ -684,7 +680,7 @@ static struct platform_driver samsung_keypad_driver = { | |||
684 | .driver = { | 680 | .driver = { |
685 | .name = "samsung-keypad", | 681 | .name = "samsung-keypad", |
686 | .owner = THIS_MODULE, | 682 | .owner = THIS_MODULE, |
687 | .of_match_table = samsung_keypad_dt_match, | 683 | .of_match_table = of_match_ptr(samsung_keypad_dt_match), |
688 | .pm = &samsung_keypad_pm_ops, | 684 | .pm = &samsung_keypad_pm_ops, |
689 | }, | 685 | }, |
690 | .id_table = samsung_keypad_driver_ids, | 686 | .id_table = samsung_keypad_driver_ids, |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 2c1c9ed1bd9f..5faaf2553e33 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -29,8 +29,8 @@ | |||
29 | #include <linux/of.h> | 29 | #include <linux/of.h> |
30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/input/tegra_kbc.h> | ||
32 | #include <mach/clk.h> | 33 | #include <mach/clk.h> |
33 | #include <mach/kbc.h> | ||
34 | 34 | ||
35 | #define KBC_MAX_DEBOUNCE_CNT 0x3ffu | 35 | #define KBC_MAX_DEBOUNCE_CNT 0x3ffu |
36 | 36 | ||
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index f07f784198b9..99a49e4968d2 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -24,12 +24,14 @@ | |||
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/rotary_encoder.h> | 25 | #include <linux/rotary_encoder.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/of_platform.h> | ||
28 | #include <linux/of_gpio.h> | ||
27 | 29 | ||
28 | #define DRV_NAME "rotary-encoder" | 30 | #define DRV_NAME "rotary-encoder" |
29 | 31 | ||
30 | struct rotary_encoder { | 32 | struct rotary_encoder { |
31 | struct input_dev *input; | 33 | struct input_dev *input; |
32 | struct rotary_encoder_platform_data *pdata; | 34 | const struct rotary_encoder_platform_data *pdata; |
33 | 35 | ||
34 | unsigned int axis; | 36 | unsigned int axis; |
35 | unsigned int pos; | 37 | unsigned int pos; |
@@ -43,7 +45,7 @@ struct rotary_encoder { | |||
43 | char last_stable; | 45 | char last_stable; |
44 | }; | 46 | }; |
45 | 47 | ||
46 | static int rotary_encoder_get_state(struct rotary_encoder_platform_data *pdata) | 48 | static int rotary_encoder_get_state(const struct rotary_encoder_platform_data *pdata) |
47 | { | 49 | { |
48 | int a = !!gpio_get_value(pdata->gpio_a); | 50 | int a = !!gpio_get_value(pdata->gpio_a); |
49 | int b = !!gpio_get_value(pdata->gpio_b); | 51 | int b = !!gpio_get_value(pdata->gpio_b); |
@@ -56,7 +58,7 @@ static int rotary_encoder_get_state(struct rotary_encoder_platform_data *pdata) | |||
56 | 58 | ||
57 | static void rotary_encoder_report_event(struct rotary_encoder *encoder) | 59 | static void rotary_encoder_report_event(struct rotary_encoder *encoder) |
58 | { | 60 | { |
59 | struct rotary_encoder_platform_data *pdata = encoder->pdata; | 61 | const struct rotary_encoder_platform_data *pdata = encoder->pdata; |
60 | 62 | ||
61 | if (pdata->relative_axis) { | 63 | if (pdata->relative_axis) { |
62 | input_report_rel(encoder->input, | 64 | input_report_rel(encoder->input, |
@@ -140,36 +142,89 @@ static irqreturn_t rotary_encoder_half_period_irq(int irq, void *dev_id) | |||
140 | return IRQ_HANDLED; | 142 | return IRQ_HANDLED; |
141 | } | 143 | } |
142 | 144 | ||
145 | #ifdef CONFIG_OF | ||
146 | static struct of_device_id rotary_encoder_of_match[] = { | ||
147 | { .compatible = "rotary-encoder", }, | ||
148 | { }, | ||
149 | }; | ||
150 | MODULE_DEVICE_TABLE(of, rotary_encoder_of_match); | ||
151 | |||
152 | static struct rotary_encoder_platform_data * __devinit | ||
153 | rotary_encoder_parse_dt(struct device *dev) | ||
154 | { | ||
155 | const struct of_device_id *of_id = | ||
156 | of_match_device(rotary_encoder_of_match, dev); | ||
157 | struct device_node *np = dev->of_node; | ||
158 | struct rotary_encoder_platform_data *pdata; | ||
159 | enum of_gpio_flags flags; | ||
160 | |||
161 | if (!of_id || !np) | ||
162 | return NULL; | ||
163 | |||
164 | pdata = kzalloc(sizeof(struct rotary_encoder_platform_data), | ||
165 | GFP_KERNEL); | ||
166 | if (!pdata) | ||
167 | return ERR_PTR(-ENOMEM); | ||
168 | |||
169 | of_property_read_u32(np, "rotary-encoder,steps", &pdata->steps); | ||
170 | of_property_read_u32(np, "linux,axis", &pdata->axis); | ||
171 | |||
172 | pdata->gpio_a = of_get_gpio_flags(np, 0, &flags); | ||
173 | pdata->inverted_a = flags & OF_GPIO_ACTIVE_LOW; | ||
174 | |||
175 | pdata->gpio_b = of_get_gpio_flags(np, 1, &flags); | ||
176 | pdata->inverted_b = flags & OF_GPIO_ACTIVE_LOW; | ||
177 | |||
178 | pdata->relative_axis = !!of_get_property(np, | ||
179 | "rotary-encoder,relative-axis", NULL); | ||
180 | pdata->rollover = !!of_get_property(np, | ||
181 | "rotary-encoder,rollover", NULL); | ||
182 | pdata->half_period = !!of_get_property(np, | ||
183 | "rotary-encoder,half-period", NULL); | ||
184 | |||
185 | return pdata; | ||
186 | } | ||
187 | #else | ||
188 | static inline struct rotary_encoder_platform_data * | ||
189 | rotary_encoder_parse_dt(struct device *dev) | ||
190 | { | ||
191 | return NULL; | ||
192 | } | ||
193 | #endif | ||
194 | |||
143 | static int __devinit rotary_encoder_probe(struct platform_device *pdev) | 195 | static int __devinit rotary_encoder_probe(struct platform_device *pdev) |
144 | { | 196 | { |
145 | struct rotary_encoder_platform_data *pdata = pdev->dev.platform_data; | 197 | struct device *dev = &pdev->dev; |
198 | const struct rotary_encoder_platform_data *pdata = dev_get_platdata(dev); | ||
146 | struct rotary_encoder *encoder; | 199 | struct rotary_encoder *encoder; |
147 | struct input_dev *input; | 200 | struct input_dev *input; |
148 | irq_handler_t handler; | 201 | irq_handler_t handler; |
149 | int err; | 202 | int err; |
150 | 203 | ||
151 | if (!pdata) { | 204 | if (!pdata) { |
152 | dev_err(&pdev->dev, "missing platform data\n"); | 205 | pdata = rotary_encoder_parse_dt(dev); |
153 | return -ENOENT; | 206 | if (IS_ERR(pdata)) |
207 | return PTR_ERR(pdata); | ||
208 | |||
209 | if (!pdata) { | ||
210 | dev_err(dev, "missing platform data\n"); | ||
211 | return -EINVAL; | ||
212 | } | ||
154 | } | 213 | } |
155 | 214 | ||
156 | encoder = kzalloc(sizeof(struct rotary_encoder), GFP_KERNEL); | 215 | encoder = kzalloc(sizeof(struct rotary_encoder), GFP_KERNEL); |
157 | input = input_allocate_device(); | 216 | input = input_allocate_device(); |
158 | if (!encoder || !input) { | 217 | if (!encoder || !input) { |
159 | dev_err(&pdev->dev, "failed to allocate memory for device\n"); | ||
160 | err = -ENOMEM; | 218 | err = -ENOMEM; |
161 | goto exit_free_mem; | 219 | goto exit_free_mem; |
162 | } | 220 | } |
163 | 221 | ||
164 | encoder->input = input; | 222 | encoder->input = input; |
165 | encoder->pdata = pdata; | 223 | encoder->pdata = pdata; |
166 | encoder->irq_a = gpio_to_irq(pdata->gpio_a); | ||
167 | encoder->irq_b = gpio_to_irq(pdata->gpio_b); | ||
168 | 224 | ||
169 | /* create and register the input driver */ | ||
170 | input->name = pdev->name; | 225 | input->name = pdev->name; |
171 | input->id.bustype = BUS_HOST; | 226 | input->id.bustype = BUS_HOST; |
172 | input->dev.parent = &pdev->dev; | 227 | input->dev.parent = dev; |
173 | 228 | ||
174 | if (pdata->relative_axis) { | 229 | if (pdata->relative_axis) { |
175 | input->evbit[0] = BIT_MASK(EV_REL); | 230 | input->evbit[0] = BIT_MASK(EV_REL); |
@@ -180,40 +235,21 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
180 | pdata->axis, 0, pdata->steps, 0, 1); | 235 | pdata->axis, 0, pdata->steps, 0, 1); |
181 | } | 236 | } |
182 | 237 | ||
183 | err = input_register_device(input); | ||
184 | if (err) { | ||
185 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
186 | goto exit_free_mem; | ||
187 | } | ||
188 | |||
189 | /* request the GPIOs */ | 238 | /* request the GPIOs */ |
190 | err = gpio_request(pdata->gpio_a, DRV_NAME); | 239 | err = gpio_request_one(pdata->gpio_a, GPIOF_IN, dev_name(dev)); |
191 | if (err) { | ||
192 | dev_err(&pdev->dev, "unable to request GPIO %d\n", | ||
193 | pdata->gpio_a); | ||
194 | goto exit_unregister_input; | ||
195 | } | ||
196 | |||
197 | err = gpio_direction_input(pdata->gpio_a); | ||
198 | if (err) { | 240 | if (err) { |
199 | dev_err(&pdev->dev, "unable to set GPIO %d for input\n", | 241 | dev_err(dev, "unable to request GPIO %d\n", pdata->gpio_a); |
200 | pdata->gpio_a); | 242 | goto exit_free_mem; |
201 | goto exit_unregister_input; | ||
202 | } | 243 | } |
203 | 244 | ||
204 | err = gpio_request(pdata->gpio_b, DRV_NAME); | 245 | err = gpio_request_one(pdata->gpio_b, GPIOF_IN, dev_name(dev)); |
205 | if (err) { | 246 | if (err) { |
206 | dev_err(&pdev->dev, "unable to request GPIO %d\n", | 247 | dev_err(dev, "unable to request GPIO %d\n", pdata->gpio_b); |
207 | pdata->gpio_b); | ||
208 | goto exit_free_gpio_a; | 248 | goto exit_free_gpio_a; |
209 | } | 249 | } |
210 | 250 | ||
211 | err = gpio_direction_input(pdata->gpio_b); | 251 | encoder->irq_a = gpio_to_irq(pdata->gpio_a); |
212 | if (err) { | 252 | encoder->irq_b = gpio_to_irq(pdata->gpio_b); |
213 | dev_err(&pdev->dev, "unable to set GPIO %d for input\n", | ||
214 | pdata->gpio_b); | ||
215 | goto exit_free_gpio_a; | ||
216 | } | ||
217 | 253 | ||
218 | /* request the IRQs */ | 254 | /* request the IRQs */ |
219 | if (pdata->half_period) { | 255 | if (pdata->half_period) { |
@@ -227,8 +263,7 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
227 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 263 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
228 | DRV_NAME, encoder); | 264 | DRV_NAME, encoder); |
229 | if (err) { | 265 | if (err) { |
230 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 266 | dev_err(dev, "unable to request IRQ %d\n", encoder->irq_a); |
231 | encoder->irq_a); | ||
232 | goto exit_free_gpio_b; | 267 | goto exit_free_gpio_b; |
233 | } | 268 | } |
234 | 269 | ||
@@ -236,43 +271,55 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
236 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 271 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
237 | DRV_NAME, encoder); | 272 | DRV_NAME, encoder); |
238 | if (err) { | 273 | if (err) { |
239 | dev_err(&pdev->dev, "unable to request IRQ %d\n", | 274 | dev_err(dev, "unable to request IRQ %d\n", encoder->irq_b); |
240 | encoder->irq_b); | ||
241 | goto exit_free_irq_a; | 275 | goto exit_free_irq_a; |
242 | } | 276 | } |
243 | 277 | ||
278 | err = input_register_device(input); | ||
279 | if (err) { | ||
280 | dev_err(dev, "failed to register input device\n"); | ||
281 | goto exit_free_irq_b; | ||
282 | } | ||
283 | |||
244 | platform_set_drvdata(pdev, encoder); | 284 | platform_set_drvdata(pdev, encoder); |
245 | 285 | ||
246 | return 0; | 286 | return 0; |
247 | 287 | ||
288 | exit_free_irq_b: | ||
289 | free_irq(encoder->irq_b, encoder); | ||
248 | exit_free_irq_a: | 290 | exit_free_irq_a: |
249 | free_irq(encoder->irq_a, encoder); | 291 | free_irq(encoder->irq_a, encoder); |
250 | exit_free_gpio_b: | 292 | exit_free_gpio_b: |
251 | gpio_free(pdata->gpio_b); | 293 | gpio_free(pdata->gpio_b); |
252 | exit_free_gpio_a: | 294 | exit_free_gpio_a: |
253 | gpio_free(pdata->gpio_a); | 295 | gpio_free(pdata->gpio_a); |
254 | exit_unregister_input: | ||
255 | input_unregister_device(input); | ||
256 | input = NULL; /* so we don't try to free it */ | ||
257 | exit_free_mem: | 296 | exit_free_mem: |
258 | input_free_device(input); | 297 | input_free_device(input); |
259 | kfree(encoder); | 298 | kfree(encoder); |
299 | if (!dev_get_platdata(&pdev->dev)) | ||
300 | kfree(pdata); | ||
301 | |||
260 | return err; | 302 | return err; |
261 | } | 303 | } |
262 | 304 | ||
263 | static int __devexit rotary_encoder_remove(struct platform_device *pdev) | 305 | static int __devexit rotary_encoder_remove(struct platform_device *pdev) |
264 | { | 306 | { |
265 | struct rotary_encoder *encoder = platform_get_drvdata(pdev); | 307 | struct rotary_encoder *encoder = platform_get_drvdata(pdev); |
266 | struct rotary_encoder_platform_data *pdata = pdev->dev.platform_data; | 308 | const struct rotary_encoder_platform_data *pdata = encoder->pdata; |
267 | 309 | ||
268 | free_irq(encoder->irq_a, encoder); | 310 | free_irq(encoder->irq_a, encoder); |
269 | free_irq(encoder->irq_b, encoder); | 311 | free_irq(encoder->irq_b, encoder); |
270 | gpio_free(pdata->gpio_a); | 312 | gpio_free(pdata->gpio_a); |
271 | gpio_free(pdata->gpio_b); | 313 | gpio_free(pdata->gpio_b); |
314 | |||
272 | input_unregister_device(encoder->input); | 315 | input_unregister_device(encoder->input); |
273 | platform_set_drvdata(pdev, NULL); | ||
274 | kfree(encoder); | 316 | kfree(encoder); |
275 | 317 | ||
318 | if (!dev_get_platdata(&pdev->dev)) | ||
319 | kfree(pdata); | ||
320 | |||
321 | platform_set_drvdata(pdev, NULL); | ||
322 | |||
276 | return 0; | 323 | return 0; |
277 | } | 324 | } |
278 | 325 | ||
@@ -282,6 +329,7 @@ static struct platform_driver rotary_encoder_driver = { | |||
282 | .driver = { | 329 | .driver = { |
283 | .name = DRV_NAME, | 330 | .name = DRV_NAME, |
284 | .owner = THIS_MODULE, | 331 | .owner = THIS_MODULE, |
332 | .of_match_table = of_match_ptr(rotary_encoder_of_match), | ||
285 | } | 333 | } |
286 | }; | 334 | }; |
287 | module_platform_driver(rotary_encoder_driver); | 335 | module_platform_driver(rotary_encoder_driver); |
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index 38e4b507b94c..b3dd96d6448b 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -42,6 +42,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr) | |||
42 | err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, | 42 | err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, |
43 | STS_HW_CONDITIONS); | 43 | STS_HW_CONDITIONS); |
44 | if (!err) { | 44 | if (!err) { |
45 | pm_wakeup_event(pwr->dev.parent, 0); | ||
45 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); | 46 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); |
46 | input_sync(pwr); | 47 | input_sync(pwr); |
47 | } else { | 48 | } else { |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 6b1797503e34..a0a4bbaef02c 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -40,7 +40,8 @@ | |||
40 | #include <linux/input/mt.h> | 40 | #include <linux/input/mt.h> |
41 | #include "../input-compat.h" | 41 | #include "../input-compat.h" |
42 | 42 | ||
43 | static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 43 | static int uinput_dev_event(struct input_dev *dev, |
44 | unsigned int type, unsigned int code, int value) | ||
44 | { | 45 | { |
45 | struct uinput_device *udev = input_get_drvdata(dev); | 46 | struct uinput_device *udev = input_get_drvdata(dev); |
46 | 47 | ||
@@ -56,10 +57,11 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i | |||
56 | } | 57 | } |
57 | 58 | ||
58 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ | 59 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ |
59 | static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request) | 60 | static bool uinput_request_alloc_id(struct uinput_device *udev, |
61 | struct uinput_request *request) | ||
60 | { | 62 | { |
61 | int id; | 63 | unsigned int id; |
62 | int err = -1; | 64 | bool reserved = false; |
63 | 65 | ||
64 | spin_lock(&udev->requests_lock); | 66 | spin_lock(&udev->requests_lock); |
65 | 67 | ||
@@ -67,32 +69,35 @@ static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_req | |||
67 | if (!udev->requests[id]) { | 69 | if (!udev->requests[id]) { |
68 | request->id = id; | 70 | request->id = id; |
69 | udev->requests[id] = request; | 71 | udev->requests[id] = request; |
70 | err = 0; | 72 | reserved = true; |
71 | break; | 73 | break; |
72 | } | 74 | } |
73 | } | 75 | } |
74 | 76 | ||
75 | spin_unlock(&udev->requests_lock); | 77 | spin_unlock(&udev->requests_lock); |
76 | return err; | 78 | return reserved; |
77 | } | 79 | } |
78 | 80 | ||
79 | static struct uinput_request *uinput_request_find(struct uinput_device *udev, int id) | 81 | static struct uinput_request *uinput_request_find(struct uinput_device *udev, |
82 | unsigned int id) | ||
80 | { | 83 | { |
81 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ | 84 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ |
82 | if (id >= UINPUT_NUM_REQUESTS || id < 0) | 85 | if (id >= UINPUT_NUM_REQUESTS) |
83 | return NULL; | 86 | return NULL; |
84 | 87 | ||
85 | return udev->requests[id]; | 88 | return udev->requests[id]; |
86 | } | 89 | } |
87 | 90 | ||
88 | static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request) | 91 | static int uinput_request_reserve_slot(struct uinput_device *udev, |
92 | struct uinput_request *request) | ||
89 | { | 93 | { |
90 | /* Allocate slot. If none are available right away, wait. */ | 94 | /* Allocate slot. If none are available right away, wait. */ |
91 | return wait_event_interruptible(udev->requests_waitq, | 95 | return wait_event_interruptible(udev->requests_waitq, |
92 | !uinput_request_alloc_id(udev, request)); | 96 | uinput_request_alloc_id(udev, request)); |
93 | } | 97 | } |
94 | 98 | ||
95 | static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) | 99 | static void uinput_request_done(struct uinput_device *udev, |
100 | struct uinput_request *request) | ||
96 | { | 101 | { |
97 | /* Mark slot as available */ | 102 | /* Mark slot as available */ |
98 | udev->requests[request->id] = NULL; | 103 | udev->requests[request->id] = NULL; |
@@ -101,14 +106,11 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques | |||
101 | complete(&request->done); | 106 | complete(&request->done); |
102 | } | 107 | } |
103 | 108 | ||
104 | static int uinput_request_submit(struct uinput_device *udev, struct uinput_request *request) | 109 | static int uinput_request_send(struct uinput_device *udev, |
110 | struct uinput_request *request) | ||
105 | { | 111 | { |
106 | int retval; | 112 | int retval; |
107 | 113 | ||
108 | retval = uinput_request_reserve_slot(udev, request); | ||
109 | if (retval) | ||
110 | return retval; | ||
111 | |||
112 | retval = mutex_lock_interruptible(&udev->mutex); | 114 | retval = mutex_lock_interruptible(&udev->mutex); |
113 | if (retval) | 115 | if (retval) |
114 | return retval; | 116 | return retval; |
@@ -118,7 +120,12 @@ static int uinput_request_submit(struct uinput_device *udev, struct uinput_reque | |||
118 | goto out; | 120 | goto out; |
119 | } | 121 | } |
120 | 122 | ||
121 | /* Tell our userspace app about this new request by queueing an input event */ | 123 | init_completion(&request->done); |
124 | |||
125 | /* | ||
126 | * Tell our userspace application about this new request | ||
127 | * by queueing an input event. | ||
128 | */ | ||
122 | uinput_dev_event(udev->dev, EV_UINPUT, request->code, request->id); | 129 | uinput_dev_event(udev->dev, EV_UINPUT, request->code, request->id); |
123 | 130 | ||
124 | out: | 131 | out: |
@@ -126,8 +133,27 @@ static int uinput_request_submit(struct uinput_device *udev, struct uinput_reque | |||
126 | return retval; | 133 | return retval; |
127 | } | 134 | } |
128 | 135 | ||
136 | static int uinput_request_submit(struct uinput_device *udev, | ||
137 | struct uinput_request *request) | ||
138 | { | ||
139 | int error; | ||
140 | |||
141 | error = uinput_request_reserve_slot(udev, request); | ||
142 | if (error) | ||
143 | return error; | ||
144 | |||
145 | error = uinput_request_send(udev, request); | ||
146 | if (error) { | ||
147 | uinput_request_done(udev, request); | ||
148 | return error; | ||
149 | } | ||
150 | |||
151 | wait_for_completion(&request->done); | ||
152 | return request->retval; | ||
153 | } | ||
154 | |||
129 | /* | 155 | /* |
130 | * Fail all ouitstanding requests so handlers don't wait for the userspace | 156 | * Fail all outstanding requests so handlers don't wait for the userspace |
131 | * to finish processing them. | 157 | * to finish processing them. |
132 | */ | 158 | */ |
133 | static void uinput_flush_requests(struct uinput_device *udev) | 159 | static void uinput_flush_requests(struct uinput_device *udev) |
@@ -163,11 +189,12 @@ static int uinput_dev_playback(struct input_dev *dev, int effect_id, int value) | |||
163 | return uinput_dev_event(dev, EV_FF, effect_id, value); | 189 | return uinput_dev_event(dev, EV_FF, effect_id, value); |
164 | } | 190 | } |
165 | 191 | ||
166 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect, struct ff_effect *old) | 192 | static int uinput_dev_upload_effect(struct input_dev *dev, |
193 | struct ff_effect *effect, | ||
194 | struct ff_effect *old) | ||
167 | { | 195 | { |
168 | struct uinput_device *udev = input_get_drvdata(dev); | 196 | struct uinput_device *udev = input_get_drvdata(dev); |
169 | struct uinput_request request; | 197 | struct uinput_request request; |
170 | int retval; | ||
171 | 198 | ||
172 | /* | 199 | /* |
173 | * uinput driver does not currently support periodic effects with | 200 | * uinput driver does not currently support periodic effects with |
@@ -180,42 +207,25 @@ static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *eff | |||
180 | effect->u.periodic.waveform == FF_CUSTOM) | 207 | effect->u.periodic.waveform == FF_CUSTOM) |
181 | return -EINVAL; | 208 | return -EINVAL; |
182 | 209 | ||
183 | request.id = -1; | ||
184 | init_completion(&request.done); | ||
185 | request.code = UI_FF_UPLOAD; | 210 | request.code = UI_FF_UPLOAD; |
186 | request.u.upload.effect = effect; | 211 | request.u.upload.effect = effect; |
187 | request.u.upload.old = old; | 212 | request.u.upload.old = old; |
188 | 213 | ||
189 | retval = uinput_request_submit(udev, &request); | 214 | return uinput_request_submit(udev, &request); |
190 | if (!retval) { | ||
191 | wait_for_completion(&request.done); | ||
192 | retval = request.retval; | ||
193 | } | ||
194 | |||
195 | return retval; | ||
196 | } | 215 | } |
197 | 216 | ||
198 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | 217 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) |
199 | { | 218 | { |
200 | struct uinput_device *udev = input_get_drvdata(dev); | 219 | struct uinput_device *udev = input_get_drvdata(dev); |
201 | struct uinput_request request; | 220 | struct uinput_request request; |
202 | int retval; | ||
203 | 221 | ||
204 | if (!test_bit(EV_FF, dev->evbit)) | 222 | if (!test_bit(EV_FF, dev->evbit)) |
205 | return -ENOSYS; | 223 | return -ENOSYS; |
206 | 224 | ||
207 | request.id = -1; | ||
208 | init_completion(&request.done); | ||
209 | request.code = UI_FF_ERASE; | 225 | request.code = UI_FF_ERASE; |
210 | request.u.effect_id = effect_id; | 226 | request.u.effect_id = effect_id; |
211 | 227 | ||
212 | retval = uinput_request_submit(udev, &request); | 228 | return uinput_request_submit(udev, &request); |
213 | if (!retval) { | ||
214 | wait_for_completion(&request.done); | ||
215 | retval = request.retval; | ||
216 | } | ||
217 | |||
218 | return retval; | ||
219 | } | 229 | } |
220 | 230 | ||
221 | static void uinput_destroy_device(struct uinput_device *udev) | 231 | static void uinput_destroy_device(struct uinput_device *udev) |
@@ -347,7 +357,8 @@ static int uinput_allocate_device(struct uinput_device *udev) | |||
347 | return 0; | 357 | return 0; |
348 | } | 358 | } |
349 | 359 | ||
350 | static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count) | 360 | static int uinput_setup_device(struct uinput_device *udev, |
361 | const char __user *buffer, size_t count) | ||
351 | { | 362 | { |
352 | struct uinput_user_dev *user_dev; | 363 | struct uinput_user_dev *user_dev; |
353 | struct input_dev *dev; | 364 | struct input_dev *dev; |
@@ -419,7 +430,8 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu | |||
419 | return retval; | 430 | return retval; |
420 | } | 431 | } |
421 | 432 | ||
422 | static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count) | 433 | static ssize_t uinput_inject_event(struct uinput_device *udev, |
434 | const char __user *buffer, size_t count) | ||
423 | { | 435 | { |
424 | struct input_event ev; | 436 | struct input_event ev; |
425 | 437 | ||
@@ -434,11 +446,15 @@ static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char | |||
434 | return input_event_size(); | 446 | return input_event_size(); |
435 | } | 447 | } |
436 | 448 | ||
437 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 449 | static ssize_t uinput_write(struct file *file, const char __user *buffer, |
450 | size_t count, loff_t *ppos) | ||
438 | { | 451 | { |
439 | struct uinput_device *udev = file->private_data; | 452 | struct uinput_device *udev = file->private_data; |
440 | int retval; | 453 | int retval; |
441 | 454 | ||
455 | if (count == 0) | ||
456 | return 0; | ||
457 | |||
442 | retval = mutex_lock_interruptible(&udev->mutex); | 458 | retval = mutex_lock_interruptible(&udev->mutex); |
443 | if (retval) | 459 | if (retval) |
444 | return retval; | 460 | return retval; |
@@ -452,42 +468,74 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t | |||
452 | return retval; | 468 | return retval; |
453 | } | 469 | } |
454 | 470 | ||
455 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 471 | static bool uinput_fetch_next_event(struct uinput_device *udev, |
472 | struct input_event *event) | ||
456 | { | 473 | { |
457 | struct uinput_device *udev = file->private_data; | 474 | bool have_event; |
458 | int retval = 0; | ||
459 | 475 | ||
460 | if (udev->state != UIST_CREATED) | 476 | spin_lock_irq(&udev->dev->event_lock); |
461 | return -ENODEV; | ||
462 | 477 | ||
463 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) | 478 | have_event = udev->head != udev->tail; |
464 | return -EAGAIN; | 479 | if (have_event) { |
480 | *event = udev->buff[udev->tail]; | ||
481 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | ||
482 | } | ||
465 | 483 | ||
466 | retval = wait_event_interruptible(udev->waitq, | 484 | spin_unlock_irq(&udev->dev->event_lock); |
467 | udev->head != udev->tail || udev->state != UIST_CREATED); | ||
468 | if (retval) | ||
469 | return retval; | ||
470 | 485 | ||
471 | retval = mutex_lock_interruptible(&udev->mutex); | 486 | return have_event; |
472 | if (retval) | 487 | } |
473 | return retval; | ||
474 | 488 | ||
475 | if (udev->state != UIST_CREATED) { | 489 | static ssize_t uinput_events_to_user(struct uinput_device *udev, |
476 | retval = -ENODEV; | 490 | char __user *buffer, size_t count) |
477 | goto out; | 491 | { |
478 | } | 492 | struct input_event event; |
493 | size_t read = 0; | ||
479 | 494 | ||
480 | while (udev->head != udev->tail && retval + input_event_size() <= count) { | 495 | while (read + input_event_size() <= count && |
481 | if (input_event_to_user(buffer + retval, &udev->buff[udev->tail])) { | 496 | uinput_fetch_next_event(udev, &event)) { |
482 | retval = -EFAULT; | 497 | |
483 | goto out; | 498 | if (input_event_to_user(buffer + read, &event)) |
484 | } | 499 | return -EFAULT; |
485 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 500 | |
486 | retval += input_event_size(); | 501 | read += input_event_size(); |
487 | } | 502 | } |
488 | 503 | ||
489 | out: | 504 | return read; |
490 | mutex_unlock(&udev->mutex); | 505 | } |
506 | |||
507 | static ssize_t uinput_read(struct file *file, char __user *buffer, | ||
508 | size_t count, loff_t *ppos) | ||
509 | { | ||
510 | struct uinput_device *udev = file->private_data; | ||
511 | ssize_t retval; | ||
512 | |||
513 | if (count != 0 && count < input_event_size()) | ||
514 | return -EINVAL; | ||
515 | |||
516 | do { | ||
517 | retval = mutex_lock_interruptible(&udev->mutex); | ||
518 | if (retval) | ||
519 | return retval; | ||
520 | |||
521 | if (udev->state != UIST_CREATED) | ||
522 | retval = -ENODEV; | ||
523 | else if (udev->head == udev->tail && | ||
524 | (file->f_flags & O_NONBLOCK)) | ||
525 | retval = -EAGAIN; | ||
526 | else | ||
527 | retval = uinput_events_to_user(udev, buffer, count); | ||
528 | |||
529 | mutex_unlock(&udev->mutex); | ||
530 | |||
531 | if (retval || count == 0) | ||
532 | break; | ||
533 | |||
534 | if (!(file->f_flags & O_NONBLOCK)) | ||
535 | retval = wait_event_interruptible(udev->waitq, | ||
536 | udev->head != udev->tail || | ||
537 | udev->state != UIST_CREATED); | ||
538 | } while (retval == 0); | ||
491 | 539 | ||
492 | return retval; | 540 | return retval; |
493 | } | 541 | } |
@@ -516,8 +564,8 @@ static int uinput_release(struct inode *inode, struct file *file) | |||
516 | 564 | ||
517 | #ifdef CONFIG_COMPAT | 565 | #ifdef CONFIG_COMPAT |
518 | struct uinput_ff_upload_compat { | 566 | struct uinput_ff_upload_compat { |
519 | int request_id; | 567 | __u32 request_id; |
520 | int retval; | 568 | __s32 retval; |
521 | struct ff_effect_compat effect; | 569 | struct ff_effect_compat effect; |
522 | struct ff_effect_compat old; | 570 | struct ff_effect_compat old; |
523 | }; | 571 | }; |
@@ -703,7 +751,8 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd, | |||
703 | break; | 751 | break; |
704 | 752 | ||
705 | req = uinput_request_find(udev, ff_up.request_id); | 753 | req = uinput_request_find(udev, ff_up.request_id); |
706 | if (!req || req->code != UI_FF_UPLOAD || !req->u.upload.effect) { | 754 | if (!req || req->code != UI_FF_UPLOAD || |
755 | !req->u.upload.effect) { | ||
707 | retval = -EINVAL; | 756 | retval = -EINVAL; |
708 | break; | 757 | break; |
709 | } | 758 | } |
@@ -786,7 +835,8 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
786 | } | 835 | } |
787 | 836 | ||
788 | #ifdef CONFIG_COMPAT | 837 | #ifdef CONFIG_COMPAT |
789 | static long uinput_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 838 | static long uinput_compat_ioctl(struct file *file, |
839 | unsigned int cmd, unsigned long arg) | ||
790 | { | 840 | { |
791 | return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); | 841 | return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); |
792 | } | 842 | } |
@@ -831,4 +881,3 @@ MODULE_VERSION("0.3"); | |||
831 | 881 | ||
832 | module_init(uinput_init); | 882 | module_init(uinput_init); |
833 | module_exit(uinput_exit); | 883 | module_exit(uinput_exit); |
834 | |||
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 575f880727fe..62be888e83d0 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -334,11 +334,8 @@ static bool hgpk_is_byte_valid(struct psmouse *psmouse, unsigned char *packet) | |||
334 | 334 | ||
335 | if (!valid) | 335 | if (!valid) |
336 | psmouse_dbg(psmouse, | 336 | psmouse_dbg(psmouse, |
337 | "bad data, mode %d (%d) %02x %02x %02x %02x %02x %02x\n", | 337 | "bad data, mode %d (%d) %*ph\n", |
338 | priv->mode, pktcnt, | 338 | priv->mode, pktcnt, 6, psmouse->packet); |
339 | psmouse->packet[0], psmouse->packet[1], | ||
340 | psmouse->packet[2], psmouse->packet[3], | ||
341 | psmouse->packet[4], psmouse->packet[5]); | ||
342 | 339 | ||
343 | return valid; | 340 | return valid; |
344 | } | 341 | } |
@@ -1030,7 +1027,7 @@ static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse) | |||
1030 | return -EIO; | 1027 | return -EIO; |
1031 | } | 1028 | } |
1032 | 1029 | ||
1033 | psmouse_dbg(psmouse, "ID: %02x %02x %02x\n", param[0], param[1], param[2]); | 1030 | psmouse_dbg(psmouse, "ID: %*ph\n", 3, param); |
1034 | 1031 | ||
1035 | /* HGPK signature: 0x67, 0x00, 0x<model> */ | 1032 | /* HGPK signature: 0x67, 0x00, 0x<model> */ |
1036 | if (param[0] != 0x67 || param[1] != 0x00) | 1033 | if (param[0] != 0x67 || param[1] != 0x00) |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 37033ade79d3..12d12ca3fee0 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -53,14 +53,19 @@ | |||
53 | #define ABS_POS_BITS 13 | 53 | #define ABS_POS_BITS 13 |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * Any position values from the hardware above the following limits are | 56 | * These values should represent the absolute maximum value that will |
57 | * treated as "wrapped around negative" values that have been truncated to | 57 | * be reported for a positive position value. Some Synaptics firmware |
58 | * the 13-bit reporting range of the hardware. These are just reasonable | 58 | * uses this value to indicate a finger near the edge of the touchpad |
59 | * guesses and can be adjusted if hardware is found that operates outside | 59 | * whose precise position cannot be determined. |
60 | * of these parameters. | 60 | * |
61 | * At least one touchpad is known to report positions in excess of this | ||
62 | * value which are actually negative values truncated to the 13-bit | ||
63 | * reporting range. These values have never been observed to be lower | ||
64 | * than 8184 (i.e. -8), so we treat all values greater than 8176 as | ||
65 | * negative and any other value as positive. | ||
61 | */ | 66 | */ |
62 | #define X_MAX_POSITIVE (((1 << ABS_POS_BITS) + XMAX) / 2) | 67 | #define X_MAX_POSITIVE 8176 |
63 | #define Y_MAX_POSITIVE (((1 << ABS_POS_BITS) + YMAX) / 2) | 68 | #define Y_MAX_POSITIVE 8176 |
64 | 69 | ||
65 | /***************************************************************************** | 70 | /***************************************************************************** |
66 | * Stuff we need even when we do not want native Synaptics support | 71 | * Stuff we need even when we do not want native Synaptics support |
@@ -604,11 +609,21 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
604 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 609 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
605 | } | 610 | } |
606 | 611 | ||
607 | /* Convert wrap-around values to negative */ | 612 | /* |
613 | * Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE | ||
614 | * is used by some firmware to indicate a finger at the edge of | ||
615 | * the touchpad whose precise position cannot be determined, so | ||
616 | * convert these values to the maximum axis value. | ||
617 | */ | ||
608 | if (hw->x > X_MAX_POSITIVE) | 618 | if (hw->x > X_MAX_POSITIVE) |
609 | hw->x -= 1 << ABS_POS_BITS; | 619 | hw->x -= 1 << ABS_POS_BITS; |
620 | else if (hw->x == X_MAX_POSITIVE) | ||
621 | hw->x = XMAX; | ||
622 | |||
610 | if (hw->y > Y_MAX_POSITIVE) | 623 | if (hw->y > Y_MAX_POSITIVE) |
611 | hw->y -= 1 << ABS_POS_BITS; | 624 | hw->y -= 1 << ABS_POS_BITS; |
625 | else if (hw->y == Y_MAX_POSITIVE) | ||
626 | hw->y = YMAX; | ||
612 | 627 | ||
613 | return 0; | 628 | return 0; |
614 | } | 629 | } |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 0110b5a3a167..964e43d81e29 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -551,17 +551,16 @@ static int mousedev_open(struct inode *inode, struct file *file) | |||
551 | return -ENODEV; | 551 | return -ENODEV; |
552 | 552 | ||
553 | error = mutex_lock_interruptible(&mousedev_table_mutex); | 553 | error = mutex_lock_interruptible(&mousedev_table_mutex); |
554 | if (error) { | 554 | if (error) |
555 | return error; | 555 | return error; |
556 | } | 556 | |
557 | mousedev = mousedev_table[i]; | 557 | mousedev = mousedev_table[i]; |
558 | if (mousedev) | 558 | if (mousedev) |
559 | get_device(&mousedev->dev); | 559 | get_device(&mousedev->dev); |
560 | mutex_unlock(&mousedev_table_mutex); | 560 | mutex_unlock(&mousedev_table_mutex); |
561 | 561 | ||
562 | if (!mousedev) { | 562 | if (!mousedev) |
563 | return -ENODEV; | 563 | return -ENODEV; |
564 | } | ||
565 | 564 | ||
566 | client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); | 565 | client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL); |
567 | if (!client) { | 566 | if (!client) { |
@@ -1088,7 +1087,7 @@ static int __init mousedev_init(void) | |||
1088 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX | 1087 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX |
1089 | error = misc_register(&psaux_mouse); | 1088 | error = misc_register(&psaux_mouse); |
1090 | if (error) | 1089 | if (error) |
1091 | pr_warning("could not register psaux device, error: %d\n", | 1090 | pr_warn("could not register psaux device, error: %d\n", |
1092 | error); | 1091 | error); |
1093 | else | 1092 | else |
1094 | psaux_registered = 1; | 1093 | psaux_registered = 1; |
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index 75fb040a3435..a70aa555bbff 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c | |||
@@ -180,11 +180,11 @@ int sparse_keymap_setup(struct input_dev *dev, | |||
180 | for (e = keymap; e->type != KE_END; e++) | 180 | for (e = keymap; e->type != KE_END; e++) |
181 | map_size++; | 181 | map_size++; |
182 | 182 | ||
183 | map = kcalloc(map_size, sizeof (struct key_entry), GFP_KERNEL); | 183 | map = kcalloc(map_size, sizeof(struct key_entry), GFP_KERNEL); |
184 | if (!map) | 184 | if (!map) |
185 | return -ENOMEM; | 185 | return -ENOMEM; |
186 | 186 | ||
187 | memcpy(map, keymap, map_size * sizeof (struct key_entry)); | 187 | memcpy(map, keymap, map_size * sizeof(struct key_entry)); |
188 | 188 | ||
189 | for (i = 0; i < map_size; i++) { | 189 | for (i = 0; i < map_size; i++) { |
190 | entry = &map[i]; | 190 | entry = &map[i]; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 2a81ce375f75..08b462b6c0d8 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -606,7 +606,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
606 | input_report_abs(input, ABS_WHEEL, 0); | 606 | input_report_abs(input, ABS_WHEEL, 0); |
607 | } | 607 | } |
608 | 608 | ||
609 | if (data[2] | (data[3] & 0x01) | data[4]) { | 609 | if (data[2] | (data[3] & 0x01) | data[4] | data[5]) { |
610 | input_report_key(input, wacom->tool[1], 1); | 610 | input_report_key(input, wacom->tool[1], 1); |
611 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 611 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
612 | } else { | 612 | } else { |
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index df9e816d55e4..549fa29548f8 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -406,7 +406,7 @@ static int s3c2410ts_resume(struct device *dev) | |||
406 | return 0; | 406 | return 0; |
407 | } | 407 | } |
408 | 408 | ||
409 | static struct dev_pm_ops s3c_ts_pmops = { | 409 | static const struct dev_pm_ops s3c_ts_pmops = { |
410 | .suspend = s3c2410ts_suspend, | 410 | .suspend = s3c2410ts_suspend, |
411 | .resume = s3c2410ts_resume, | 411 | .resume = s3c2410ts_resume, |
412 | }; | 412 | }; |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 59f8db4a39a7..9c03a3ae898f 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -903,6 +903,8 @@ COMPATIBLE_IOCTL(KDGKBSENT) | |||
903 | COMPATIBLE_IOCTL(KDSKBSENT) | 903 | COMPATIBLE_IOCTL(KDSKBSENT) |
904 | COMPATIBLE_IOCTL(KDGKBDIACR) | 904 | COMPATIBLE_IOCTL(KDGKBDIACR) |
905 | COMPATIBLE_IOCTL(KDSKBDIACR) | 905 | COMPATIBLE_IOCTL(KDSKBDIACR) |
906 | COMPATIBLE_IOCTL(KDGKBDIACRUC) | ||
907 | COMPATIBLE_IOCTL(KDSKBDIACRUC) | ||
906 | COMPATIBLE_IOCTL(KDKBDREP) | 908 | COMPATIBLE_IOCTL(KDKBDREP) |
907 | COMPATIBLE_IOCTL(KDGKBLED) | 909 | COMPATIBLE_IOCTL(KDGKBLED) |
908 | COMPATIBLE_IOCTL(KDGETLED) | 910 | COMPATIBLE_IOCTL(KDGETLED) |
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/include/linux/input/tegra_kbc.h index a13025612939..a13025612939 100644 --- a/arch/arm/mach-tegra/include/mach/kbc.h +++ b/include/linux/input/tegra_kbc.h | |||
diff --git a/include/linux/uinput.h b/include/linux/uinput.h index 2aa2881b0df9..c454bbe39ee7 100644 --- a/include/linux/uinput.h +++ b/include/linux/uinput.h | |||
@@ -32,6 +32,7 @@ | |||
32 | * - first public version | 32 | * - first public version |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/types.h> | ||
35 | #include <linux/input.h> | 36 | #include <linux/input.h> |
36 | 37 | ||
37 | #define UINPUT_VERSION 3 | 38 | #define UINPUT_VERSION 3 |
@@ -44,14 +45,14 @@ | |||
44 | enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED }; | 45 | enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED }; |
45 | 46 | ||
46 | struct uinput_request { | 47 | struct uinput_request { |
47 | int id; | 48 | unsigned int id; |
48 | int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ | 49 | unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ |
49 | 50 | ||
50 | int retval; | 51 | int retval; |
51 | struct completion done; | 52 | struct completion done; |
52 | 53 | ||
53 | union { | 54 | union { |
54 | int effect_id; | 55 | unsigned int effect_id; |
55 | struct { | 56 | struct { |
56 | struct ff_effect *effect; | 57 | struct ff_effect *effect; |
57 | struct ff_effect *old; | 58 | struct ff_effect *old; |
@@ -77,16 +78,16 @@ struct uinput_device { | |||
77 | #endif /* __KERNEL__ */ | 78 | #endif /* __KERNEL__ */ |
78 | 79 | ||
79 | struct uinput_ff_upload { | 80 | struct uinput_ff_upload { |
80 | int request_id; | 81 | __u32 request_id; |
81 | int retval; | 82 | __s32 retval; |
82 | struct ff_effect effect; | 83 | struct ff_effect effect; |
83 | struct ff_effect old; | 84 | struct ff_effect old; |
84 | }; | 85 | }; |
85 | 86 | ||
86 | struct uinput_ff_erase { | 87 | struct uinput_ff_erase { |
87 | int request_id; | 88 | __u32 request_id; |
88 | int retval; | 89 | __s32 retval; |
89 | int effect_id; | 90 | __u32 effect_id; |
90 | }; | 91 | }; |
91 | 92 | ||
92 | /* ioctl */ | 93 | /* ioctl */ |
@@ -166,11 +167,11 @@ struct uinput_ff_erase { | |||
166 | struct uinput_user_dev { | 167 | struct uinput_user_dev { |
167 | char name[UINPUT_MAX_NAME_SIZE]; | 168 | char name[UINPUT_MAX_NAME_SIZE]; |
168 | struct input_id id; | 169 | struct input_id id; |
169 | int ff_effects_max; | 170 | __u32 ff_effects_max; |
170 | int absmax[ABS_CNT]; | 171 | __s32 absmax[ABS_CNT]; |
171 | int absmin[ABS_CNT]; | 172 | __s32 absmin[ABS_CNT]; |
172 | int absfuzz[ABS_CNT]; | 173 | __s32 absfuzz[ABS_CNT]; |
173 | int absflat[ABS_CNT]; | 174 | __s32 absflat[ABS_CNT]; |
174 | }; | 175 | }; |
175 | #endif /* __UINPUT_H_ */ | 176 | #endif /* __UINPUT_H_ */ |
176 | 177 | ||