Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: matrix_keypad - increase the limit of rows and columns
Input: wacom - fix error path in wacom_probe()
Input: ads7846 - check proper condition when freeing gpio
Revert "Input: do not pass injected events back to the originating handler"
Input: sysrq - rework re-inject logic
Input: serio - clear pending rescans after sysfs driver rebind
Input: rotary_encoder - use proper irqflags
Input: wacom_w8001 - report resolution to userland

+72 -54
+11 -26
drivers/input/input.c
··· 75 75 * dev->event_lock held and interrupts disabled. 76 76 */ 77 77 static void input_pass_event(struct input_dev *dev, 78 - struct input_handler *src_handler, 79 78 unsigned int type, unsigned int code, int value) 80 79 { 81 80 struct input_handler *handler; ··· 93 94 continue; 94 95 95 96 handler = handle->handler; 96 - 97 - /* 98 - * If this is the handler that injected this 99 - * particular event we want to skip it to avoid 100 - * filters firing again and again. 101 - */ 102 - if (handler == src_handler) 103 - continue; 104 - 105 97 if (!handler->filter) { 106 98 if (filtered) 107 99 break; ··· 122 132 if (test_bit(dev->repeat_key, dev->key) && 123 133 is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { 124 134 125 - input_pass_event(dev, NULL, EV_KEY, dev->repeat_key, 2); 135 + input_pass_event(dev, EV_KEY, dev->repeat_key, 2); 126 136 127 137 if (dev->sync) { 128 138 /* ··· 131 141 * Otherwise assume that the driver will send 132 142 * SYN_REPORT once it's done. 133 143 */ 134 - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 144 + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 135 145 } 136 146 137 147 if (dev->rep[REP_PERIOD]) ··· 164 174 #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) 165 175 166 176 static int input_handle_abs_event(struct input_dev *dev, 167 - struct input_handler *src_handler, 168 177 unsigned int code, int *pval) 169 178 { 170 179 bool is_mt_event; ··· 207 218 /* Flush pending "slot" event */ 208 219 if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { 209 220 input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); 210 - input_pass_event(dev, src_handler, 211 - EV_ABS, ABS_MT_SLOT, dev->slot); 221 + input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); 212 222 } 213 223 214 224 return INPUT_PASS_TO_HANDLERS; 215 225 } 216 226 217 227 static void input_handle_event(struct input_dev *dev, 218 - struct input_handler *src_handler, 219 228 unsigned int type, unsigned int code, int value) 220 229 { 221 230 int disposition = INPUT_IGNORE_EVENT; ··· 266 279 267 280 case EV_ABS: 268 281 if (is_event_supported(code, dev->absbit, ABS_MAX)) 269 - disposition = input_handle_abs_event(dev, src_handler, 270 - code, &value); 282 + disposition = input_handle_abs_event(dev, code, &value); 271 283 272 284 break; 273 285 ··· 324 338 dev->event(dev, type, code, value); 325 339 326 340 if (disposition & INPUT_PASS_TO_HANDLERS) 327 - input_pass_event(dev, src_handler, type, code, value); 341 + input_pass_event(dev, type, code, value); 328 342 } 329 343 330 344 /** ··· 353 367 354 368 spin_lock_irqsave(&dev->event_lock, flags); 355 369 add_input_randomness(type, code, value); 356 - input_handle_event(dev, NULL, type, code, value); 370 + input_handle_event(dev, type, code, value); 357 371 spin_unlock_irqrestore(&dev->event_lock, flags); 358 372 } 359 373 } ··· 383 397 rcu_read_lock(); 384 398 grab = rcu_dereference(dev->grab); 385 399 if (!grab || grab == handle) 386 - input_handle_event(dev, handle->handler, 387 - type, code, value); 400 + input_handle_event(dev, type, code, value); 388 401 rcu_read_unlock(); 389 402 390 403 spin_unlock_irqrestore(&dev->event_lock, flags); ··· 596 611 for (code = 0; code <= KEY_MAX; code++) { 597 612 if (is_event_supported(code, dev->keybit, KEY_MAX) && 598 613 __test_and_clear_bit(code, dev->key)) { 599 - input_pass_event(dev, NULL, EV_KEY, code, 0); 614 + input_pass_event(dev, EV_KEY, code, 0); 600 615 } 601 616 } 602 - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 617 + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 603 618 } 604 619 } 605 620 ··· 874 889 !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && 875 890 __test_and_clear_bit(old_keycode, dev->key)) { 876 891 877 - input_pass_event(dev, NULL, EV_KEY, old_keycode, 0); 892 + input_pass_event(dev, EV_KEY, old_keycode, 0); 878 893 if (dev->sync) 879 - input_pass_event(dev, NULL, EV_SYN, SYN_REPORT, 1); 894 + input_pass_event(dev, EV_SYN, SYN_REPORT, 1); 880 895 } 881 896 882 897 out:
+2 -2
drivers/input/misc/rotary_encoder.c
··· 176 176 177 177 /* request the IRQs */ 178 178 err = request_irq(encoder->irq_a, &rotary_encoder_irq, 179 - IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, 179 + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 180 180 DRV_NAME, encoder); 181 181 if (err) { 182 182 dev_err(&pdev->dev, "unable to request IRQ %d\n", ··· 185 185 } 186 186 187 187 err = request_irq(encoder->irq_b, &rotary_encoder_irq, 188 - IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, 188 + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 189 189 DRV_NAME, encoder); 190 190 if (err) { 191 191 dev_err(&pdev->dev, "unable to request IRQ %d\n",
+7 -4
drivers/input/serio/serio.c
··· 188 188 kfree(event); 189 189 } 190 190 191 - static void serio_remove_duplicate_events(struct serio_event *event) 191 + static void serio_remove_duplicate_events(void *object, 192 + enum serio_event_type type) 192 193 { 193 194 struct serio_event *e, *next; 194 195 unsigned long flags; ··· 197 196 spin_lock_irqsave(&serio_event_lock, flags); 198 197 199 198 list_for_each_entry_safe(e, next, &serio_event_list, node) { 200 - if (event->object == e->object) { 199 + if (object == e->object) { 201 200 /* 202 201 * If this event is of different type we should not 203 202 * look further - we only suppress duplicate events 204 203 * that were sent back-to-back. 205 204 */ 206 - if (event->type != e->type) 205 + if (type != e->type) 207 206 break; 208 207 209 208 list_del_init(&e->node); ··· 246 245 break; 247 246 } 248 247 249 - serio_remove_duplicate_events(event); 248 + serio_remove_duplicate_events(event->object, event->type); 250 249 serio_free_event(event); 251 250 } 252 251 ··· 437 436 } else if (!strncmp(buf, "rescan", count)) { 438 437 serio_disconnect_port(serio); 439 438 serio_find_driver(serio); 439 + serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); 440 440 } else if ((drv = driver_find(buf, &serio_bus)) != NULL) { 441 441 serio_disconnect_port(serio); 442 442 error = serio_bind_driver(serio, to_serio_driver(drv)); 443 443 put_driver(drv); 444 + serio_remove_duplicate_events(serio, SERIO_RESCAN_PORT); 444 445 } else { 445 446 error = -EINVAL; 446 447 }
+1 -1
drivers/input/tablet/wacom_sys.c
··· 519 519 /* Retrieve the physical and logical size for OEM devices */ 520 520 error = wacom_retrieve_hid_descriptor(intf, features); 521 521 if (error) 522 - goto fail2; 522 + goto fail3; 523 523 524 524 wacom_setup_device_quirks(features); 525 525
+22 -16
drivers/input/touchscreen/ads7846.c
··· 941 941 struct ads7846_platform_data *pdata = spi->dev.platform_data; 942 942 int err; 943 943 944 - /* REVISIT when the irq can be triggered active-low, or if for some 944 + /* 945 + * REVISIT when the irq can be triggered active-low, or if for some 945 946 * reason the touchscreen isn't hooked up, we don't need to access 946 947 * the pendown state. 947 948 */ 948 - if (!pdata->get_pendown_state && !gpio_is_valid(pdata->gpio_pendown)) { 949 - dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); 950 - return -EINVAL; 951 - } 952 949 953 950 if (pdata->get_pendown_state) { 954 951 ts->get_pendown_state = pdata->get_pendown_state; 955 - return 0; 956 - } 952 + } else if (gpio_is_valid(pdata->gpio_pendown)) { 957 953 958 - err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); 959 - if (err) { 960 - dev_err(&spi->dev, "failed to request pendown GPIO%d\n", 961 - pdata->gpio_pendown); 962 - return err; 963 - } 954 + err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); 955 + if (err) { 956 + dev_err(&spi->dev, "failed to request pendown GPIO%d\n", 957 + pdata->gpio_pendown); 958 + return err; 959 + } 964 960 965 - ts->gpio_pendown = pdata->gpio_pendown; 961 + ts->gpio_pendown = pdata->gpio_pendown; 962 + 963 + } else { 964 + dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); 965 + return -EINVAL; 966 + } 966 967 967 968 return 0; 968 969 } ··· 1354 1353 err_put_regulator: 1355 1354 regulator_put(ts->reg); 1356 1355 err_free_gpio: 1357 - if (ts->gpio_pendown != -1) 1356 + if (!ts->get_pendown_state) 1358 1357 gpio_free(ts->gpio_pendown); 1359 1358 err_cleanup_filter: 1360 1359 if (ts->filter_cleanup) ··· 1384 1383 regulator_disable(ts->reg); 1385 1384 regulator_put(ts->reg); 1386 1385 1387 - if (ts->gpio_pendown != -1) 1386 + if (!ts->get_pendown_state) { 1387 + /* 1388 + * If we are not using specialized pendown method we must 1389 + * have been relying on gpio we set up ourselves. 1390 + */ 1388 1391 gpio_free(ts->gpio_pendown); 1392 + } 1389 1393 1390 1394 if (ts->filter_cleanup) 1391 1395 ts->filter_cleanup(ts->filter_data);
+11 -2
drivers/input/touchscreen/wacom_w8001.c
··· 51 51 #define W8001_PKTLEN_TPCCTL 11 /* control packet */ 52 52 #define W8001_PKTLEN_TOUCH2FG 13 53 53 54 + /* resolution in points/mm */ 55 + #define W8001_PEN_RESOLUTION 100 56 + #define W8001_TOUCH_RESOLUTION 10 57 + 54 58 struct w8001_coord { 55 59 u8 rdy; 56 60 u8 tsw; ··· 202 198 query->y = 1024; 203 199 if (query->panel_res) 204 200 query->x = query->y = (1 << query->panel_res); 205 - query->panel_res = 10; 201 + query->panel_res = W8001_TOUCH_RESOLUTION; 206 202 } 207 203 } 208 204 ··· 398 394 399 395 input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); 400 396 input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); 397 + input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); 398 + input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); 401 399 input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); 402 400 if (coord.tilt_x && coord.tilt_y) { 403 401 input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); ··· 424 418 w8001->max_touch_x = touch.x; 425 419 w8001->max_touch_y = touch.y; 426 420 427 - /* scale to pen maximum */ 428 421 if (w8001->max_pen_x && w8001->max_pen_y) { 422 + /* if pen is supported scale to pen maximum */ 429 423 touch.x = w8001->max_pen_x; 430 424 touch.y = w8001->max_pen_y; 425 + touch.panel_res = W8001_PEN_RESOLUTION; 431 426 } 432 427 433 428 input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); 434 429 input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); 430 + input_abs_set_res(dev, ABS_X, touch.panel_res); 431 + input_abs_set_res(dev, ABS_Y, touch.panel_res); 435 432 436 433 switch (touch.sensor_id) { 437 434 case 0:
+16 -1
drivers/tty/sysrq.c
··· 571 571 unsigned int alt_use; 572 572 bool active; 573 573 bool need_reinject; 574 + bool reinjecting; 574 575 }; 575 576 576 577 static void sysrq_reinject_alt_sysrq(struct work_struct *work) ··· 582 581 unsigned int alt_code = sysrq->alt_use; 583 582 584 583 if (sysrq->need_reinject) { 584 + /* we do not want the assignment to be reordered */ 585 + sysrq->reinjecting = true; 586 + mb(); 587 + 585 588 /* Simulate press and release of Alt + SysRq */ 586 589 input_inject_event(handle, EV_KEY, alt_code, 1); 587 590 input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); ··· 594 589 input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); 595 590 input_inject_event(handle, EV_KEY, alt_code, 0); 596 591 input_inject_event(handle, EV_SYN, SYN_REPORT, 1); 592 + 593 + mb(); 594 + sysrq->reinjecting = false; 597 595 } 598 596 } 599 597 ··· 606 598 struct sysrq_state *sysrq = handle->private; 607 599 bool was_active = sysrq->active; 608 600 bool suppress; 601 + 602 + /* 603 + * Do not filter anything if we are in the process of re-injecting 604 + * Alt+SysRq combination. 605 + */ 606 + if (sysrq->reinjecting) 607 + return false; 609 608 610 609 switch (type) { 611 610 ··· 644 629 sysrq->alt_use = sysrq->alt; 645 630 /* 646 631 * If nothing else will be pressed we'll need 647 - * to * re-inject Alt-SysRq keysroke. 632 + * to re-inject Alt-SysRq keysroke. 648 633 */ 649 634 sysrq->need_reinject = true; 650 635 }
+2 -2
include/linux/input/matrix_keypad.h
··· 4 4 #include <linux/types.h> 5 5 #include <linux/input.h> 6 6 7 - #define MATRIX_MAX_ROWS 16 8 - #define MATRIX_MAX_COLS 16 7 + #define MATRIX_MAX_ROWS 32 8 + #define MATRIX_MAX_COLS 32 9 9 10 10 #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ 11 11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\