]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clocksource/drivers/vf-pit: Encapsulate clocksource enable / disable
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 4 Aug 2025 15:23:31 +0000 (17:23 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 23 Sep 2025 10:29:39 +0000 (12:29 +0200)
For the sake of lisibility, let's encapsulate the writel calls to
enable and disable the timer into a function with a self-explainatory
name.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20250804152344.1109310-14-daniel.lezcano@linaro.org
drivers/clocksource/timer-vf-pit.c

index 2a255b45561d1a1225d3031f022d5b359c46b98b..96377088a048e1fde3820f2dd4f1db69d8e44f73 100644 (file)
@@ -62,6 +62,16 @@ static inline void pit_timer_disable(struct pit_timer *pit)
        writel(0, PITTCTRL(pit->clkevt_base));
 }
 
+static inline void pit_clocksource_enable(struct pit_timer *pit)
+{
+       writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base));
+}
+
+static inline void pit_clocksource_disable(struct pit_timer *pit)
+{
+       pit_timer_disable(pit);
+}
+
 static inline void pit_irq_acknowledge(struct pit_timer *pit)
 {
        writel(PITTFLG_TIF, PITTFLG(pit->clkevt_base));
@@ -95,9 +105,9 @@ static int __init pit_clocksource_init(struct pit_timer *pit, const char *name,
        pit->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
 
        /* set the max load value and start the clock source counter */
-       pit_timer_disable(pit);
+       pit_clocksource_disable(pit);
        writel(~0, PITLDVAL(pit->clksrc_base));
-       writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base));
+       pit_clocksource_enable(pit);
 
        sched_clock_base = pit->clksrc_base + PITCVAL_OFFSET;
        sched_clock_register(pit_read_sched_clock, 32, rate);