input: gpio_keys: skip change checking when suspended
Check if the driver is suspended in gpio_keys_change_deferred(), this avoids a potential situation where a race condition could try and read from a pin that has just been disconnected. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
ed501d788b
commit
7a538c88cd
1 changed files with 8 additions and 0 deletions
|
|
@ -106,6 +106,14 @@ static __maybe_unused void gpio_keys_change_deferred(struct k_work *work)
|
|||
const struct gpio_keys_config *cfg = dev->config;
|
||||
int key_index = pin_data - (struct gpio_keys_pin_data *)cfg->pin_data;
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
struct gpio_keys_data *data = dev->data;
|
||||
|
||||
if (atomic_get(&data->suspended) == 1) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
gpio_keys_poll_pin(dev, key_index);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue