Skip to content

Commit ae8e80c

Browse files
jwrdegoededtor
authored andcommitted
Input: goodix - use input_copy_abs() helper
Use the new input_copy_abs() helper and move the 2 input_abs_set_res() calls up to be directly after the 2 input_copy_abs() calls, so that the calls initializing the X and Y axis are all together. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220131143539.109142-3-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent cb66b9b commit ae8e80c

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

drivers/input/touchscreen/goodix.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -306,30 +306,22 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts)
306306
if (!input)
307307
return NULL;
308308

309-
input_alloc_absinfo(input);
310-
if (!input->absinfo) {
311-
input_free_device(input);
312-
return NULL;
313-
}
314-
315-
input->absinfo[ABS_X] = ts->input_dev->absinfo[ABS_MT_POSITION_X];
316-
input->absinfo[ABS_Y] = ts->input_dev->absinfo[ABS_MT_POSITION_Y];
317-
__set_bit(ABS_X, input->absbit);
318-
__set_bit(ABS_Y, input->absbit);
319-
input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0);
320-
321-
input_set_capability(input, EV_KEY, BTN_TOUCH);
322-
input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
323-
input_set_capability(input, EV_KEY, BTN_STYLUS);
324-
input_set_capability(input, EV_KEY, BTN_STYLUS2);
325-
__set_bit(INPUT_PROP_DIRECT, input->propbit);
309+
input_copy_abs(input, ABS_X, ts->input_dev, ABS_MT_POSITION_X);
310+
input_copy_abs(input, ABS_Y, ts->input_dev, ABS_MT_POSITION_Y);
326311
/*
327312
* The resolution of these touchscreens is about 10 units/mm, the actual
328313
* resolution does not matter much since we set INPUT_PROP_DIRECT.
329314
* Userspace wants something here though, so just set it to 10 units/mm.
330315
*/
331316
input_abs_set_res(input, ABS_X, 10);
332317
input_abs_set_res(input, ABS_Y, 10);
318+
input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0);
319+
320+
input_set_capability(input, EV_KEY, BTN_TOUCH);
321+
input_set_capability(input, EV_KEY, BTN_TOOL_PEN);
322+
input_set_capability(input, EV_KEY, BTN_STYLUS);
323+
input_set_capability(input, EV_KEY, BTN_STYLUS2);
324+
__set_bit(INPUT_PROP_DIRECT, input->propbit);
333325

334326
input->name = "Goodix Active Pen";
335327
input->phys = "input/pen";

0 commit comments

Comments
 (0)