Input: synaptics-rmi4 - limit the range of what GPIOs are buttons

By convention the first 6 bits of F30 Ctrl 2 and 3 are used to signify
GPIOs which are connected to buttons. Additional GPIOs may be used as
input GPIOs to signal the touch controller of some event
(ie disable touchpad). These additional GPIOs may meet the criteria of
a button in rmi_f30_is_valid_button() but should not be considered
buttons. This patch limits the GPIOs which are mapped to buttons to just
the first 6.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Reported-by: Daniel Martin <consume.noise@gmail.com>
Tested-by: Daniel Martin <consume.noise@gmail.com>
Acked-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by Andrew Duggan and committed by Dmitry Torokhov 3e64fcbd a5082947

+3 -2
+3 -2
drivers/input/rmi4/rmi_f30.c
··· 232 232 unsigned int trackstick_button = BTN_LEFT; 233 233 bool button_mapped = false; 234 234 int i; 235 + int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END); 235 236 236 237 f30->gpioled_key_map = devm_kcalloc(&fn->dev, 237 - f30->gpioled_count, 238 + button_count, 238 239 sizeof(f30->gpioled_key_map[0]), 239 240 GFP_KERNEL); 240 241 if (!f30->gpioled_key_map) { ··· 243 242 return -ENOMEM; 244 243 } 245 244 246 - for (i = 0; i < f30->gpioled_count; i++) { 245 + for (i = 0; i < button_count; i++) { 247 246 if (!rmi_f30_is_valid_button(i, f30->ctrl)) 248 247 continue; 249 248