2018-10-27 06:23:43

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 0/8] constify clk_ops structure

Declare as const clk_ops structures that are only stored in const fields or
passed to functions with const parameters.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---

arch/arm/mach-vexpress/spc.c | 2 +-
drivers/clk/clk-max77686.c | 2 +-
drivers/clk/clk-palmas.c | 2 +-
drivers/clk/clk-s2mps11.c | 2 +-
drivers/clk/pistachio/clk-pll.c | 8 ++++----
drivers/clk/pxa/clk-pxa.c | 4 ++--
drivers/gpu/drm/imx/imx-tve.c | 2 +-
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 2 +-
8 files changed, 12 insertions(+), 12 deletions(-)


2018-10-27 06:23:49

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 2/8] ARM: vexpress/spc: constify clk_ops structure

The clk_ops structure is only stored in the ops field of a
clk_init_data structure. This field is const, so the clk_ops
structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
arch/arm/mach-vexpress/spc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
index 0f5381d13494..611f22de48cb 100644
--- a/arch/arm/mach-vexpress/spc.c
+++ b/arch/arm/mach-vexpress/spc.c
@@ -521,7 +521,7 @@ static int spc_set_rate(struct clk_hw *hw, unsigned long rate,
return ve_spc_set_performance(spc->cluster, rate / 1000);
}

-static struct clk_ops clk_spc_ops = {
+static const struct clk_ops clk_spc_ops = {
.recalc_rate = spc_recalc_rate,
.round_rate = spc_round_rate,
.set_rate = spc_set_rate,


2018-10-27 06:23:54

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 8/8] drm/msm/hdmi: constify clk_ops structure

The clk_ops structure is only stored in the ops field of a
clk_init_data structure. This field is const, so the clk_ops
structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c
index 0df504c61833..b19a520c47d5 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c
@@ -689,7 +689,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,


2018-10-27 06:24:00

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 6/8] clk: s2mps11: constify clk_ops structure

The clk_ops structure is only stored in the ops fields of
clk_init_data structures. This field is const, so the clk_ops
structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/clk/clk-s2mps11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 5b419b82f7ca..2ce370c804aa 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -71,7 +71,7 @@ static unsigned long s2mps11_clk_recalc_rate(struct clk_hw *hw,
return 32768;
}

