drivers: i3c: cdns: grab mutex before adjusting prescalers

Grab the mutex before adjusting the prescalers to make sure no
transaction is on going.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2024-10-02 16:08:31 -07:00 committed by Anas Nashif
parent 9c48f7eb37
commit 31e821bef6

View file

@ -1603,7 +1603,9 @@ static int cdns_i3c_i2c_api_configure(const struct device *dev, uint32_t config)
break;
}
k_mutex_lock(&data->bus_lock, K_FOREVER);
cdns_i3c_set_prescalers(dev);
k_mutex_unlock(&data->bus_lock);
return 0;
}
@ -1632,7 +1634,10 @@ static int cdns_i3c_configure(const struct device *dev, enum i3c_config_type typ
data->common.ctrl_config.scl.i3c = ctrl_cfg->scl.i3c;
data->common.ctrl_config.scl.i2c = ctrl_cfg->scl.i2c;
k_mutex_lock(&data->bus_lock, K_FOREVER);
cdns_i3c_set_prescalers(dev);
k_mutex_unlock(&data->bus_lock);
return 0;
}