summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorMarkus Burri <markus.burri@mt.com>2025-02-26 18:28:41 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2025-04-10 00:21:38 +0300
commita37af8e8c1dc25e097ae1bce98980ad75d5921bc (patch)
treeb4d73d1c2346eb590a5707718a5704b177f6cfeb /drivers/input
parent4d395cb071a343196ca524d3694790f06978fe91 (diff)
downloadlinux-a37af8e8c1dc25e097ae1bce98980ad75d5921bc.tar.xz
Input: matrix_keypad - add function for reading row state
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>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/matrix_keypad.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index e46473cb817c..fdb3499660a3 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -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);
}