linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init
@ 2021-03-30  6:04 Jisheng Zhang
  2021-03-31 16:14 ` Daniel Lezcano
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jisheng Zhang @ 2021-03-30  6:04 UTC (permalink / raw)
  To: Mark Rutland, Marc Zyngier, Daniel Lezcano, Thomas Gleixner
  Cc: linux-arm-kernel, linux-kernel

Some functions are not needed after booting, so mark them as __init
to move them to the .init section.

Some global variables are never modified after init, so can be
__ro_after_init.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index d0177824c518..1b885964fb34 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -51,7 +51,7 @@
 
 static unsigned arch_timers_present __initdata;
 
-static void __iomem *arch_counter_base;
+static void __iomem *arch_counter_base __ro_after_init;
 
 struct arch_timer {
 	void __iomem *base;
@@ -60,15 +60,16 @@ struct arch_timer {
 
 #define to_arch_timer(e) container_of(e, struct arch_timer, evt)
 
-static u32 arch_timer_rate;
-static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI];
+static u32 arch_timer_rate __ro_after_init;
+u32 arch_timer_rate1 __ro_after_init;
+static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI] __ro_after_init;
 
 static struct clock_event_device __percpu *arch_timer_evt;
 
-static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI;
-static bool arch_timer_c3stop;
-static bool arch_timer_mem_use_virtual;
-static bool arch_counter_suspend_stop;
+static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI;
+static bool arch_timer_c3stop __ro_after_init;
+static bool arch_timer_mem_use_virtual __ro_after_init;
+static bool arch_counter_suspend_stop __ro_after_init;
 #ifdef CONFIG_GENERIC_GETTIMEOFDAY
 static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
 #else
@@ -76,7 +77,7 @@ static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
 #endif /* CONFIG_GENERIC_GETTIMEOFDAY */
 
 static cpumask_t evtstrm_available = CPU_MASK_NONE;
-static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
+static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
 
 static int __init early_evtstrm_cfg(char *buf)
 {
@@ -176,7 +177,7 @@ static notrace u64 arch_counter_get_cntvct(void)
  * to exist on arm64. arm doesn't use this before DT is probed so even
  * if we don't have the cp15 accessors we won't have a problem.
  */
-u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct;
+u64 (*arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct;
 EXPORT_SYMBOL_GPL(arch_timer_read_counter);
 
 static u64 arch_counter_read(struct clocksource *cs)
@@ -925,7 +926,7 @@ static int validate_timer_rate(void)
  * rate was probed first, and don't verify that others match. If the first node
  * probed has a clock-frequency property, this overrides the HW register.
  */
-static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
+static void __init arch_timer_of_configure_rate(u32 rate, struct device_node *np)
 {
 	/* Who has more than one independent system counter? */
 	if (arch_timer_rate)
@@ -939,7 +940,7 @@ static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
 		pr_warn("frequency not available\n");
 }
 
-static void arch_timer_banner(unsigned type)
+static void __init arch_timer_banner(unsigned type)
 {
 	pr_info("%s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
 		type & ARCH_TIMER_TYPE_CP15 ? "cp15" : "",
-- 
2.31.0


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

* Re: [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init
  2021-03-30  6:04 [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init Jisheng Zhang
@ 2021-03-31 16:14 ` Daniel Lezcano
  2021-04-01  8:31 ` Marc Zyngier
  2021-04-09 10:27 ` [tip: timers/core] clocksource/drivers/arm_arch_timer: Add " tip-bot2 for Jisheng Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Lezcano @ 2021-03-31 16:14 UTC (permalink / raw)
  To: Jisheng Zhang, Mark Rutland, Marc Zyngier, Thomas Gleixner
  Cc: linux-arm-kernel, linux-kernel

Hi,


On 30/03/2021 08:04, Jisheng Zhang wrote:
> Some functions are not needed after booting, so mark them as __init
> to move them to the .init section.
> 
> Some global variables are never modified after init, so can be
> __ro_after_init.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Mar[ck] ? Any comment on this change ?



