diff mbox series

clk: spear: Make structure i2s_sclk_masks constant

Message ID 20190813085714.8079-1-nishkadg.linux@gmail.com (mailing list archive)
State Mainlined
Commit f5c009dbf1730801c1741f1ed4638b38ea32a2a6
Headers show
Series clk: spear: Make structure i2s_sclk_masks constant | expand

Commit Message

Nishka Dasgupta Aug. 13, 2019, 8:57 a.m. UTC
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.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
 drivers/clk/spear/spear1340_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar Aug. 19, 2019, 2:20 a.m. UTC | #1
On 13-08-19, 14:27, Nishka Dasgupta wrote:
> 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.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/clk/spear/spear1340_clock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c
> index e5bc8c828cf0..9163bbb46411 100644
> --- a/drivers/clk/spear/spear1340_clock.c
> +++ b/drivers/clk/spear/spear1340_clock.c
> @@ -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,

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Stephen Boyd Sept. 6, 2019, 5:27 p.m. UTC | #2
Quoting Nishka Dasgupta (2019-08-13 01:57:14)
> 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.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c
index e5bc8c828cf0..9163bbb46411 100644
--- a/drivers/clk/spear/spear1340_clock.c
+++ b/drivers/clk/spear/spear1340_clock.c
@@ -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,