]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clocksource/drivers/vf-pit: Encapsulate set counter function
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 4 Aug 2025 15:23:33 +0000 (17:23 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 23 Sep 2025 10:29:50 +0000 (12:29 +0200)
Encapsulate the writel() calls to set the counter into a
self-explainatory function.

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

index 609a4d9deb646dc795ca9d5c452b8d886d80030c..5551b61483f89a8c0d18bd3200458e19109e1dcb 100644 (file)
@@ -74,6 +74,11 @@ static inline void pit_timer_disable(struct pit_timer *pit)
        writel(0, PITTCTRL(pit->clkevt_base));
 }
 
+static inline void pit_timer_set_counter(void __iomem *base, unsigned int cnt)
+{
+       writel(cnt, PITLDVAL(base));
+}
+
 static inline void pit_clocksource_enable(struct pit_timer *pit)
 {
        writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base));
@@ -118,7 +123,7 @@ static int __init pit_clocksource_init(struct pit_timer *pit, const char *name,
 
        /* set the max load value and start the clock source counter */
        pit_clocksource_disable(pit);
-       writel(~0, PITLDVAL(pit->clksrc_base));
+       pit_timer_set_counter(pit->clksrc_base, ~0);
        pit_clocksource_enable(pit);
 
        sched_clock_base = pit->clksrc_base + PITCVAL_OFFSET;
@@ -139,7 +144,7 @@ static int pit_set_next_event(unsigned long delta, struct clock_event_device *ce
         * hardware requirement.
         */
        pit_timer_disable(pit);
-       writel(delta - 1, PITLDVAL(pit->clkevt_base));
+       pit_timer_set_counter(pit->clkevt_base, delta - 1);
        pit_timer_enable(pit);
 
        return 0;