> ---
>  drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index d0177824c518..1b885964fb34 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -51,7 +51,7 @@
>  
>  static unsigned arch_timers_present __initdata;
>  
> -static void __iomem *arch_counter_base;
> +static void __iomem *arch_counter_base __ro_after_init;
>  
>  struct arch_timer {
>  	void __iomem *base;
> @@ -60,15 +60,16 @@ struct arch_timer {
>  
>  #define to_arch_timer(e) container_of(e, struct arch_timer, evt)
>  
> -static u32 arch_timer_rate;
> -static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI];
> +static u32 arch_timer_rate __ro_after_init;
> +u32 arch_timer_rate1 __ro_after_init;
> +static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI] __ro_after_init;
>  
>  static struct clock_event_device __percpu *arch_timer_evt;
>  
> -static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI;
> -static bool arch_timer_c3stop;
> -static bool arch_timer_mem_use_virtual;
> -static bool arch_counter_suspend_stop;
> +static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI;
> +static bool arch_timer_c3stop __ro_after_init;
> +static bool arch_timer_mem_use_virtual __ro_after_init;
> +static bool arch_counter_suspend_stop __ro_after_init;
>  #ifdef CONFIG_GENERIC_GETTIMEOFDAY
>  static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
>  #else
> @@ -76,7 +77,7 @@ static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
>  #endif /* CONFIG_GENERIC_GETTIMEOFDAY */
>  
>  static cpumask_t evtstrm_available = CPU_MASK_NONE;
> -static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
> +static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
>  
>  static int __init early_evtstrm_cfg(char *buf)
>  {
> @@ -176,7 +177,7 @@ static notrace u64 arch_counter_get_cntvct(void)
>   * to exist on arm64. arm doesn't use this before DT is probed so even
>   * if we don't have the cp15 accessors we won't have a problem.
>   */
> -u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct;
> +u64 (*arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct;
>  EXPORT_SYMBOL_GPL(arch_timer_read_counter);
>  
>  static u64 arch_counter_read(struct clocksource *cs)
> @@ -925,7 +926,7 @@ static int validate_timer_rate(void)
>   * rate was probed first, and don't verify that others match. If the first node
>   * probed has a clock-frequency property, this overrides the HW register.
>   */
> -static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
> +static void __init arch_timer_of_configure_rate(u32 rate, struct device_node *np)
>  {
>  	/* Who has more than one independent system counter? */
>  	if (arch_timer_rate)
> @@ -939,7 +940,7 @@ static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
>  		pr_warn("frequency not available\n");
>  }
>  
> -static void arch_timer_banner(unsigned type)
> +static void __init arch_timer_banner(unsigned type)
>  {
>  	pr_info("%s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
>  		type & ARCH_TIMER_TYPE_CP15 ? "cp15" : "",
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* Re: [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init
  2021-03-30  6:04 [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init Jisheng Zhang
  2021-03-31 16:14 ` Daniel Lezcano
@ 2021-04-01  8:31 ` Marc Zyngier
  2021-04-01  9:36   ` Daniel Lezcano
  2021-04-09 10:27 ` [tip: timers/core] clocksource/drivers/arm_arch_timer: Add " tip-bot2 for Jisheng Zhang
  2 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2021-04-01  8:31 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Mark Rutland, Daniel Lezcano, Thomas Gleixner, linux-arm-kernel,
	linux-kernel

On Tue, 30 Mar 2021 07:04:44 +0100,
Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
> 
> Some functions are not needed after booting, so mark them as __init
> to move them to the .init section.
> 
> Some global variables are never modified after init, so can be
> __ro_after_init.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

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

* Re: [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init
  2021-04-01  8:31 ` Marc Zyngier
@ 2021-04-01  9:36   ` Daniel Lezcano
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Lezcano @ 2021-04-01  9:36 UTC (permalink / raw)
  To: Marc Zyngier, Jisheng Zhang
  Cc: Mark Rutland, Thomas Gleixner, linux-arm-kernel, linux-kernel

On 01/04/2021 10:31, Marc Zyngier wrote:
> On Tue, 30 Mar 2021 07:04:44 +0100,
> Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
>>
>> Some functions are not needed after booting, so mark them as __init
>> to move them to the .init section.
>>
>> Some global variables are never modified after init, so can be
>> __ro_after_init.
>>
>> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> 
> Acked-by: Marc Zyngier <maz@kernel.org>
> 
> 	M.

Thanks Marc


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [tip: timers/core] clocksource/drivers/arm_arch_timer: Add __ro_after_init and __init
  2021-03-30  6:04 [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init Jisheng Zhang
  2021-03-31 16:14 ` Daniel Lezcano
  2021-04-01  8:31 ` Marc Zyngier
@ 2021-04-09 10:27 ` tip-bot2 for Jisheng Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Jisheng Zhang @ 2021-04-09 10:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jisheng Zhang, Marc Zyngier, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     e2bf384d4329bb478ad003eae1ab644756a42266
Gitweb:        https://git.kernel.org/tip/e2bf384d4329bb478ad003eae1ab644756a42266
Author:        Jisheng Zhang <Jisheng.Zhang@synaptics.com>
AuthorDate:    Tue, 30 Mar 2021 14:04:44 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 08 Apr 2021 16:41:19 +02:00

clocksource/drivers/arm_arch_timer: Add __ro_after_init and __init

Some functions are not needed after booting, so mark them as __init
to move them to the .init section.

Some global variables are never modified after init, so can be
__ro_after_init.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210330140444.4fb2a7cb@xhacker.debian
---
 drivers/clocksource/arm_arch_timer.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index d017782..1b88596 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -51,7 +51,7 @@
 
 static unsigned arch_timers_present __initdata;
 
-static void __iomem *arch_counter_base;
+static void __iomem *arch_counter_base __ro_after_init;
 
 struct arch_timer {
 	void __iomem *base;
@@ -60,15 +60,16 @@ struct arch_timer {
 
 #define to_arch_timer(e) container_of(e, struct arch_timer, evt)
 
-static u32 arch_timer_rate;
-static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI];
+static u32 arch_timer_rate __ro_after_init;
+u32 arch_timer_rate1 __ro_after_init;
+static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI] __ro_after_init;
 
 static struct clock_event_device __percpu *arch_timer_evt;
 
-static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI;
-static bool arch_timer_c3stop;
-static bool arch_timer_mem_use_virtual;
-static bool arch_counter_suspend_stop;
+static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI;
+static bool arch_timer_c3stop __ro_after_init;
+static bool arch_timer_mem_use_virtual __ro_after_init;
+static bool arch_counter_suspend_stop __ro_after_init;
 #ifdef CONFIG_GENERIC_GETTIMEOFDAY
 static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
 #else
@@ -76,7 +77,7 @@ static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
 #endif /* CONFIG_GENERIC_GETTIMEOFDAY */
 
 static cpumask_t evtstrm_available = CPU_MASK_NONE;
-static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
+static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
 
 static int __init early_evtstrm_cfg(char *buf)
 {
@@ -176,7 +177,7 @@ static notrace u64 arch_counter_get_cntvct(void)
  * to exist on arm64. arm doesn't use this before DT is probed so even
  * if we don't have the cp15 accessors we won't have a problem.
  */
-u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct;
+u64 (*arch_timer_read_counter)(void) __ro_after_init = arch_counter_get_cntvct;
 EXPORT_SYMBOL_GPL(arch_timer_read_counter);
 
 static u64 arch_counter_read(struct clocksource *cs)
@@ -925,7 +926,7 @@ static int validate_timer_rate(void)
  * rate was probed first, and don't verify that others match. If the first node
  * probed has a clock-frequency property, this overrides the HW register.
  */
-static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
+static void __init arch_timer_of_configure_rate(u32 rate, struct device_node *np)
 {
 	/* Who has more than one independent system counter? */
 	if (arch_timer_rate)
@@ -939,7 +940,7 @@ static void arch_timer_of_configure_rate(u32 rate, struct device_node *np)
 		pr_warn("frequency not available\n");
 }
 
-static void arch_timer_banner(unsigned type)
+static void __init arch_timer_banner(unsigned type)
 {
 	pr_info("%s%s%s timer(s) running at %lu.%02luMHz (%s%s%s).\n",
 		type & ARCH_TIMER_TYPE_CP15 ? "cp15" : "",

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

end of thread, other threads:[~2021-04-09 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30  6:04 [PATCH] clocksource/arm_arch_timer: add __ro_after_init and __init Jisheng Zhang
2021-03-31 16:14 ` Daniel Lezcano
2021-04-01  8:31 ` Marc Zyngier
2021-04-01  9:36   ` Daniel Lezcano
2021-04-09 10:27 ` [tip: timers/core] clocksource/drivers/arm_arch_timer: Add " tip-bot2 for Jisheng Zhang

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).