ARM: OMAP2+: CM: make some structures, function arguments and pointers as const
Subsystems (3)
cover ARM: OMAP2+: CM: make some structures, function arguments and pointers as const
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(-)
Signature · 1 line
1.9.1
PATCH 1/2 ARM: OMAP2+: CM: make some pointers and function arguments as const
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.
--- arch/arm/mach-omap2/cm.h | 4 ++-- arch/arm/mach-omap2/cm_common.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/cm.h +2 -2
@@ -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 );
arch/arm/mach-omap2/cm_common.c +3 -3
@@ -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 ;
Signature · 1 line
1.9.1
PATCH 2/2 ARM: OMAP2+: CM: make cm_ll_data structures as const
In reply to Bhumika GoyalMake these const as they are only getting passed to the functions cm_register and cm_unregister having the arguments as const.
--- 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(-)
arch/arm/mach-omap2/cm2xxx.c +1 -1
@@ -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, };
arch/arm/mach-omap2/cm33xx.c +1 -1
@@ -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,
arch/arm/mach-omap2/cm3xxx.c +1 -1
@@ -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, };
arch/arm/mach-omap2/cminst44xx.c +1 -1
@@ -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,
Signature · 1 line
1.9.1
Tony Lindgren
maintainerQuoted 2 lines · Bhumika Goyal
Make some pointers and function arguments as const. After this change, make the structures of type
cm_ll_dataas const.
Thanks applying both in to omap-for-v4.16/soc.
Regards,
Tony