mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Michael Olbrich <mol@pengutronix.de>,
	Yann Sionneau <ysionneau@kalray.eu>,
	Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH] commands: wd: add new -x option to inhibit all watchdogs
Date: Wed, 19 Jan 2022 15:08:16 +0100	[thread overview]
Message-ID: <20220119140816.610764-1-a.fatoum@pengutronix.de> (raw)

When booting after nv.autoboot=abort, barebox will drop to shell and
try to inhibit all watchdogs: If they can be disabled, they will be and
otherwise if autopoll support is compiled in, they will be periodically
fed. This is useful for development. For this to work though, barebox
needs an environment. Make watchdog_inhibit_all more accessible by
making it directly invocable with wd -x.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Cc: Michael Olbrich <mol@pengutronix.de>
Cc: Yann Sionneau <ysionneau@kalray.eu>
Cc: Jules Maselbas <jmaselbas@kalray.eu>
---
 commands/wd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/commands/wd.c b/commands/wd.c
index c186244b2b3a..11f888133aac 100644
--- a/commands/wd.c
+++ b/commands/wd.c
@@ -18,11 +18,13 @@ static int do_wd(int argc, char *argv[])
 	int opt;
 	int rc;
 
-	while ((opt = getopt(argc, argv, "d:")) > 0) {
+	while ((opt = getopt(argc, argv, "d:x")) > 0) {
 		switch (opt) {
 		case 'd':
 			wd = watchdog_get_by_name(optarg);
 			break;
+		case 'x':
+			return watchdog_inhibit_all();
 		default:
 			return COMMAND_ERROR_USAGE;
 		}
@@ -66,12 +68,13 @@ BAREBOX_CMD_HELP_TEXT("When TIME is 0, the watchdog gets disabled,")
 BAREBOX_CMD_HELP_TEXT("Without a parameter the watchdog will be re-triggered.")
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT("-d DEVICE\t", "watchdog name (default is highest priority watchdog)")
+BAREBOX_CMD_HELP_OPT("-x\t", "inhibit all watchdogs (i.e. disable or autopoll if possible)")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(wd)
 	.cmd = do_wd,
 	BAREBOX_CMD_DESC("enable/disable/trigger the watchdog")
-	BAREBOX_CMD_OPTS("[-d DEVICE] [TIME]")
+	BAREBOX_CMD_OPTS("[-d DEVICE] [-x] [TIME]")
 	BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
 	BAREBOX_CMD_HELP(cmd_wd_help)
 	BAREBOX_CMD_COMPLETE(device_complete)
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2022-01-19 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 14:08 Ahmad Fatoum [this message]
2022-01-20  8:57 ` Sascha Hauer

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=20220119140816.610764-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jmaselbas@kalray.eu \
    --cc=mol@pengutronix.de \
    --cc=ysionneau@kalray.eu \
    /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