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

Input: MT - Add flags to input_mt_init_slots()

Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>

+27 -22
+1 -1
drivers/hid/hid-magicmouse.c
··· 392 392 393 393 __set_bit(EV_ABS, input->evbit); 394 394 395 - error = input_mt_init_slots(input, 16); 395 + error = input_mt_init_slots(input, 16, 0); 396 396 if (error) 397 397 return error; 398 398 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
+1 -1
drivers/hid/hid-multitouch.c
··· 390 390 case HID_DG_CONTACTID: 391 391 if (!td->maxcontacts) 392 392 td->maxcontacts = MT_DEFAULT_MAXCONTACT; 393 - input_mt_init_slots(hi->input, td->maxcontacts); 393 + input_mt_init_slots(hi->input, td->maxcontacts, 0); 394 394 mt_store_field(usage, td, hi); 395 395 td->last_field_index = field->index; 396 396 td->touches_by_report++;
+3 -1
drivers/input/input-mt.c
··· 25 25 * May be called repeatedly. Returns -EINVAL if attempting to 26 26 * reinitialize with a different number of slots. 27 27 */ 28 - int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots) 28 + int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, 29 + unsigned int flags) 29 30 { 30 31 struct input_mt *mt = dev->mt; 31 32 int i; ··· 41 40 return -ENOMEM; 42 41 43 42 mt->num_slots = num_slots; 43 + mt->flags = flags; 44 44 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); 45 45 input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0); 46 46
+1 -1
drivers/input/misc/uinput.c
··· 405 405 goto exit; 406 406 if (test_bit(ABS_MT_SLOT, dev->absbit)) { 407 407 int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1; 408 - input_mt_init_slots(dev, nslot); 408 + input_mt_init_slots(dev, nslot, 0); 409 409 } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { 410 410 input_set_events_per_packet(dev, 60); 411 411 }
+1 -1
drivers/input/mouse/alps.c
··· 1620 1620 case ALPS_PROTO_V3: 1621 1621 case ALPS_PROTO_V4: 1622 1622 set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); 1623 - input_mt_init_slots(dev1, 2); 1623 + input_mt_init_slots(dev1, 2, 0); 1624 1624 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); 1625 1625 input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, ALPS_V3_Y_MAX, 0, 0); 1626 1626
+2 -2
drivers/input/mouse/elantech.c
··· 1004 1004 input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2, 1005 1005 ETP_WMAX_V2, 0, 0); 1006 1006 } 1007 - input_mt_init_slots(dev, 2); 1007 + input_mt_init_slots(dev, 2, 0); 1008 1008 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); 1009 1009 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); 1010 1010 break; ··· 1035 1035 input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2, 1036 1036 ETP_WMAX_V2, 0, 0); 1037 1037 /* Multitouch capable pad, up to 5 fingers. */ 1038 - input_mt_init_slots(dev, ETP_MAX_FINGERS); 1038 + input_mt_init_slots(dev, ETP_MAX_FINGERS, 0); 1039 1039 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); 1040 1040 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); 1041 1041 input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
+1 -1
drivers/input/mouse/sentelic.c
··· 960 960 961 961 input_set_abs_params(dev, ABS_X, 0, abs_x, 0, 0); 962 962 input_set_abs_params(dev, ABS_Y, 0, abs_y, 0, 0); 963 - input_mt_init_slots(dev, 2); 963 + input_mt_init_slots(dev, 2, 0); 964 964 input_set_abs_params(dev, ABS_MT_POSITION_X, 0, abs_x, 0, 0); 965 965 input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, abs_y, 0, 0); 966 966 }
+2 -2
drivers/input/mouse/synaptics.c
··· 1232 1232 input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); 1233 1233 1234 1234 if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) { 1235 - input_mt_init_slots(dev, 2); 1235 + input_mt_init_slots(dev, 2, 0); 1236 1236 set_abs_position_params(dev, priv, ABS_MT_POSITION_X, 1237 1237 ABS_MT_POSITION_Y); 1238 1238 /* Image sensors can report per-contact pressure */ ··· 1244 1244 } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { 1245 1245 /* Non-image sensors with AGM use semi-mt */ 1246 1246 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); 1247 - input_mt_init_slots(dev, 2); 1247 + input_mt_init_slots(dev, 2, 0); 1248 1248 set_abs_position_params(dev, priv, ABS_MT_POSITION_X, 1249 1249 ABS_MT_POSITION_Y); 1250 1250 }
+3 -3
drivers/input/tablet/wacom_wac.c
··· 1530 1530 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 1531 1531 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit); 1532 1532 1533 - input_mt_init_slots(input_dev, features->touch_max); 1533 + input_mt_init_slots(input_dev, features->touch_max, 0); 1534 1534 1535 1535 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 1536 1536 0, 255, 0, 0); ··· 1575 1575 1576 1576 case TABLETPC2FG: 1577 1577 if (features->device_type == BTN_TOOL_FINGER) { 1578 - input_mt_init_slots(input_dev, features->touch_max); 1578 + input_mt_init_slots(input_dev, features->touch_max, 0); 1579 1579 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 1580 1580 0, MT_TOOL_MAX, 0, 0); 1581 1581 input_set_abs_params(input_dev, ABS_MT_POSITION_X, ··· 1631 1631 1632 1632 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1633 1633 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1634 - input_mt_init_slots(input_dev, features->touch_max); 1634 + input_mt_init_slots(input_dev, features->touch_max, 0); 1635 1635 1636 1636 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { 1637 1637 __set_bit(BTN_TOOL_TRIPLETAP,
+1 -1
drivers/input/touchscreen/atmel_mxt_ts.c
··· 1152 1152 1153 1153 /* For multi touch */ 1154 1154 num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; 1155 - error = input_mt_init_slots(input_dev, num_mt_slots); 1155 + error = input_mt_init_slots(input_dev, num_mt_slots, 0); 1156 1156 if (error) 1157 1157 goto err_free_object; 1158 1158 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
+1 -1
drivers/input/touchscreen/cyttsp_core.c
··· 571 571 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 572 572 0, CY_MAXZ, 0, 0); 573 573 574 - input_mt_init_slots(input_dev, CY_MAX_ID); 574 + input_mt_init_slots(input_dev, CY_MAX_ID, 0); 575 575 576 576 error = request_threaded_irq(ts->irq, NULL, cyttsp_irq, 577 577 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+1 -1
drivers/input/touchscreen/edt-ft5x06.c
··· 778 778 0, tsdata->num_x * 64 - 1, 0, 0); 779 779 input_set_abs_params(input, ABS_MT_POSITION_Y, 780 780 0, tsdata->num_y * 64 - 1, 0, 0); 781 - error = input_mt_init_slots(input, MAX_SUPPORT_POINTS); 781 + error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0); 782 782 if (error) { 783 783 dev_err(&client->dev, "Unable to init MT slots.\n"); 784 784 goto err_free_mem;
+1 -1
drivers/input/touchscreen/egalax_ts.c
··· 204 204 ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); 205 205 input_set_abs_params(input_dev, 206 206 ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0); 207 - input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS); 207 + input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0); 208 208 209 209 input_set_drvdata(input_dev, ts); 210 210
+1 -1
drivers/input/touchscreen/ili210x.c
··· 252 252 input_set_abs_params(input, ABS_Y, 0, ymax, 0, 0); 253 253 254 254 /* Multi touch */ 255 - input_mt_init_slots(input, MAX_TOUCHES); 255 + input_mt_init_slots(input, MAX_TOUCHES, 0); 256 256 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0); 257 257 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0); 258 258
+1 -1
drivers/input/touchscreen/mms114.c
··· 404 404 input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0); 405 405 406 406 /* For multi touch */ 407 - input_mt_init_slots(input_dev, MMS114_MAX_TOUCH); 407 + input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 0); 408 408 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 409 409 0, MMS114_MAX_AREA, 0, 0); 410 410 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
+1 -1
drivers/input/touchscreen/penmount.c
··· 264 264 input_set_abs_params(pm->dev, ABS_Y, 0, max_y, 0, 0); 265 265 266 266 if (pm->maxcontacts > 1) { 267 - input_mt_init_slots(pm->dev, pm->maxcontacts); 267 + input_mt_init_slots(pm->dev, pm->maxcontacts, 0); 268 268 input_set_abs_params(pm->dev, 269 269 ABS_MT_POSITION_X, 0, max_x, 0, 0); 270 270 input_set_abs_params(pm->dev,
+1 -1
drivers/input/touchscreen/wacom_w8001.c
··· 471 471 case 5: 472 472 w8001->pktlen = W8001_PKTLEN_TOUCH2FG; 473 473 474 - input_mt_init_slots(dev, 2); 474 + input_mt_init_slots(dev, 2, 0); 475 475 input_set_abs_params(dev, ABS_MT_POSITION_X, 476 476 0, touch.x, 0, 0); 477 477 input_set_abs_params(dev, ABS_MT_POSITION_Y,
+4 -1
include/linux/input/mt.h
··· 28 28 * @trkid: stores MT tracking ID for the next contact 29 29 * @num_slots: number of MT slots the device uses 30 30 * @slot: MT slot currently being transmitted 31 + * @flags: input_mt operation flags 31 32 * @slots: array of slots holding current values of tracked contacts 32 33 */ 33 34 struct input_mt { 34 35 int trkid; 35 36 int num_slots; 36 37 int slot; 38 + unsigned int flags; 37 39 struct input_mt_slot slots[]; 38 40 }; 39 41 ··· 51 49 return slot->abs[code - ABS_MT_FIRST]; 52 50 } 53 51 54 - int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots); 52 + int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, 53 + unsigned int flags); 55 54 void input_mt_destroy_slots(struct input_dev *dev); 56 55 57 56 static inline int input_mt_new_trkid(struct input_mt *mt)