ARM: EXYNOS: Constify list of retention registers
Subsystems (3)
Krzysztof Kozlowski
maintainerPATCH 1/7 ARM: EXYNOS: Constify list of retention registers
The list of retention registers (release_ret_regs field of struct exynos_pm_data and arrays with values) are not modified and can be made const to improve the const safeness.
--- arch/arm/mach-exynos/suspend.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-exynos/suspend.c +4 -4
@@ -55,7 +55,7 @@ struct exynos_wkup_irq {struct exynos_pm_data {const struct exynos_wkup_irq *wkup_irq;unsigned int wake_disable_mask; -unsigned int *release_ret_regs; +const unsigned int *release_ret_regs;void (*pm_prepare)(void );void (*pm_resume_prepare)(void );
@@ -93,7 +93,7 @@ static const struct exynos_wkup_irq exynos5250_wkup_irq[] = { { /* sentinel */ }, }; -static unsigned int exynos_release_ret_regs[] = { +static const unsigned int exynos_release_ret_regs[] = {S5P_PAD_RET_MAUDIO_OPTION ,S5P_PAD_RET_GPIO_OPTION ,S5P_PAD_RET_UART_OPTION ,
@@ -104,7 +104,7 @@ static unsigned int exynos_release_ret_regs[] = { REG_TABLE_END, }; -static unsigned int exynos3250_release_ret_regs[] = { +static const unsigned int exynos3250_release_ret_regs[] = {S5P_PAD_RET_MAUDIO_OPTION ,S5P_PAD_RET_GPIO_OPTION ,S5P_PAD_RET_UART_OPTION ,
@@ -117,7 +117,7 @@ static unsigned int exynos3250_release_ret_regs[] = { REG_TABLE_END, }; -static unsigned int exynos5420_release_ret_regs[] = { +static const unsigned int exynos5420_release_ret_regs[] = {EXYNOS_PAD_RET_DRAM_OPTION ,EXYNOS_PAD_RET_MAUDIO_OPTION ,EXYNOS_PAD_RET_JTAG_OPTION ,
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerPATCH 2/7 ARM: EXYNOS: Annotate iomem and pm_data pointers __ro_after_init
The pointers to __iomem sysram and exynos_pm_data are set only during initcalls. Later the pointers itself are used only in read-only way so we can mark them __ro_after_init to increase code safeness.
--- arch/arm/mach-exynos/exynos.c | 4 ++-- arch/arm/mach-exynos/mcpm-exynos.c | 2 +- arch/arm/mach-exynos/suspend.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-exynos/exynos.c +2 -2
@@ -36,8 +36,8 @@ static struct platform_device exynos_cpuidle = { .id = -1, }; -void __iomem *sysram_base_addr; -void __iomem *sysram_ns_base_addr; +void __iomem *sysram_base_addr__ro_after_init ; +void __iomem *sysram_ns_base_addr__ro_after_init ;void __init exynos_sysram_init (void ) {
arch/arm/mach-exynos/mcpm-exynos.c +1 -1
@@ -32,7 +32,7 @@#define EXYNOS5420_USE_ARM_CORE_DOWN_STATE BIT(29)#define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30) -static void __iomem *ns_sram_base_addr; +static void __iomem *ns_sram_base_addr__ro_after_init ;/* * The common v7_exit_coherency_flush API could not be used because of the
arch/arm/mach-exynos/suspend.c +1 -1
@@ -64,7 +64,7 @@ struct exynos_pm_data {int (*cpu_suspend)(unsigned long ); }; -static const struct exynos_pm_data *pm_data; +static const struct exynos_pm_data *pm_data__ro_after_init ;static int exynos5420_cpu_state;static unsigned int exynos_pmu_spare3;
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerPATCH 3/7 ARM: s3c24xx: Constify few integer tables
In reply to Krzysztof KozlowskiThese arrays are not modified so they can be made const.
--- arch/arm/mach-s3c24xx/bast-irq.c | 4 ++-- arch/arm/mach-s3c24xx/iotiming-s3c2410.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-s3c24xx/bast-irq.c +2 -2
@@ -44,7 +44,7 @@/* table of ISA irq nos to the relevant mask... zero means * the irq is not implemented */ -static unsigned char bast_pc104_irqmasks[] = { +static const unsigned char bast_pc104_irqmasks[] = {0 ,/* 0 */ 0 ,/* 1 */ 0 ,/* 2 */
@@ -63,7 +63,7 @@ static unsigned char bast_pc104_irqmasks[] = { 0, /* 15 */ }; -static unsigned char bast_pc104_irqs[] = {3 ,5 ,7 ,10 }; +static const unsigned char bast_pc104_irqs[] = {3 ,5 ,7 ,10 };static void bast_pc104_mask (struct irq_data *data)
arch/arm/mach-s3c24xx/iotiming-s3c2410.c +1 -1
@@ -249,7 +249,7 @@ static int s3c2410_calc_bank(struct s3c_cpufreq_config *cfg,return 0 ; } -static unsigned int tacc_tab[] = { +static const unsigned int tacc_tab[] = { [0 ] =1 , [1 ] =2 , [2 ] =3 ,
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerRFC 4/7 ARM: s3c64xx: Annotate external clock frequencies __ro_after_init
In reply to Krzysztof KozlowskiThe xtal_f and xusbxti_f static variables are modified only through __init accessors (like s3c64xx_set_xtal_freq()). Later these variables are used only in read-only way so we can mark them __ro_after_init to increase code safeness.
---
Looks safe, but not tested.
--- arch/arm/mach-s3c64xx/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-s3c64xx/common.c +2 -1
@@ -56,7 +56,8 @@#include "watchdog-reset.h" /* External clock frequency */ -static unsigned long xtal_f =12000000 , xusbxti_f =48000000 ; +static unsigned long xtal_f__ro_after_init =12000000 ; +static unsigned long xusbxti_f__ro_after_init =48000000 ;void __init s3c64xx_set_xtal_freq (unsigned long freq) {
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerPATCH 5/7 ARM: SAMSUNG: Constify array of wake irqs passed to samsung_sync_wakemask
In reply to Krzysztof KozlowskiThe samsung_sync_wakemask() iterates over passed array of wake irqs but does not modify it.
--- arch/arm/plat-samsung/include/plat/wakeup-mask.h | 2 +- arch/arm/plat-samsung/wakeup-mask.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-samsung/include/plat/wakeup-mask.h +1 -1
@@ -38,7 +38,7 @@ struct samsung_wakeup_mask {* required to be correct before we enter sleep. */ extern void samsung_sync_wakemask (void __iomem *reg, -struct samsung_wakeup_mask *masks, +const struct samsung_wakeup_mask *masks,int nr_masks);#endif /* __PLAT_WAKEUP_MASK_H */
arch/arm/plat-samsung/wakeup-mask.c +1 -1
@@ -20,7 +20,7 @@#include <plat/pm.h> void samsung_sync_wakemask (void __iomem *reg, -struct samsung_wakeup_mask *mask,int nr_mask) +const struct samsung_wakeup_mask *mask,int nr_mask) {struct irq_data *data;u32 val;
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerPATCH 6/7 ARM: s3c24xx: Constify wake_irqs
In reply to Krzysztof Kozlowskisamsung_sync_wakemask() accepts pointer to const data so wake_irqs can be made const to increase safeness.
--- arch/arm/mach-s3c24xx/pm-s3c2412.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-s3c24xx/pm-s3c2412.c +1 -1
@@ -53,7 +53,7 @@ static int s3c2412_cpu_suspend(unsigned long arg) }/* mapping of interrupts to parts of the wakeup mask */ -static struct samsung_wakeup_mask wake_irqs[] = { +static const struct samsung_wakeup_mask wake_irqs[] = { { .irq =IRQ_RTC , .bit =S3C2412_PWRCFG_RTC_MASKIRQ , }, };
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerPATCH 7/7 ARM: s3c64xx: Constify wake_irqs
In reply to Krzysztof Kozlowskisamsung_sync_wakemask() accepts pointer to const data so wake_irqs can be made const to increase safeness.
--- arch/arm/mach-s3c64xx/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-s3c64xx/pm.c +1 -1
@@ -285,7 +285,7 @@ static int s3c64xx_cpu_suspend(unsigned long arg) }/* mapping of interrupts to parts of the wakeup mask */ -static struct samsung_wakeup_mask wake_irqs[] = { +static const struct samsung_wakeup_mask wake_irqs[] = { { .irq =IRQ_RTC_ALARM , .bit =S3C64XX_PWRCFG_RTC_ALARM_DISABLE , }, { .irq =IRQ_RTC_TIC , .bit =S3C64XX_PWRCFG_RTC_TICK_DISABLE , }, { .irq =IRQ_PENDN , .bit =S3C64XX_PWRCFG_TS_DISABLE , },
Signature · 1 line
2.7.4
Hi,
Quoted 5 lines · Krzysztof Kozlowski
The list of retention registers (
release_ret_regsfield of structexynos_pm_dataand arrays with values) are not modified and can be made const to improve the const safeness.Signed-off-by Krzysztof Kozlowski <[email protected]>
for patches #1-7
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics