linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const
@ 2017-11-06 13:15 Bhumika Goyal
  2017-11-06 13:15 ` [PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments " Bhumika Goyal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-11-06 13:15 UTC (permalink / raw)
  To: julia.lawall, tony, linux, linux-arm-kernel, linux-omap, linux-kernel
  Cc: Bhumika Goyal

Make some pointers and function arguments as const. After this change,
make the structures of type cm_ll_data as const.

Bhumika Goyal (2):
  ARM: OMAP2+: CM: make some pointers and function arguments as const
  ARM: OMAP2+: CM: make cm_ll_data structures as const

 arch/arm/mach-omap2/cm.h         | 4 ++--
 arch/arm/mach-omap2/cm2xxx.c     | 2 +-
 arch/arm/mach-omap2/cm33xx.c     | 2 +-
 arch/arm/mach-omap2/cm3xxx.c     | 2 +-
 arch/arm/mach-omap2/cm_common.c  | 6 +++---
 arch/arm/mach-omap2/cminst44xx.c | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments as const
  2017-11-06 13:15 [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const Bhumika Goyal
@ 2017-11-06 13:15 ` Bhumika Goyal
  2017-11-06 13:15 ` [PATCH 2/2] ARM: OMAP2+: CM: make cm_ll_data structures " Bhumika Goyal
  2017-12-11 16:48 ` [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers " Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-11-06 13:15 UTC (permalink / raw)
  To: julia.lawall, tony, linux, linux-arm-kernel, linux-omap, linux-kernel
  Cc: Bhumika Goyal

Make the pointer cm_ll_data of type cm_ll_data as const as it does not
modify the fields of the structure it points too.
After this change, make the argument of cm_register function as const as
it is used to initialise cm_ll_data or used inside an if condition.
Make the pointer argument of cm_unregister function as const as it is only
used inside an if condition.
Add const to the function prototypes too.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-omap2/cm.h        | 4 ++--
 arch/arm/mach-omap2/cm_common.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index e833984..7b66e17 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -72,8 +72,8 @@ int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
 			     u8 idlest_shift);
 int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
 int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
-extern int cm_register(struct cm_ll_data *cld);
-extern int cm_unregister(struct cm_ll_data *cld);
+extern int cm_register(const struct cm_ll_data *cld);
+extern int cm_unregister(const struct cm_ll_data *cld);
 int omap_cm_init(void);
 int omap2_cm_base_init(void);
 
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 83c6fa7..adf8858 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -29,7 +29,7 @@
  * common CM functions
  */
 static struct cm_ll_data null_cm_ll_data;
-static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
+static const struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
 
 /* cm_base: base virtual address of the CM IP block */
 struct omap_domain_base cm_base;
@@ -189,7 +189,7 @@ int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs)
  * is NULL, or -EEXIST if cm_register() has already been called
  * without an intervening cm_unregister().
  */
-int cm_register(struct cm_ll_data *cld)
+int cm_register(const struct cm_ll_data *cld)
 {
 	if (!cld)
 		return -EINVAL;
@@ -213,7 +213,7 @@ int cm_register(struct cm_ll_data *cld)
  * -EINVAL if @cld is NULL or if @cld does not match the struct
  * cm_ll_data * previously registered by cm_register().
  */
-int cm_unregister(struct cm_ll_data *cld)
+int cm_unregister(const struct cm_ll_data *cld)
 {
 	if (!cld || cm_ll_data != cld)
 		return -EINVAL;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ARM: OMAP2+: CM: make cm_ll_data structures as const
  2017-11-06 13:15 [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const Bhumika Goyal
  2017-11-06 13:15 ` [PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments " Bhumika Goyal
@ 2017-11-06 13:15 ` Bhumika Goyal
  2017-12-11 16:48 ` [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers " Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-11-06 13:15 UTC (permalink / raw)
  To: julia.lawall, tony, linux, linux-arm-kernel, linux-omap, linux-kernel
  Cc: Bhumika Goyal

Make these const as they are only getting passed to the functions
cm_register and cm_unregister having the arguments as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-omap2/cm2xxx.c     | 2 +-
 arch/arm/mach-omap2/cm33xx.c     | 2 +-
 arch/arm/mach-omap2/cm3xxx.c     | 2 +-
 arch/arm/mach-omap2/cminst44xx.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index cd90b4c..d5b87f4 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -385,7 +385,7 @@ void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core, u32 mdm)
  *
  */
 
-static struct cm_ll_data omap2xxx_cm_ll_data = {
+static const struct cm_ll_data omap2xxx_cm_ll_data = {
 	.split_idlest_reg	= &omap2xxx_cm_split_idlest_reg,
 	.wait_module_ready	= &omap2xxx_cm_wait_module_ready,
 };
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index a9e08d8..0c9750f 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -342,7 +342,7 @@ struct clkdm_ops am33xx_clkdm_operations = {
 	.clkdm_clk_disable	= am33xx_clkdm_clk_disable,
 };
 
-static struct cm_ll_data am33xx_cm_ll_data = {
+static const struct cm_ll_data am33xx_cm_ll_data = {
 	.wait_module_ready	= &am33xx_cm_wait_module_ready,
 	.wait_module_idle	= &am33xx_cm_wait_module_idle,
 	.module_enable		= &am33xx_cm_module_enable,
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 961bc47..ec580fd 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -662,7 +662,7 @@ void omap3_cm_save_scratchpad_contents(u32 *ptr)
  *
  */
 
-static struct cm_ll_data omap3xxx_cm_ll_data = {
+static const struct cm_ll_data omap3xxx_cm_ll_data = {
 	.split_idlest_reg	= &omap3xxx_cm_split_idlest_reg,
 	.wait_module_ready	= &omap3xxx_cm_wait_module_ready,
 };
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 8774e98..2e2274f 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -512,7 +512,7 @@ struct clkdm_ops am43xx_clkdm_operations = {
 	.clkdm_xlate_address	= omap4_clkdm_xlate_address,
 };
 
-static struct cm_ll_data omap4xxx_cm_ll_data = {
+static const struct cm_ll_data omap4xxx_cm_ll_data = {
 	.wait_module_ready	= &omap4_cminst_wait_module_ready,
 	.wait_module_idle	= &omap4_cminst_wait_module_idle,
 	.module_enable		= &omap4_cminst_module_enable,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const
  2017-11-06 13:15 [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const Bhumika Goyal
  2017-11-06 13:15 ` [PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments " Bhumika Goyal
  2017-11-06 13:15 ` [PATCH 2/2] ARM: OMAP2+: CM: make cm_ll_data structures " Bhumika Goyal
@ 2017-12-11 16:48 ` Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2017-12-11 16:48 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, linux, linux-arm-kernel, linux-omap, linux-kernel

* Bhumika Goyal <bhumirks@gmail.com> [171106 05:17]:
> Make some pointers and function arguments as const. After this change,
> make the structures of type cm_ll_data as const.

Thanks applying both in to omap-for-v4.16/soc.

Regards,

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-11 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 13:15 [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers as const Bhumika Goyal
2017-11-06 13:15 ` [PATCH 1/2] ARM: OMAP2+: CM: make some pointers and function arguments " Bhumika Goyal
2017-11-06 13:15 ` [PATCH 2/2] ARM: OMAP2+: CM: make cm_ll_data structures " Bhumika Goyal
2017-12-11 16:48 ` [PATCH 0/2] ARM: OMAP2+: CM: make some structures, function arguments and pointers " Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).