ARM: davinci: make function argument and structure const
Subsystems (3)
cover ARM: davinci: make function argument and structure const
Make the function argument of davinci_common_init const. After doing this change make the structures davinci_soc_info const.
Bhumika Goyal (2):
ARM: davinci: make the function argument as const
ARM: davinci: make davinci_soc_info structures const
arch/arm/mach-davinci/common.c | 2 +- arch/arm/mach-davinci/da830.c | 2 +- arch/arm/mach-davinci/da850.c | 2 +- arch/arm/mach-davinci/dm355.c | 2 +- arch/arm/mach-davinci/dm365.c | 2 +- arch/arm/mach-davinci/dm644x.c | 2 +- arch/arm/mach-davinci/dm646x.c | 2 +- arch/arm/mach-davinci/include/mach/common.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 ARM: davinci: make the function argument as const
Make the function argument of the function davinci_common_init as const as it's memory contents are only copied during a memcpy call. So, the fields of the structure to which the argument soc_info points to never gets modified and therefore the argument can be made const.
Add const to the prototype too.
--- arch/arm/mach-davinci/common.c | 2 +- arch/arm/mach-davinci/include/mach/common.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/common.c +1 -1
@@ -77,7 +77,7 @@ static int __init davinci_init_id(struct davinci_soc_info *soc_info)return -EINVAL ; } -void __init davinci_common_init (struct davinci_soc_info *soc_info) +void __init davinci_common_init (const struct davinci_soc_info *soc_info) {int ret;
arch/arm/mach-davinci/include/mach/common.h +1 -1
@@ -79,7 +79,7 @@ struct davinci_soc_info {extern struct davinci_soc_info davinci_soc_info; -extern void davinci_common_init (struct davinci_soc_info *soc_info); +extern void davinci_common_init (const struct davinci_soc_info *soc_info);extern void davinci_init_ide (void );void davinci_restart (enum reboot_mode mode,const char *cmd);void davinci_init_late (void );
Signature · 1 line
1.9.1
Re: [PATCH 1/2] ARM: davinci: make the function argument as const
Quoted 8 lines · Bhumika Goyal
Make the function argument of the function
davinci_common_initas const as it's memory contents are only copied during a memcpy call. So, the fields of the structure to which the argumentsoc_infopoints to never gets modified and therefore the argument can be made const.
Add const to the prototype too.Signed-off-by Bhumika Goyal <[email protected]>
The subject line is written too generically. I changed that to
"
ARM: davinci: make argument to davinci_common_init() as const "
while applying to v4.16/fixes-non-critical
Thanks,
Sekhar
PATCH 2/2 ARM: davinci: make davinci_soc_info structures const
In reply to Bhumika GoyalThis is a followup patch for [PATCH 1/2].
Make the structures const as they are either passed to the function davinci_common_init having the argument as const or their field cpu_clks of type struct clk_lookup * is passed to the function davinci_clk_init. So, the fields are never modified and the structures can be const.
Done using Coccinelle.
--- arch/arm/mach-davinci/da830.c | 2 +- arch/arm/mach-davinci/da850.c | 2 +- arch/arm/mach-davinci/dm355.c | 2 +- arch/arm/mach-davinci/dm365.c | 2 +- arch/arm/mach-davinci/dm644x.c | 2 +- arch/arm/mach-davinci/dm646x.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-davinci/da830.c +1 -1
@@ -1194,7 +1194,7 @@ int __init da830_register_gpio(void) .clocksource_id = T0_BOT, }; -static struct davinci_soc_info davinci_soc_info_da830 = { +static const struct davinci_soc_info davinci_soc_info_da830 = { .io_desc = da830_io_desc, .io_desc_num =ARRAY_SIZE (da830_io_desc), .jtag_id_reg =DA8XX_SYSCFG0_BASE +DA8XX_JTAG_ID_REG ,
arch/arm/mach-davinci/da850.c +1 -1
@@ -1347,7 +1347,7 @@ int __init da850_register_gpio(void)return da8xx_register_gpio (&da850_gpio_platform_data); } -static struct davinci_soc_info davinci_soc_info_da850 = { +static const struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num =ARRAY_SIZE (da850_io_desc), .jtag_id_reg =DA8XX_SYSCFG0_BASE +DA8XX_JTAG_ID_REG ,
arch/arm/mach-davinci/dm355.c +1 -1
@@ -1006,7 +1006,7 @@ struct platform_device dm355_serial_device[] = { } }; -static struct davinci_soc_info davinci_soc_info_dm355 = { +static const struct davinci_soc_info davinci_soc_info_dm355 = { .io_desc = dm355_io_desc, .io_desc_num =ARRAY_SIZE (dm355_io_desc), .jtag_id_reg =0x01c40028 ,
arch/arm/mach-davinci/dm365.c +1 -1
@@ -1108,7 +1108,7 @@ struct platform_device dm365_serial_device[] = { } }; -static struct davinci_soc_info davinci_soc_info_dm365 = { +static const struct davinci_soc_info davinci_soc_info_dm365 = { .io_desc = dm365_io_desc, .io_desc_num =ARRAY_SIZE (dm365_io_desc), .jtag_id_reg =0x01c40028 ,
arch/arm/mach-davinci/dm644x.c +1 -1
@@ -899,7 +899,7 @@ struct platform_device dm644x_serial_device[] = { } }; -static struct davinci_soc_info davinci_soc_info_dm644x = { +static const struct davinci_soc_info davinci_soc_info_dm644x = { .io_desc = dm644x_io_desc, .io_desc_num =ARRAY_SIZE (dm644x_io_desc), .jtag_id_reg =0x01c40028 ,
arch/arm/mach-davinci/dm646x.c +1 -1
@@ -882,7 +882,7 @@ struct platform_device dm646x_serial_device[] = { } }; -static struct davinci_soc_info davinci_soc_info_dm646x = { +static const struct davinci_soc_info davinci_soc_info_dm646x = { .io_desc = dm646x_io_desc, .io_desc_num =ARRAY_SIZE (dm646x_io_desc), .jtag_id_reg =0x01c40028 ,
Signature · 1 line
1.9.1
Re: [PATCH 2/2] ARM: davinci: make davinci_soc_info structures const
Quoted 1 line · Bhumika Goyal
This is a followup patch for [PATCH 1/2].
This line is not relevant once the patch gets committed.
Quoted 2 lines
Make the structures const as they are either passed to the function
Patch description should be readable independent of subject line so we need to be more specific than "the structures"
Quoted 7 lines
davinci_common_inithaving the argument as const or their fieldcpu_clksof type structclk_lookup* is passed to the functiondavinci_clk_init. So, the fields are never modified and the structures can be const.Done using Coccinelle.
Signed-off-by Bhumika Goyal <[email protected]>
I made fixes to commit description per above and here is the updated text.
"
ARM: davinci: make davinci_soc_info structures const
Make davinci_soc_info structures const as they are either passed to the function davinci_common_init having the argument as const or their field cpu_clks of type struct clk_lookup * is passed to the function davinci_clk_init.
So, the fields are never modified and the structures can be const.
Done using Coccinelle.
"
With that I applied the patch to v4.16/fixes-non-critical
Thanks,
Sekhar