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:
parent
ba8f7a2dd8
commit
8be86f7ffb
1 changed files with 3 additions and 6 deletions
|
@ -20,9 +20,6 @@ LOG_MODULE_REGISTER(sample_driver);
|
|||
* 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 {
|
||||
const struct device *dev;
|
||||
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,
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
|
@ -98,7 +95,7 @@ static void sample_driver_timer_cb(struct k_timer *timer)
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue