fix: Proper use of CONTAINER_OF with delayable work.

This commit is contained in:
Peter Johanson
2023-11-15 00:40:36 +00:00
committed by Pete Johanson
parent 94aa7d8d53
commit f4e6d70465
6 changed files with 13 additions and 6 deletions

View File

@@ -9,6 +9,7 @@
#include <zephyr/device.h>
#include <zephyr/drivers/kscan.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@@ -105,7 +106,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
} \
\
static void kscan_gpio_work_handler_##n(struct k_work *work) { \
struct kscan_gpio_data_##n *data = CONTAINER_OF(work, struct kscan_gpio_data_##n, work); \
struct k_work_delayable *d_work = k_work_delayable_from_work(work); \
struct kscan_gpio_data_##n *data = CONTAINER_OF(d_work, struct kscan_gpio_data_##n, work); \
kscan_gpio_read_##n(data->dev); \
} \
\