Skip to contentSkip to conversation

clk: spear: Make structure i2s_sclk_masks constant

PATCH Applied Nishka Dasgupta 3 participants 3 messages Aug 13, 2019 – Sep 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: spear: Make structure i2s_sclk_masks constant

Static structure i2s_sclk_masks, having type aux_clk_masks, is only used when it is passed as the sixth argument to function clk_register_aux(). However, clk_register_aux() is defined with its sixth argument as const. Hence i2s_sclk_masks is not modified by clk_register_aux, which is also the only usage of the former. Therefore make i2s_sclk_masks constant as it is never modified.
Issue found with Coccinelle.

---
 drivers/clk/spear/spear1340_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/spear/spear1340_clock.c +1 -1
index e5bc8c828cf0..9163bbb46411 100644
@@ -335,7 +335,7 @@ static const struct aux_clk_masks i2s_prs1_masks = {
 };
 
 /* i2s sclk (bit clock) syynthesizers masks */
-static struct aux_clk_masks i2s_sclk_masks = {
+static const struct aux_clk_masks i2s_sclk_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
Signature · 1 line
2.19.1
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Nishka Dasgupta

Static structure i2s_sclk_masks, having type aux_clk_masks, is only used when it is passed as the sixth argument to function clk_register_aux(). However, clk_register_aux() is defined with its sixth argument as const. Hence i2s_sclk_masks is not modified by clk_register_aux, which is also the only usage of the former. Therefore make i2s_sclk_masks constant as it is never modified.
Issue found with Coccinelle.

---
 drivers/clk/spear/spear1340_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/spear/spear1340_clock.c +0 -0
index e5bc8c828cf0..9163bbb46411 100644

drivers/clk/spear/spear1340_clock.c static const struct aux_clk_masks i2s_prs1_masks = { · line 341

Quoted 8 lines
drivers/clk/spear/spear1340_clock.c +1 -1
@@ -335,7 +335,7 @@ static const struct aux_clk_masks i2s_prs1_masks = {
 };
 
 /* i2s sclk (bit clock) syynthesizers masks */
-static struct aux_clk_masks i2s_sclk_masks = {
+static const struct aux_clk_masks i2s_sclk_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1340_I2S_SCLK_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
Signature · 1 line
viresh
maintainer Applied
#2 lore raw
In reply to Nishka Dasgupta

Quoting Nishka Dasgupta (2019-08-13 01:57:14)

Quoted 10 lines

Static structure i2s_sclk_masks, having type aux_clk_masks, is only used when it is passed as the sixth argument to function clk_register_aux(). However, clk_register_aux() is defined with its sixth argument as const. Hence i2s_sclk_masks is not modified by clk_register_aux, which is also the only usage of the former. Therefore make i2s_sclk_masks constant as it is never modified.
Issue found with Coccinelle.

---

Applied to clk-next