-static struct clk_ops s2mps11_clk_ops = {
+static const struct clk_ops s2mps11_clk_ops = {
.prepare = s2mps11_clk_prepare,
.unprepare = s2mps11_clk_unprepare,
.is_prepared = s2mps11_clk_is_prepared,


2018-10-27 06:24:17

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 5/8] clk: pxa: constify clk_ops structures

These clk_ops structures are only passed to a call to
clk_register_composite where the corresponding parameters
are const, so the clk_ops structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/clk/pxa/clk-pxa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/pxa/clk-pxa.c b/drivers/clk/pxa/clk-pxa.c
index b80dc9d5855c..42627bf8a09e 100644
--- a/drivers/clk/pxa/clk-pxa.c
+++ b/drivers/clk/pxa/clk-pxa.c
@@ -70,7 +70,7 @@ static unsigned long cken_recalc_rate(struct clk_hw *hw,
return clk_fixed_factor_ops.recalc_rate(&fix->hw, parent_rate);
}

-static struct clk_ops cken_rate_ops = {
+static const struct clk_ops cken_rate_ops = {
.recalc_rate = cken_recalc_rate,
};

@@ -83,7 +83,7 @@ static u8 cken_get_parent(struct clk_hw *hw)
return pclk->is_in_low_power() ? 0 : 1;
}

-static struct clk_ops cken_mux_ops = {
+static const struct clk_ops cken_mux_ops = {
.get_parent = cken_get_parent,
.set_parent = dummy_clk_set_parent,
};


2018-10-27 06:24:25

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 7/8] drm/imx: imx-tve: constify clk_ops structure

The clk_ops structure is only stored in the ops field of a
clk_init_data structure. This field is const, so the clk_ops
structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/gpu/drm/imx/imx-tve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 4bc3ead5c4e3..293dd5752583 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -434,7 +434,7 @@ static int clk_tve_di_set_rate(struct clk_hw *hw, unsigned long rate,
return 0;
}

-static struct clk_ops clk_tve_di_ops = {
+static const struct clk_ops clk_tve_di_ops = {
.round_rate = clk_tve_di_round_rate,
.set_rate = clk_tve_di_set_rate,
.recalc_rate = clk_tve_di_recalc_rate,


2018-10-27 06:24:44

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 1/8] clk: max77686: constify clk_ops structure

The clk_ops structure is only stored in the ops field of a
clk_init_data structure. This field is const, so the clk_ops
structure can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/clk/clk-max77686.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
index 02551fe4b87c..22c937644c93 100644
--- a/drivers/clk/clk-max77686.c
+++ b/drivers/clk/clk-max77686.c
@@ -137,7 +137,7 @@ static unsigned long max77686_recalc_rate(struct clk_hw *hw,
return 32768;
}

-static struct clk_ops max77686_clk_ops = {
+static const struct clk_ops max77686_clk_ops = {
.prepare = max77686_clk_prepare,
.unprepare = max77686_clk_unprepare,
.is_prepared = max77686_clk_is_prepared,


2018-10-27 06:25:01

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 3/8] clk: palmas: constify clk_ops structure

The clk_ops structure is only stored in the ops field of clk_init_data
structures. This field is const, so the clk_ops structure can be
const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/clk/clk-palmas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-palmas.c b/drivers/clk/clk-palmas.c
index e9612e7068e9..e41a3a9f7528 100644
--- a/drivers/clk/clk-palmas.c
+++ b/drivers/clk/clk-palmas.c
@@ -115,7 +115,7 @@ static int palmas_clks_is_prepared(struct clk_hw *hw)
return !!(val & cinfo->clk_desc->enable_mask);
}

-static struct clk_ops palmas_clks_ops = {
+static const struct clk_ops palmas_clks_ops = {
.prepare = palmas_clks_prepare,
.unprepare = palmas_clks_unprepare,
.is_prepared = palmas_clks_is_prepared,


2018-10-27 06:26:01

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 4/8] clk: pistachio: constify clk_ops structures

These clk_ops structures are only stored in the ops field of a
clk_init_data structure. This field is const, so the clk_ops
structures can be const as well.

Identified and transformed using Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/clk/pistachio/clk-pll.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/pistachio/clk-pll.c b/drivers/clk/pistachio/clk-pll.c
index 7e8daab9025b..312c3580187f 100644
--- a/drivers/clk/pistachio/clk-pll.c
+++ b/drivers/clk/pistachio/clk-pll.c
@@ -298,7 +298,7 @@ static unsigned long pll_gf40lp_frac_recalc_rate(struct clk_hw *hw,
return rate;
}

-static struct clk_ops pll_gf40lp_frac_ops = {
+static const struct clk_ops pll_gf40lp_frac_ops = {
.enable = pll_gf40lp_frac_enable,
.disable = pll_gf40lp_frac_disable,
.is_enabled = pll_gf40lp_frac_is_enabled,
@@ -307,7 +307,7 @@ static struct clk_ops pll_gf40lp_frac_ops = {
.set_rate = pll_gf40lp_frac_set_rate,
};

-static struct clk_ops pll_gf40lp_frac_fixed_ops = {
+static const struct clk_ops pll_gf40lp_frac_fixed_ops = {
.enable = pll_gf40lp_frac_enable,
.disable = pll_gf40lp_frac_disable,
.is_enabled = pll_gf40lp_frac_is_enabled,
@@ -430,7 +430,7 @@ static unsigned long pll_gf40lp_laint_recalc_rate(struct clk_hw *hw,
return rate;
}

-static struct clk_ops pll_gf40lp_laint_ops = {
+static const struct clk_ops pll_gf40lp_laint_ops = {
.enable = pll_gf40lp_laint_enable,
.disable = pll_gf40lp_laint_disable,
.is_enabled = pll_gf40lp_laint_is_enabled,
@@ -439,7 +439,7 @@ static struct clk_ops pll_gf40lp_laint_ops = {
.set_rate = pll_gf40lp_laint_set_rate,
};

-static struct clk_ops pll_gf40lp_laint_fixed_ops = {
+static const struct clk_ops pll_gf40lp_laint_fixed_ops = {
.enable = pll_gf40lp_laint_enable,
.disable = pll_gf40lp_laint_disable,
.is_enabled = pll_gf40lp_laint_is_enabled,


2018-10-29 00:45:55

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 6/8] clk: s2mps11: constify clk_ops structure

On 2018년 10월 27일 14:47, Julia Lawall wrote:
> The clk_ops structure is only stored in the ops fields of
> clk_init_data structures. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> drivers/clk/clk-s2mps11.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 5b419b82f7ca..2ce370c804aa 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -71,7 +71,7 @@ static unsigned long s2mps11_clk_recalc_rate(struct clk_hw *hw,
> return 32768;
> }
>
> -static struct clk_ops s2mps11_clk_ops = {
> +static const struct clk_ops s2mps11_clk_ops = {
> .prepare = s2mps11_clk_prepare,
> .unprepare = s2mps11_clk_unprepare,
> .is_prepared = s2mps11_clk_is_prepared,
>
>
>

Looks good to me.
Reviewed-by: Chanwoo Choi <[email protected]>

--
Best Regards,
Chanwoo Choi
Samsung Electronics

2018-10-29 07:50:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/8] clk: max77686: constify clk_ops structure

On Sat, 27 Oct 2018 at 08:23, Julia Lawall <[email protected]> wrote:
>
> The clk_ops structure is only stored in the ops field of a
> clk_init_data structure. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> drivers/clk/clk-max77686.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2018-10-29 09:20:16

by Liviu Dudau

[permalink] [raw]
Subject: Re: [PATCH 2/8] ARM: vexpress/spc: constify clk_ops structure

On Sat, Oct 27, 2018 at 07:47:36AM +0200, Julia Lawall wrote:
> The clk_ops structure is only stored in the ops field of a
> clk_init_data structure. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Acked-by: Liviu Dudau <[email protected]>

Are you going to send the series to the arm-soc maintainers directly or
you want us to cherry-pick this patch into the Versatile tree?

Best regards,
Liviu

>
> ---
> arch/arm/mach-vexpress/spc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
> index 0f5381d13494..611f22de48cb 100644
> --- a/arch/arm/mach-vexpress/spc.c
> +++ b/arch/arm/mach-vexpress/spc.c
> @@ -521,7 +521,7 @@ static int spc_set_rate(struct clk_hw *hw, unsigned long rate,
> return ve_spc_set_performance(spc->cluster, rate / 1000);
> }
>
> -static struct clk_ops clk_spc_ops = {
> +static const struct clk_ops clk_spc_ops = {
> .recalc_rate = spc_recalc_rate,
> .round_rate = spc_round_rate,
> .set_rate = spc_set_rate,
>

--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯

2018-10-29 09:35:10

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH 2/8] ARM: vexpress/spc: constify clk_ops structure



On Mon, 29 Oct 2018, Liviu Dudau wrote:

> On Sat, Oct 27, 2018 at 07:47:36AM +0200, Julia Lawall wrote:
> > The clk_ops structure is only stored in the ops field of a
> > clk_init_data structure. This field is const, so the clk_ops
> > structure can be const as well.
> >
> > Identified and transformed using Coccinelle.
> >
> > Signed-off-by: Julia Lawall <[email protected]>
>
> Acked-by: Liviu Dudau <[email protected]>
>
> Are you going to send the series to the arm-soc maintainers directly or
> you want us to cherry-pick this patch into the Versatile tree?

Please do with it whatever seems best.

Thanks,
julia

>
> Best regards,
> Liviu
>
> >
> > ---
> > arch/arm/mach-vexpress/spc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
> > index 0f5381d13494..611f22de48cb 100644
> > --- a/arch/arm/mach-vexpress/spc.c
> > +++ b/arch/arm/mach-vexpress/spc.c
> > @@ -521,7 +521,7 @@ static int spc_set_rate(struct clk_hw *hw, unsigned long rate,
> > return ve_spc_set_performance(spc->cluster, rate / 1000);
> > }
> >
> > -static struct clk_ops clk_spc_ops = {
> > +static const struct clk_ops clk_spc_ops = {
> > .recalc_rate = spc_recalc_rate,
> > .round_rate = spc_round_rate,
> > .set_rate = spc_set_rate,
> >
>
> --
> ====================
> | I would like to |
> | fix the world, |
> | but they're not |
> | giving me the |
> \ source code! /
> ---------------
> ¯\_(ツ)_/¯
>

2018-10-30 08:58:40

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 7/8] drm/imx: imx-tve: constify clk_ops structure

Hi Julia,

On Sat, 2018-10-27 at 07:47 +0200, Julia Lawall wrote:
> The clk_ops structure is only stored in the ops field of a
> clk_init_data structure. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Thank you, applied to imx-drm/next.

regards
Philipp

2018-11-06 17:42:28

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/8] clk: max77686: constify clk_ops structure

Quoting Julia Lawall (2018-10-26 22:47:35)
> The clk_ops structure is only stored in the ops field of a
> clk_init_data structure. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---

Applied to clk-next


2018-11-06 17:44:45

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 5/8] clk: pxa: constify clk_ops structures

Quoting Julia Lawall (2018-10-26 22:47:39)
> These clk_ops structures are only passed to a call to
> clk_register_composite where the corresponding parameters
> are const, so the clk_ops structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---

Applied to clk-next


2018-11-06 18:18:40

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 3/8] clk: palmas: constify clk_ops structure

Quoting Julia Lawall (2018-10-26 22:47:37)
> The clk_ops structure is only stored in the ops field of clk_init_data
> structures. This field is const, so the clk_ops structure can be
> const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---

Applied to clk-next


2018-11-06 18:18:53

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 4/8] clk: pistachio: constify clk_ops structures

Quoting Julia Lawall (2018-10-26 22:47:38)
> These clk_ops structures are only stored in the ops field of a
> clk_init_data structure. This field is const, so the clk_ops
> structures can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---

Applied to clk-next


2018-11-06 18:20:16

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 6/8] clk: s2mps11: constify clk_ops structure

Quoting Julia Lawall (2018-10-26 22:47:40)
> The clk_ops structure is only stored in the ops fields of
> clk_init_data structures. This field is const, so the clk_ops
> structure can be const as well.
>
> Identified and transformed using Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---

Applied to clk-next