]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: matrix_keypad - add function for reading row state
authorMarkus Burri <markus.burri@mt.com>
Wed, 26 Feb 2025 15:28:41 +0000 (16:28 +0100)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 9 Apr 2025 21:21:38 +0000 (14:21 -0700)
Move the evaluation of a row state into separate function.
It will be also used by a change later in this series.

Signed-off-by: Markus Burri <markus.burri@mt.com>
Reviewed-by: Manuel Traut <manuel.traut@mt.com>
Link: https://lore.kernel.org/r/20250226152843.43932-2-markus.burri@mt.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/matrix_keypad.c

index e46473cb817c21da6cbeaaaf9c53de6367a98222..fdb3499660a30d6e3c89678d265d6b1088e7d9e7 100644 (file)
@@ -104,6 +104,16 @@ static void disable_row_irqs(struct matrix_keypad *keypad)
                disable_irq_nosync(keypad->row_irqs[i]);
 }
 
+static uint32_t read_row_state(struct matrix_keypad *keypad)
+{
+       int row;
+       u32 row_state = 0;
+
+       for (row = 0; row < keypad->num_row_gpios; row++)
+               row_state |= row_asserted(keypad, row) ? BIT(row) : 0;
+       return row_state;
+}
+
 /*
  * This gets the keys from keyboard and reports it to input subsystem
  */
@@ -129,9 +139,7 @@ static void matrix_keypad_scan(struct work_struct *work)
 
                activate_col(keypad, col, true);
 
-               for (row = 0; row < keypad->num_row_gpios; row++)
-                       new_state[col] |=
-                               row_asserted(keypad, row) ? BIT(row) : 0;
+               new_state[col] = read_row_state(keypad);
 
                activate_col(keypad, col, false);
        }