input: gpio_keys: fix CONTAINER_OF declaration

Fix CONTAINER_OF usage in gpio_keys_interrupt, this should go first to
struct gpio_keys_callback and then to struct gpio_keys_pin_data. It
happens to work right now because cb_data is the first field.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-08-27 23:04:48 +01:00 committed by Carles Cufí
parent ec71be5d9d
commit 2401743c21
1 changed files with 4 additions and 2 deletions

View File

@ -79,8 +79,10 @@ static void gpio_keys_interrupt(const struct device *dev, struct gpio_callback *
ARG_UNUSED(dev); /* This is a pointer to GPIO device, use dev pointer in
* cbdata for pointer to gpio_debounce device node
*/
struct gpio_keys_pin_data *pin_data =
CONTAINER_OF(cbdata, struct gpio_keys_pin_data, cb_data);
struct gpio_keys_callback *keys_cb = CONTAINER_OF(
cbdata, struct gpio_keys_callback, gpio_cb);
struct gpio_keys_pin_data *pin_data = CONTAINER_OF(
keys_cb, struct gpio_keys_pin_data, cb_data);
const struct gpio_keys_config *cfg = pin_data->dev->config;
for (int i = 0; i < cfg->num_keys; i++) {