samples: userspace: drop DEV_DATA/DEV_CFG usage

Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-01-18 17:01:04 +01:00 committed by Carles Cufí
commit 8be86f7ffb

View file

@ -20,9 +20,6 @@ LOG_MODULE_REGISTER(sample_driver);
* The driver sets up a timer which is used to fake interrupts. * The driver sets up a timer which is used to fake interrupts.
*/ */
#define DEV_DATA(dev) \
((struct sample_driver_foo_dev_data *const)(dev)->data)
struct sample_driver_foo_dev_data { struct sample_driver_foo_dev_data {
const struct device *dev; const struct device *dev;
sample_driver_callback_t cb; sample_driver_callback_t cb;
@ -42,7 +39,7 @@ static int sample_driver_foo_set_callback(const struct device *dev,
sample_driver_callback_t cb, sample_driver_callback_t cb,
void *context) void *context)
{ {
struct sample_driver_foo_dev_data *data = DEV_DATA(dev); struct sample_driver_foo_dev_data *data = dev->data;
int key = irq_lock(); int key = irq_lock();
data->cb_context = context; data->cb_context = context;
@ -54,7 +51,7 @@ static int sample_driver_foo_set_callback(const struct device *dev,
static int sample_driver_foo_state_set(const struct device *dev, bool active) static int sample_driver_foo_state_set(const struct device *dev, bool active)
{ {
struct sample_driver_foo_dev_data *data = DEV_DATA(dev); struct sample_driver_foo_dev_data *data = dev->data;
LOG_DBG("%s(%p, %d)", __func__, dev, active); LOG_DBG("%s(%p, %d)", __func__, dev, active);
@ -98,7 +95,7 @@ static void sample_driver_timer_cb(struct k_timer *timer)
static int sample_driver_foo_init(const struct device *dev) static int sample_driver_foo_init(const struct device *dev)
{ {
struct sample_driver_foo_dev_data *data = DEV_DATA(dev); struct sample_driver_foo_dev_data *data = dev->data;
k_timer_init(&data->timer, sample_driver_timer_cb, NULL); k_timer_init(&data->timer, sample_driver_timer_cb, NULL);