]> www.infradead.org Git - users/dwmw2/linux.git/commit
HID: multitouch: make mt_set_mode() less cryptic
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 28 Oct 2024 19:07:50 +0000 (12:07 -0700)
committerJiri Kosina <jkosina@suse.com>
Mon, 18 Nov 2024 20:49:47 +0000 (21:49 +0100)
commite8a0581914bd2e28f7af8d333ddc73fd78b1ef84
tree990ca72f514e25115da1925198fd42219fa81e72
parent0951fede4e5215e4529a3b711ac94fc84f90eca8
HID: multitouch: make mt_set_mode() less cryptic

mt_set_mode() accepts 2 boolean switches indicating whether the device
(if it follows Windows Precision Touchpad specification) should report
hardware buttons and/or surface contacts. For a casual reader it is
completely not clear, as they look at the call site, which exact mode
is being requested.

Define report_mode enum and change mt_set_mode() to accept is as
an argument instead. This allows to write:

mt_set_modes(hdev, HID_LATENCY_NORMAL, TOUCHPAD_REPORT_ALL);

or

mt_set_modes(hdev, HID_LATENCY_HIGH, TOUCHPAD_REPORT_BUTTONS);

which makes intent much more clear.

Reviewed-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/Zx_hBvg5Qa3KU3ta@google.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/hid-multitouch.c