Skip to content

Commit 31e821b

Browse files
XenuIsWatchingnashif
authored andcommitted
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 <[email protected]>
1 parent 9c48f7e commit 31e821b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/i3c/i3c_cdns.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,9 @@ static int cdns_i3c_i2c_api_configure(const struct device *dev, uint32_t config)
16031603
break;
16041604
}
16051605

1606+
k_mutex_lock(&data->bus_lock, K_FOREVER);
16061607
cdns_i3c_set_prescalers(dev);
1608+
k_mutex_unlock(&data->bus_lock);
16071609

16081610
return 0;
16091611
}
@@ -1632,7 +1634,10 @@ static int cdns_i3c_configure(const struct device *dev, enum i3c_config_type typ
16321634

16331635
data->common.ctrl_config.scl.i3c = ctrl_cfg->scl.i3c;
16341636
data->common.ctrl_config.scl.i2c = ctrl_cfg->scl.i2c;
1637+
1638+
k_mutex_lock(&data->bus_lock, K_FOREVER);
16351639
cdns_i3c_set_prescalers(dev);
1640+
k_mutex_unlock(&data->bus_lock);
16361641

16371642
return 0;
16381643
}

0 commit comments

Comments
 (0)