Skip to content

Commit

Permalink
[nrf fromtree] i2c: i2c_nrfx_twim: update callback context to dev
Browse files Browse the repository at this point in the history
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]>
(cherry picked from commit 627be7d)
  • Loading branch information
JordanYates authored and carlescufi committed Dec 3, 2024
1 parent 83ac469 commit d96f9a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/i2c/i2c_nrfx_twim.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ static int i2c_nrfx_twim_transfer(const struct device *dev,

static void event_handler(nrfx_twim_evt_t const *p_event, void *p_context)
{
struct i2c_nrfx_twim_data *dev_data = p_context;
const struct device *dev = p_context;
struct i2c_nrfx_twim_data *dev_data = dev->data;

switch (p_event->type) {
case NRFX_TWIM_EVT_DONE:
Expand Down
4 changes: 2 additions & 2 deletions drivers/i2c/i2c_nrfx_twim_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ int i2c_nrfx_twim_common_init(const struct device *dev)

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

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

0 comments on commit d96f9a8

Please sign in to comment.