Skip to content

Commit 627be7d

Browse files
JordanYatesaescolar
authored andcommitted
i2c: i2c_nrfx_twim: update callback context to dev
Change the callback context to the dev pointer instead of the data pointer, as the dev pointer is needed by RTIO. Signed-off-by: Jordan Yates <[email protected]>
1 parent 0218b36 commit 627be7d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/i2c/i2c_nrfx_twim.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ static int i2c_nrfx_twim_transfer(const struct device *dev,
173173

174174
static void event_handler(nrfx_twim_evt_t const *p_event, void *p_context)
175175
{
176-
struct i2c_nrfx_twim_data *dev_data = p_context;
176+
const struct device *dev = p_context;
177+
struct i2c_nrfx_twim_data *dev_data = dev->data;
177178

178179
switch (p_event->type) {
179180
case NRFX_TWIM_EVT_DONE:

drivers/i2c/i2c_nrfx_twim_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ int i2c_nrfx_twim_common_init(const struct device *dev)
130130

131131
(void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
132132

133-
if (nrfx_twim_init(&config->twim, &config->twim_config, config->event_handler, data) !=
134-
NRFX_SUCCESS) {
133+
if (nrfx_twim_init(&config->twim, &config->twim_config, config->event_handler,
134+
(void *)dev) != NRFX_SUCCESS) {
135135
LOG_ERR("Failed to initialize device: %s", dev->name);
136136
return -EIO;
137137
}

0 commit comments

Comments
 (0)