Browse Source

refactor(st-clock): code size optimization

Clock name is not used and can be removed for code size optimization.

Change-Id: I75f6a1828e4374004e31a7ce13fa6885c52bbac3
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
pull/1988/head
Gabriel Fernandez 2 years ago
committed by Yann Gautier
parent
commit
3ff1ff4047
  1. 18
      drivers/st/clk/clk-stm32-core.c
  2. 12
      drivers/st/clk/clk-stm32-core.h
  3. 2
      drivers/st/clk/clk-stm32mp13.c

18
drivers/st/clk/clk-stm32-core.c

@ -215,24 +215,6 @@ int _clk_stm32_gate_enable(struct stm32_clk_priv *priv, uint16_t gate_id)
return 0;
}
const char *_clk_stm32_get_name(struct stm32_clk_priv *priv, int id)
{
return priv->clks[id].name;
}
const char *clk_stm32_get_name(struct stm32_clk_priv *priv,
unsigned long binding_id)
{
int id;
id = clk_get_index(priv, binding_id);
if (id == -EINVAL) {
return NULL;
}
return _clk_stm32_get_name(priv, id);
}
const struct clk_stm32 *_clk_get(struct stm32_clk_priv *priv, int id)
{
if ((unsigned int)id < priv->num) {

12
drivers/st/clk/clk-stm32-core.h

@ -54,7 +54,6 @@ struct stm32_clk_ops {
};
struct clk_stm32 {
const char *name;
uint16_t binding;
uint16_t parent;
uint8_t flags;
@ -163,8 +162,6 @@ int clk_oscillator_wait_ready(struct stm32_clk_priv *priv, int id, bool ready_on
int clk_oscillator_wait_ready_on(struct stm32_clk_priv *priv, int id);
int clk_oscillator_wait_ready_off(struct stm32_clk_priv *priv, int id);
const char *_clk_stm32_get_name(struct stm32_clk_priv *priv, int id);
const char *clk_stm32_get_name(struct stm32_clk_priv *priv, unsigned long binding_id);
int clk_stm32_get_counter(unsigned long binding_id);
void _clk_stm32_gate_disable(struct stm32_clk_priv *priv, uint16_t gate_id);
@ -226,7 +223,6 @@ struct clk_stm32_div_cfg {
#define STM32_DIV(idx, _binding, _parent, _flags, _div_id) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_binding),\
.parent = (_parent),\
.flags = (_flags),\
@ -242,7 +238,6 @@ struct clk_stm32_gate_cfg {
#define STM32_GATE(idx, _binding, _parent, _flags, _gate_id) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_binding),\
.parent = (_parent),\
.flags = (_flags),\
@ -262,7 +257,6 @@ unsigned long fixed_factor_recalc_rate(struct stm32_clk_priv *priv,
#define FIXED_FACTOR(idx, _idx, _parent, _mult, _div) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_idx),\
.parent = (_parent),\
.clock_cfg = &(struct fixed_factor_cfg){\
@ -274,7 +268,6 @@ unsigned long fixed_factor_recalc_rate(struct stm32_clk_priv *priv,
#define GATE(idx, _binding, _parent, _flags, _offset, _bit_idx) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_binding),\
.parent = (_parent),\
.flags = (_flags),\
@ -287,7 +280,6 @@ unsigned long fixed_factor_recalc_rate(struct stm32_clk_priv *priv,
#define STM32_MUX(idx, _binding, _mux_id, _flags) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_binding),\
.parent = (MUX(_mux_id)),\
.flags = (_flags),\
@ -302,7 +294,6 @@ struct clk_timer_cfg {
#define CK_TIMER(idx, _idx, _parent, _flags, _apbdiv, _timpre) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_idx),\
.parent = (_parent),\
.flags = (CLK_SET_RATE_PARENT | (_flags)),\
@ -319,7 +310,6 @@ struct clk_stm32_fixed_rate_cfg {
#define CLK_FIXED_RATE(idx, _binding, _rate) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_binding),\
.parent = (CLK_IS_ROOT),\
.clock_cfg = &(struct clk_stm32_fixed_rate_cfg){\
@ -370,7 +360,6 @@ struct stm32_osc_cfg {
#define CLK_OSC(idx, _idx, _parent, _osc_id) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_idx),\
.parent = (_parent),\
.flags = CLK_IS_CRITICAL,\
@ -382,7 +371,6 @@ struct stm32_osc_cfg {
#define CLK_OSC_FIXED(idx, _idx, _parent, _osc_id) \
[(idx)] = (struct clk_stm32){ \
.name = #idx,\
.binding = (_idx),\
.parent = (_parent),\
.flags = CLK_IS_CRITICAL,\

2
drivers/st/clk/clk-stm32mp13.c

@ -1705,7 +1705,6 @@ static const struct stm32_clk_ops clk_stm32_pll_ops = {
};
#define CLK_PLL(idx, _idx, _parent, _gate, _pll_id, _flags)[idx] = {\
.name = #idx,\
.binding = _idx,\
.parent = _parent,\
.flags = (_flags),\
@ -1762,7 +1761,6 @@ static const struct stm32_clk_ops clk_stm32_composite_ops = {
#define STM32_COMPOSITE(idx, _binding, _parent, _flags, _gate_id,\
_div_id)[idx] = {\
.name = #idx,\
.binding = (_binding),\
.parent = (_parent),\
.flags = (_flags),\

Loading…
Cancel
Save