Skip to content

Commit a37af8e

Browse files
Markus Burridtor
authored andcommitted
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 <[email protected]> Reviewed-by: Manuel Traut <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 4d395cb commit a37af8e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/input/keyboard/matrix_keypad.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ static void disable_row_irqs(struct matrix_keypad *keypad)
104104
disable_irq_nosync(keypad->row_irqs[i]);
105105
}
106106

107+
static uint32_t read_row_state(struct matrix_keypad *keypad)
108+
{
109+
int row;
110+
u32 row_state = 0;
111+
112+
for (row = 0; row < keypad->num_row_gpios; row++)
113+
row_state |= row_asserted(keypad, row) ? BIT(row) : 0;
114+
return row_state;
115+
}
116+
107117
/*
108118
* This gets the keys from keyboard and reports it to input subsystem
109119
*/
@@ -129,9 +139,7 @@ static void matrix_keypad_scan(struct work_struct *work)
129139

130140
activate_col(keypad, col, true);
131141

132-
for (row = 0; row < keypad->num_row_gpios; row++)
133-
new_state[col] |=
134-
row_asserted(keypad, row) ? BIT(row) : 0;
142+
new_state[col] = read_row_state(keypad);
135143

136144
activate_col(keypad, col, false);
137145
}

0 commit comments

Comments
 (0)