Skip to content

Commit 04ffa4e

Browse files
etienne-lmsnashif
authored andcommitted
drivers: clock_control: remove inline attributes in stm32 clock drivers
Remove the inline attribute from stm32 clock drivers functions especially for functions that are only referenced in the clock API operation structure and therefore cannot be inline. As a generic comment, today compiler are smart enough to optimize embedded software without needing inline function attributes in the source files. This change hopes that next stm32 clock driver will no more replicate this bad habit when using existing source files as implementation examples. No functional change. Signed-off-by: Etienne Carriere <[email protected]>
1 parent dcf4855 commit 04ffa4e

File tree

8 files changed

+40
-57
lines changed

8 files changed

+40
-57
lines changed

drivers/clock_control/clock_stm32_ll_common.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ int enabled_clock(uint32_t src_clk)
247247
return r;
248248
}
249249

250-
static inline int stm32_clock_control_on(const struct device *dev,
251-
clock_control_subsys_t sub_system)
250+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
252251
{
253252
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
254253
volatile int temp;
@@ -271,8 +270,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
271270
return 0;
272271
}
273272

274-
static inline int stm32_clock_control_off(const struct device *dev,
275-
clock_control_subsys_t sub_system)
273+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
276274
{
277275
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
278276

@@ -289,9 +287,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
289287
return 0;
290288
}
291289

292-
static inline int stm32_clock_control_configure(const struct device *dev,
293-
clock_control_subsys_t sub_system,
294-
void *data)
290+
static int stm32_clock_control_configure(const struct device *dev,
291+
clock_control_subsys_t sub_system,
292+
void *data)
295293
{
296294
/* At least one alt src clock available */
297295
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);

drivers/clock_control/clock_stm32_ll_h5.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ int enabled_clock(uint32_t src_clk)
144144
return -ENOTSUP;
145145
}
146146

147-
static inline int stm32_clock_control_on(const struct device *dev,
148-
clock_control_subsys_t sub_system)
147+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
149148
{
150149
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
151150
volatile int temp;
@@ -166,8 +165,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
166165
return 0;
167166
}
168167

169-
static inline int stm32_clock_control_off(const struct device *dev,
170-
clock_control_subsys_t sub_system)
168+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
171169
{
172170
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
173171

@@ -184,9 +182,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
184182
return 0;
185183
}
186184

187-
static inline int stm32_clock_control_configure(const struct device *dev,
188-
clock_control_subsys_t sub_system,
189-
void *data)
185+
static int stm32_clock_control_configure(const struct device *dev,
186+
clock_control_subsys_t sub_system,
187+
void *data)
190188
{
191189
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
192190
int err;

drivers/clock_control/clock_stm32_ll_h7.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,7 @@ int enabled_clock(uint32_t src_clk)
382382
return -ENOTSUP;
383383
}
384384

385-
static inline int stm32_clock_control_on(const struct device *dev,
386-
clock_control_subsys_t sub_system)
385+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
387386
{
388387
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
389388
volatile int temp;
@@ -409,8 +408,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
409408
return 0;
410409
}
411410

412-
static inline int stm32_clock_control_off(const struct device *dev,
413-
clock_control_subsys_t sub_system)
411+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
414412
{
415413
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
416414

@@ -430,9 +428,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
430428
return 0;
431429
}
432430

