drm: msm: hdmi: Constify static structs
PATCH 1/1 drm: msm: hdmi: Constify static structs
The only usage of hdmi_8996_pll_ops is to assign its address to the ops field in the clk_init_data struct, and the only usage of pll_init is to assign its address to the init field in the clk_hw struct, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory.
Signed-off-by Rikard Falkeborn <[email protected]>
--- drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c +2 -2
@@ -682,7 +682,7 @@ static int hdmi_8996_pll_is_enabled(struct clk_hw *hw)return pll_locked; } -static struct clk_ops hdmi_8996_pll_ops = { +static const struct clk_ops hdmi_8996_pll_ops = { .set_rate = hdmi_8996_pll_set_clk_rate, .round_rate = hdmi_8996_pll_round_rate, .recalc_rate = hdmi_8996_pll_recalc_rate,
@@ -695,7 +695,7 @@ static const char * const hdmi_pll_parents[] = { "xo", }; -static struct clk_init_data pll_init = { +static const struct clk_init_data pll_init = { .name ="hdmipll" , .ops = &hdmi_8996_pll_ops, .parent_names = hdmi_pll_parents,
Signature · 1 line
2.33.0
Quoted 7 lines · Rikard Falkeborn
The only usage of
hdmi_8996_pll_opsis to assign its address to the ops field in theclk_init_datastruct, and the only usage ofpll_initis to assign its address to the init field in theclk_hwstruct, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Reviewed-by Dmitry Baryshkov <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c +2
-2@@ -682,7 +682,7 @@ static int hdmi_8996_pll_is_enabled(struct clk_hw *hw)return pll_locked; } -static struct clk_ops hdmi_8996_pll_ops = { +static const struct clk_ops hdmi_8996_pll_ops = { .set_rate = hdmi_8996_pll_set_clk_rate, .round_rate = hdmi_8996_pll_round_rate, .recalc_rate = hdmi_8996_pll_recalc_rate,@@ -695,7 +695,7 @@ static const char * const hdmi_pll_parents[] = { "xo", }; -static struct clk_init_data pll_init = { +static const struct clk_init_data pll_init = { .name ="hdmipll" , .ops = &hdmi_8996_pll_ops, .parent_names = hdmi_pll_parents,
Signature · 2 lines
With best wishes Dmitry