Skip to contentSkip to conversation

CLK: SPEAr: make structure field, function arg and strutcure const

PATCH Applied Bhumika Goyal 4 participants 7 messages Oct 17, 2017 – Nov 2, 2017

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

cover CLK: SPEAr: make structure field, function arg and strutcure const

Make structure field and function argument as const. After this change, make the structures as const.

Bhumika Goyal (2):
CLK: SPEAr: make structure field and function argument as const
CLK: SPEAr: make aux_clk_masks structures const

 drivers/clk/spear/clk-aux-synth.c   | 4 ++--
 drivers/clk/spear/clk.h             | 4 ++--
 drivers/clk/spear/spear1310_clock.c | 2 +-
 drivers/clk/spear/spear1340_clock.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 CLK: SPEAr: make structure field and function argument as const

Make the masks field of clk_aux structure const as it do not modify the fields of the aux_clk_masks structure it points to.

Make the struct aux_clk_masks *aux argument of the function clk_register_aux as const as the argument is only stored in the masks field of a clk_aux structure which is now made const.

---
 drivers/clk/spear/clk-aux-synth.c | 2 +-
 drivers/clk/spear/clk.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/spear/clk-aux-synth.c +1 -1
index f271c35..8bea5df 100644
@@ -136,7 +136,7 @@ static int clk_aux_set_rate(struct clk_hw *hw, unsigned long drate,
 
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
 		const char *parent_name, unsigned long flags, void __iomem *reg,
-		struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+	        const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
 		u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk)
 {
 	struct clk_aux *aux;
drivers/clk/spear/clk.h +2 -2
index 9834944..b9d28b3 100644
@@ -49,7 +49,7 @@ struct aux_rate_tbl {
 struct clk_aux {
 	struct			clk_hw hw;
 	void __iomem		*reg;
-	struct aux_clk_masks	*masks;
+        const struct aux_clk_masks *masks;
 	struct aux_rate_tbl	*rtbl;
 	u8			rtbl_cnt;
 	spinlock_t		*lock;
@@ -112,7 +112,7 @@ typedef unsigned long (*clk_calc_rate)(struct clk_hw *hw, unsigned long prate,
 /* clk register routines */
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
 		const char *parent_name, unsigned long flags, void __iomem *reg,
-		struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+		const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
 		u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk);
 struct clk *clk_register_frac(const char *name, const char *parent_name,
 		unsigned long flags, void __iomem *reg,
Signature · 1 line
1.9.1
#5 lore raw

PATCH 2/2 CLK: SPEAr: make aux_clk_masks structures const

In reply to Bhumika Goyal

Make these const as they are either stored in the masks 'const' field of a clk_aux structure or passed to the function clk_register_aux having the argument as const.

---
 drivers/clk/spear/clk-aux-synth.c   | 2 +-
 drivers/clk/spear/spear1310_clock.c | 2 +-
 drivers/clk/spear/spear1340_clock.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/spear/clk-aux-synth.c +1 -1
index 8bea5df..2f145e3 100644
@@ -29,7 +29,7 @@
 
 #define to_clk_aux(_hw) container_of(_hw, struct clk_aux, hw)
 
-static struct aux_clk_masks default_aux_masks = {
+static const  struct aux_clk_masks default_aux_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = AUX_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
drivers/clk/spear/spear1310_clock.c +1 -1
index 2f86e3f..591248c 100644
@@ -284,7 +284,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
drivers/clk/spear/spear1340_clock.c +1 -1
index cbb19a9..e5bc8c8 100644
@@ -323,7 +323,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 1/2] CLK: SPEAr: make structure field and function argument as const

In reply to Bhumika Goyal
Quoted 31 lines · Bhumika Goyal

Make the masks field of clk_aux structure const as it do not modify the fields of the aux_clk_masks structure it points to.

Make the struct aux_clk_masks *aux argument of the function clk_register_aux as const as the argument is only stored in the masks field of a clk_aux structure which is now made const.

---
 drivers/clk/spear/clk-aux-synth.c | 2 +-
 drivers/clk/spear/clk.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/spear/clk-aux-synth.c +1 -1
index f271c35..8bea5df 100644
@@ -136,7 +136,7 @@ static int clk_aux_set_rate(struct clk_hw *hw, unsigned long drate,
 
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
 		const char *parent_name, unsigned long flags, void __iomem *reg,
-		struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+	        const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
 		u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk)
 {
 	struct clk_aux *aux;
drivers/clk/spear/clk.h +0 -0
index 9834944..b9d28b3 100644

drivers/clk/spear/clk.h struct aux_rate_tbl { · line 52

Quoted 5 lines
drivers/clk/spear/clk.h +1 -1
@@ -49,7 +49,7 @@ struct aux_rate_tbl {
 struct clk_aux {
 	struct			clk_hw hw;
 	void __iomem		*reg;
-	struct aux_clk_masks	*masks;
+        const struct aux_clk_masks *masks;

There are spaces before const here.

julia

Quoted 16 lines
drivers/clk/spear/clk.h +1 -2
 	struct aux_rate_tbl	*rtbl;
 	u8			rtbl_cnt;
 	spinlock_t		*lock;
@@ -112,7 +112,7 @@ typedef unsigned long (*clk_calc_rate)(struct clk_hw *hw, unsigned long prate,
 /* clk register routines */
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
 		const char *parent_name, unsigned long flags, void __iomem *reg,
-		struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+		const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
 		u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk);
 struct clk *clk_register_frac(const char *name, const char *parent_name,
 		unsigned long flags, void __iomem *reg,
--

1.9.1

Acked-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] CLK: SPEAr: make aux_clk_masks structures const

In reply to Bhumika Goyal
Quoted 42 lines · Bhumika Goyal

Make these const as they are either stored in the masks 'const' field of a clk_aux structure or passed to the function clk_register_aux having the argument as const.

---
 drivers/clk/spear/clk-aux-synth.c   | 2 +-
 drivers/clk/spear/spear1310_clock.c | 2 +-
 drivers/clk/spear/spear1340_clock.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/spear/clk-aux-synth.c +1 -1
index 8bea5df..2f145e3 100644
@@ -29,7 +29,7 @@
 
 #define to_clk_aux(_hw) container_of(_hw, struct clk_aux, hw)
 
-static struct aux_clk_masks default_aux_masks = {
+static const  struct aux_clk_masks default_aux_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = AUX_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
drivers/clk/spear/spear1310_clock.c +1 -1
index 2f86e3f..591248c 100644
@@ -284,7 +284,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1310_I2S_PRS1_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
drivers/clk/spear/spear1340_clock.c +0 -0
index cbb19a9..e5bc8c8 100644

drivers/clk/spear/spear1340_clock.c line 329

Quoted 8 lines
drivers/clk/spear/spear1340_clock.c +1 -1
@@ -323,7 +323,7 @@
 };
 
 /* i2s prescaler1 masks */
-static struct aux_clk_masks i2s_prs1_masks = {
+static const struct aux_clk_masks i2s_prs1_masks = {
 	.eq_sel_mask = AUX_EQ_SEL_MASK,
 	.eq_sel_shift = SPEAR1340_I2S_PRS1_EQ_SEL_SHIFT,
 	.eq1_mask = AUX_EQ1_SEL,
Signature · 1 line
viresh
Acked-by
#3 lore raw

Re: [PATCH 1/2] CLK: SPEAr: make structure field and function argument as const

In reply to Julia Lawall
Quoted 34 lines · Julia Lawall
Quoted 30 lines · Bhumika Goyal

Make the masks field of clk_aux structure const as it do not modify the fields of the aux_clk_masks structure it points to.

Make the struct aux_clk_masks *aux argument of the function clk_register_aux as const as the argument is only stored in the masks field of a clk_aux structure which is now made const.

---
 drivers/clk/spear/clk-aux-synth.c | 2 +-
 drivers/clk/spear/clk.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/spear/clk-aux-synth.c +1 -1
index f271c35..8bea5df 100644
@@ -136,7 +136,7 @@ static int clk_aux_set_rate(struct clk_hw *hw, unsigned long drate,
 
 struct clk *clk_register_aux(const char *aux_name, const char *gate_name,
 		const char *parent_name, unsigned long flags, void __iomem *reg,
-		struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
+	        const struct aux_clk_masks *masks, struct aux_rate_tbl *rtbl,
 		u8 rtbl_cnt, spinlock_t *lock, struct clk **gate_clk)
 {
 	struct clk_aux *aux;
drivers/clk/spear/clk.h +0 -0
index 9834944..b9d28b3 100644
Quoted 8 lines

drivers/clk/spear/clk.h struct aux_rate_tbl { · line 52

Quoted 6 lines
drivers/clk/spear/clk.h +1 -1
@@ -49,7 +49,7 @@ struct aux_rate_tbl {
 struct clk_aux {
 	struct			clk_hw hw;
 	void __iomem		*reg;
-	struct aux_clk_masks	*masks;
+        const struct aux_clk_masks *masks;

There are spaces before const here.

Fix that and add my:

Signature · 1 line
viresh
Applied
#4 lore raw

Re: [PATCH 1/2] CLK: SPEAr: make structure field and function argument as const

In reply to Bhumika Goyal
Quoted 9 lines · Bhumika Goyal

Make the masks field of clk_aux structure const as it do not modify the fields of the aux_clk_masks structure it points to.

Make the struct aux_clk_masks *aux argument of the function clk_register_aux as const as the argument is only stored in the masks field of a clk_aux structure which is now made const.

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project