drivers: i2c: Fix device instance const qualifier loss

In all of these drivers, passing the device's data was sufficient as
only the data is being used by the HAL callback function then.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-08 10:09:52 +02:00 committed by Carles Cufí
commit 206f4d61fc
6 changed files with 23 additions and 21 deletions

View file

@ -144,8 +144,7 @@ static int i2c_nrfx_twi_transfer(const struct device *dev,
static void event_handler(nrfx_twi_evt_t const *p_event, void *p_context)
{
const struct device *dev = p_context;
struct i2c_nrfx_twi_data *dev_data = get_dev_data(dev);
struct i2c_nrfx_twi_data *dev_data = p_context;
switch (p_event->type) {
case NRFX_TWI_EVT_DONE:
@ -197,9 +196,10 @@ static const struct i2c_driver_api i2c_nrfx_twi_driver_api = {
static int init_twi(const struct device *dev)
{
struct i2c_nrfx_twi_data *dev_data = get_dev_data(dev);
nrfx_err_t result = nrfx_twi_init(&get_dev_config(dev)->twi,
&get_dev_config(dev)->config,
event_handler, dev);
event_handler, dev_data);
if (result != NRFX_SUCCESS) {
LOG_ERR("Failed to initialize device: %s",
dev->name);