From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH 2/5] xtensa: drop platform_heartbeat
Date: Thu, 8 Jun 2023 19:22:37 -0700 [thread overview]
Message-ID: <20230609022240.1694244-3-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20230609022240.1694244-1-jcmvbkbc@gmail.com>
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 | 5 -----
arch/xtensa/kernel/platform.c | 1 -
arch/xtensa/kernel/time.c | 4 ----
arch/xtensa/platforms/xt2000/setup.c | 20 +++++++++++---------
4 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/arch/xtensa/include/asm/platform.h b/arch/xtensa/include/asm/platform.h
index 354ca942de40..3be6b4bf9763 100644
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -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)
*/
diff --git a/arch/xtensa/kernel/platform.c b/arch/xtensa/kernel/platform.c
index ac1e0e566995..bb4d426ebb44 100644
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -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),
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 16b8a6273772..1c3dfea843ec 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -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;
}
diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
index 08bc9b0ede3e..dc187684203b 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -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;
}
--
2.30.2
next prev parent reply other threads:[~2023-06-09 2:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 2:22 [PATCH 0/5] xtensa: clean up platform interface Max Filippov
2023-06-09 2:22 ` [PATCH 1/5] xtensa: xt2000: drop empty platform_init Max Filippov
2023-06-09 2:22 ` Max Filippov [this message]
2023-06-09 2:22 ` [PATCH 3/5] xtensa: drop platform_restart Max Filippov
2023-06-09 2:22 ` [PATCH 4/5] xtensa: drop platform_halt and platform_power_off Max Filippov
2023-06-09 2:22 ` [PATCH 5/5] xtensa: clean up default platform functions Max Filippov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230609022240.1694244-3-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=chris@zankel.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®