Skip to content

Commit c3995b6

Browse files
Alain Volmatkartben
authored andcommitted
drivers: usb: udc: stm32: avoid unnecessary clock_control_subsys_t cast
Avoid incorrect (clock_control_subsys_t *) incorrect cast and remove the cast of pclken in calls to the clock_control_ framework. Signed-off-by: Alain Volmat <[email protected]>
1 parent 00fd580 commit c3995b6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/usb/udc/udc_stm32.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ static void priv_pcd_prepare(const struct device *dev)
11231123
priv->pcd.Init.phy_itface = cfg->selected_phy;
11241124
}
11251125

1126-
static const struct stm32_pclken pclken[] = STM32_DT_INST_CLOCKS(0);
1126+
static struct stm32_pclken pclken[] = STM32_DT_INST_CLOCKS(0);
11271127

11281128
static int priv_clock_enable(void)
11291129
{
@@ -1182,24 +1182,21 @@ static int priv_clock_enable(void)
11821182
#endif
11831183

11841184
if (DT_INST_NUM_CLOCKS(0) > 1) {
1185-
if (clock_control_configure(clk, (clock_control_subsys_t *)&pclken[1],
1186-
NULL) != 0) {
1185+
if (clock_control_configure(clk, &pclken[1], NULL) != 0) {
11871186
LOG_ERR("Could not select USB domain clock");
11881187
return -EIO;
11891188
}
11901189
}
11911190

1192-
if (clock_control_on(clk, (clock_control_subsys_t *)&pclken[0]) != 0) {
1191+
if (clock_control_on(clk, &pclken[0]) != 0) {
11931192
LOG_ERR("Unable to enable USB clock");
11941193
return -EIO;
11951194
}
11961195

11971196
if (IS_ENABLED(CONFIG_UDC_STM32_CLOCK_CHECK)) {
11981197
uint32_t usb_clock_rate;
11991198

1200-
if (clock_control_get_rate(clk,
1201-
(clock_control_subsys_t *)&pclken[1],
1202-
&usb_clock_rate) != 0) {
1199+
if (clock_control_get_rate(clk, &pclken[1], &usb_clock_rate) != 0) {
12031200
LOG_ERR("Failed to get USB domain clock rate");
12041201
return -EIO;
12051202
}
@@ -1292,7 +1289,7 @@ static int priv_clock_disable(void)
12921289
{
12931290
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
12941291

1295-
if (clock_control_off(clk, (clock_control_subsys_t *)&pclken[0]) != 0) {
1292+
if (clock_control_off(clk, &pclken[0]) != 0) {
12961293
LOG_ERR("Unable to disable USB clock");
12971294
return -EIO;
12981295
}

0 commit comments

Comments
 (0)