mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] boot: introduce option to pass barebox-enabled watchdog to systemd
Date: Tue, 24 Nov 2020 09:28:53 +0100	[thread overview]
Message-ID: <20201124082853.GT24489@pengutronix.de> (raw)
In-Reply-To: <fa7bb675-5d2f-cb9b-2dc4-e4cd26d72970@pengutronix.de>

On Tue, Nov 24, 2020 at 09:26:32AM +0100, Ahmad Fatoum wrote:
> Hi,
> 
> On 24.11.20 09:23, Sascha Hauer wrote:
> >> +static struct watchdog *__watchdog;
> > 
> > The name looks like you have something to hide. Perhaps boot_enabled_watchdog?
> 
> Can do.
> 
> >> +
> >> +static int watchdog_of_fixup(struct device_node *root, void *arg)
> >> +{
> >> +	int alias_id;
> >> +	char *buf;
> >> +
> >> +	if (!__watchdog)
> >> +		return 0;
> >> +
> >> +	alias_id = watchdog_get_alias_id_from(__watchdog, root);
> >> +	if (alias_id < 0)
> >> +		return 0;
> >> +
> >> +	buf = basprintf("systemd.watchdog-device=/dev/watchdog%d", alias_id);
> >> +	if (!buf)
> >> +		return 0;
> >> +
> >> +	globalvar_add_simple("linux.bootargs.dyn.watchdog", buf);
> >> +	free(buf);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >> +static int __maybe_unused of_register_watchdog_fixup(void)
> >> +{
> >> +	return of_register_fixup(watchdog_of_fixup, NULL);
> >> +}
> >> +#ifdef CONFIG_SYSTEMD_OF_WATCHDOG
> >> +/* _must_ not be run after late_initcall(of_register_bootargs_fixup) */
> > 
> > I smell problems here. How about calling this directly from
> > of_fixup_bootargs()?
> 
> Feels wrong to have watchdog specific stuff over there.

Also feels wrong to put code dependencies into comments.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  reply	other threads:[~2020-11-24  8:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 14:06 [PATCH 1/2] watchdog: implement watchdog_get_alias_id_from Ahmad Fatoum
2020-11-20 14:06 ` [PATCH 2/2] boot: introduce option to pass barebox-enabled watchdog to systemd Ahmad Fatoum
2020-11-24  8:13   ` [PATCH] fixup! watchdog: implement watchdog_get_alias_id_from Ahmad Fatoum
2020-11-24  8:23   ` [PATCH 2/2] boot: introduce option to pass barebox-enabled watchdog to systemd Sascha Hauer
2020-11-24  8:26     ` Ahmad Fatoum
2020-11-24  8:28       ` Sascha Hauer [this message]
2020-11-24  8:08 ` [PATCH 1/2] watchdog: implement watchdog_get_alias_id_from 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=20201124082853.GT24489@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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