433-
static inline int stm32_clock_control_configure(const struct device *dev,
434-
clock_control_subsys_t sub_system,
435-
void *data)
431+
static int stm32_clock_control_configure(const struct device *dev,
432+
clock_control_subsys_t sub_system,
433+
void *data)
436434
{
437435
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
438436
int err;

drivers/clock_control/clock_stm32_ll_mp1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
/**
1515
* @brief fill in AHB/APB buses configuration structure
1616
*/
17-
static inline int stm32_clock_control_on(const struct device *dev,
18-
clock_control_subsys_t sub_system)
17+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
1918
{
2019
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
2120

@@ -65,8 +64,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
6564
return 0;
6665
}
6766

68-
static inline int stm32_clock_control_off(const struct device *dev,
69-
clock_control_subsys_t sub_system)
67+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
7068
{
7169
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
7270

drivers/clock_control/clock_stm32_ll_n6.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ static int enabled_clock(uint32_t src_clk)
191191
return -ENOTSUP;
192192
}
193193

194-
static inline int stm32_clock_control_on(const struct device *dev,
195-
clock_control_subsys_t sub_system)
194+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
196195
{
197196
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
198197

@@ -214,8 +213,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
214213
return 0;
215214
}
216215

217-
static inline int stm32_clock_control_off(const struct device *dev,
218-
clock_control_subsys_t sub_system)
216+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
219217
{
220218
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
221219

@@ -237,9 +235,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
237235
return 0;
238236
}
239237

240-
static inline int stm32_clock_control_configure(const struct device *dev,
241-
clock_control_subsys_t sub_system,
242-
void *data)
238+
static int stm32_clock_control_configure(const struct device *dev,
239+
clock_control_subsys_t sub_system,
240+
void *data)
243241
{
244242
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
245243
int err;

drivers/clock_control/clock_stm32_ll_u5.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ int enabled_clock(uint32_t src_clk)
150150
return -ENOTSUP;
151151
}
152152

153-
static inline int stm32_clock_control_on(const struct device *dev,
154-
clock_control_subsys_t sub_system)
153+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
155154
{
156155
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
157156
volatile int temp;
@@ -172,8 +171,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
172171
return 0;
173172
}
174173

175-
static inline int stm32_clock_control_off(const struct device *dev,
176-
clock_control_subsys_t sub_system)
174+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
177175
{
178176
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
179177

@@ -190,9 +188,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
190188
return 0;
191189
}
192190

193-
static inline int stm32_clock_control_configure(const struct device *dev,
194-
clock_control_subsys_t sub_system,
195-
void *data)
191+
static int stm32_clock_control_configure(const struct device *dev,
192+
clock_control_subsys_t sub_system,
193+
void *data)
196194
{
197195
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
198196
int err;

drivers/clock_control/clock_stm32_ll_wb0.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ int enabled_clock(uint32_t src_clk)
206206
return r;
207207
}
208208

209-
static inline int stm32_clock_control_on(const struct device *dev,
210-
clock_control_subsys_t sub_system)
209+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
211210
{
212211
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
213212
const mem_addr_t reg = RCC_REG(pclken->bus);
@@ -230,8 +229,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
230229
return 0;
231230
}
232231

233-
static inline int stm32_clock_control_off(const struct device *dev,
234-
clock_control_subsys_t sub_system)
232+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
235233
{
236234
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
237235
const mem_addr_t reg = RCC_REG(pclken->bus);
@@ -247,9 +245,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
247245
return 0;
248246
}
249247

250-
static inline int stm32_clock_control_configure(const struct device *dev,
251-
clock_control_subsys_t sub_system,
252-
void *data)
248+
static int stm32_clock_control_configure(const struct device *dev,
249+
clock_control_subsys_t sub_system,
250+
void *data)
253251
{
254252
struct stm32_pclken *pclken = (struct stm32_pclken *)sub_system;
255253
const uint32_t shift = STM32_DT_CLKSEL_SHIFT_GET(pclken->enr);
@@ -271,7 +269,7 @@ static inline int stm32_clock_control_configure(const struct device *dev,
271269
return 0;
272270
}
273271

274-
static inline int get_apb0_periph_clkrate(struct stm32_pclken *pclken,
272+
static int get_apb0_periph_clkrate(struct stm32_pclken *pclken,
275273
uint32_t *rate, uint32_t slow_clock, uint32_t sysclk, uint32_t clk_sys)
276274
{
277275
switch (pclken->enr) {
@@ -312,8 +310,7 @@ static inline int get_apb0_periph_clkrate(struct stm32_pclken *pclken,
312310
return 0;
313311
}
314312

315-
static inline int get_apb1_periph_clkrate(struct stm32_pclken *pclken,
316-
uint32_t *rate, uint32_t clk_sys)
313+
static int get_apb1_periph_clkrate(struct stm32_pclken *pclken, uint32_t *rate, uint32_t clk_sys)
317314
{
318315
switch (pclken->enr) {
319316
#if defined(SPI1)
@@ -603,7 +600,7 @@ static void set_up_fixed_clock_sources(void)
603600
* @brief Converts the Kconfig STM32_WB0_CLKSYS_PRESCALER option
604601
* to a LL_RCC_RC64MPLL_DIV_x value understandable by the LL.
605602
*/
606-
static inline uint32_t kconfig_to_ll_prescaler(uint32_t kcfg_pre)
603+
static uint32_t kconfig_to_ll_prescaler(uint32_t kcfg_pre)
607604
{
608605
switch (kcfg_pre) {
609606
case 1:

drivers/clock_control/clock_stm32_ll_wba.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ int enabled_clock(uint32_t src_clk)
6262
return -ENOTSUP;
6363
}
6464

65-
static inline int stm32_clock_control_on(const struct device *dev,
66-
clock_control_subsys_t sub_system)
65+
static int stm32_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system)
6766
{
6867
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
6968
volatile int temp;
@@ -84,8 +83,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
8483
return 0;
8584
}
8685

87-
static inline int stm32_clock_control_off(const struct device *dev,
88-
clock_control_subsys_t sub_system)
86+
static int stm32_clock_control_off(const struct device *dev, clock_control_subsys_t sub_system)
8987
{
9088
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
9189

@@ -102,9 +100,9 @@ static inline int stm32_clock_control_off(const struct device *dev,
102100
return 0;
103101
}
104102

105-
static inline int stm32_clock_control_configure(const struct device *dev,
106-
clock_control_subsys_t sub_system,
107-
void *data)
103+
static int stm32_clock_control_configure(const struct device *dev,
104+
clock_control_subsys_t sub_system,
105+
void *data)
108106
{
109107
#if defined(STM32_SRC_CLOCK_MIN)
110108
/* At least one alt src clock available */

0 commit comments

Comments
 (0)