@@ -50,7 +50,6 @@ struct gpio_button_data {
spinlock_t lock;
bool disabled;
bool key_pressed;
- bool suspended;
};
struct gpio_keys_drvdata {
@@ -58,6 +57,7 @@ struct gpio_keys_drvdata {
struct input_dev *input;
struct mutex disable_lock;
unsigned short *keymap;
+ bool suspended;
struct gpio_button_data data[0];
};
@@ -404,7 +404,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
const struct gpio_keys_button *button = bdata->button;
pm_stay_awake(input->dev.parent);
- if (bdata->suspended &&
+ if (bdata->ddata->suspended &&
(button->type == 0 || button->type == EV_KEY)) {
/*
* Simulate wakeup key press in case the key has
@@ -859,7 +859,6 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev)
struct gpio_button_data *bdata = &ddata->data[i];
if (bdata->button->wakeup)
enable_irq_wake(bdata->irq);
- bdata->suspended = true;
}
} else {
mutex_lock(&input->mutex);
@@ -868,6 +867,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev)
mutex_unlock(&input->mutex);
}
+ ddata->suspended = true;
return 0;
}
@@ -883,7 +883,6 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
struct gpio_button_data *bdata = &ddata->data[i];
if (bdata->button->wakeup)
disable_irq_wake(bdata->irq);
- bdata->suspended = false;
}
} else {
mutex_lock(&input->mutex);
@@ -896,6 +895,7 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
return error;
gpio_keys_report_state(ddata);
+ ddata->suspended = false;
return 0;
}
There is no need to have a suspended flag per button, this also allows gpio_keys_resume to set suspended to false after calling gpio_keys_report_state, which will allow testing the suspended flag in gpio_keys_report_state in a follow-up patch. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- Changes in v3: -This is a new patch in v3 of this patch-set --- drivers/input/keyboard/gpio_keys.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)