]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xtensa: drop platform_heartbeat
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 7 Jun 2023 00:43:47 +0000 (17:43 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 13 Jun 2023 02:48:55 +0000 (19:48 -0700)
platform_heartbeat is called from the timer interrupt handler, but
there may be no periodic timer interrupts on xtensa, so the frequency of
platform_heartbeat calls may be unrelated to HZ. Drop the callback and
reimplement its only user with a timer.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/include/asm/platform.h
arch/xtensa/kernel/platform.c
arch/xtensa/kernel/time.c
arch/xtensa/platforms/xt2000/setup.c

index 354ca942de405b4a62730a788e4d05fe70937955..3be6b4bf97631615c2b8dc69627fba62c8e3c098 100644 (file)
@@ -47,11 +47,6 @@ extern void platform_power_off (void);
  */
 extern void platform_idle (void);
 
-/*
- * platform_heartbeat is called every HZ
- */
-extern void platform_heartbeat (void);
-
 /*
  * platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE)
  */
index ac1e0e566995037a653f15d9c35ef417ff1c1a40..bb4d426ebb444283b5abc4adb738550b9b9809da 100644 (file)
@@ -32,7 +32,6 @@ _F(void, restart, (void), { while(1); });
 _F(void, halt, (void), { while(1); });
 _F(void, power_off, (void), { while(1); });
 _F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
-_F(void, heartbeat, (void), { });
 
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
 _F(void, calibrate_ccount, (void),
index 16b8a6273772cb2507a38d33e5ad0dc1e352c9ed..1c3dfea843ece552956089f997b485833ac771b2 100644 (file)
@@ -121,10 +121,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 
        set_linux_timer(get_linux_timer());
        evt->event_handler(evt);
-
-       /* Allow platform to do something useful (Wdog). */
-       platform_heartbeat();
-
        return IRQ_HANDLED;
 }
 
index 08bc9b0ede3edcf96e6bc1f22a6ea07255e1b94b..dc187684203bc4687bf18ccbb8c47958a7c4201f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/timer.h>
 
 #include <asm/processor.h>
 #include <asm/platform.h>
@@ -70,16 +71,17 @@ void __init platform_setup(char** cmdline)
 
 /* Heartbeat. Let the LED blink. */
 
-void platform_heartbeat(void)
+static void xt2000_heartbeat(struct timer_list *unused);
+
+static DEFINE_TIMER(heartbeat_timer, xt2000_heartbeat);
+
+static void xt2000_heartbeat(struct timer_list *unused)
 {
-       static int i, t;
+       static int i;
 
-       if (--t < 0)
-       {
-               t = 59;
-               led_print(7, i ? ".": " ");
-               i ^= 1;
-       }
+       led_print(7, i ? "." : " ");
+       i ^= 1;
+       mod_timer(&heartbeat_timer, jiffies + HZ / 2);
 }
 
 //#define RS_TABLE_SIZE 2
@@ -137,7 +139,7 @@ static int __init xt2000_setup_devinit(void)
 {
        platform_device_register(&xt2000_serial8250_device);
        platform_device_register(&xt2000_sonic_device);
-
+       mod_timer(&heartbeat_timer, jiffies + HZ / 2);
        return 0;
 }