Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@google.com>
To: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-watchdog@vger.kernel.org, Wim Van Sebroeck <wim@iguana.be>,
	Alessandro Zummo <alessandro.zummo@towertech.it>,
	rtc-linux@googlegroups.com,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/4] rtc: stmp3xxx: add wdt-accessor function
Date: Wed, 28 Sep 2011 12:28:49 -0700	[thread overview]
Message-ID: <20110928122849.42f903a2.akpm@google.com> (raw)
In-Reply-To: <1317212997-26668-2-git-send-email-w.sang@pengutronix.de>

On Wed, 28 Sep 2011 14:29:54 +0200
Wolfram Sang <w.sang@pengutronix.de> wrote:

> This RTC also includes a watchdog timer. Provide an accessor function
> for it to be picked up by a watchdog driver. Also register the
> platform_device here to get proper boot-time dependencies.
> 
> ...
>
> Andrew, Wim: Alessandro was not around in the last weeks, so I'd suggest this
> patch goes via the watchdog-tree together with the rest of this series if it
> passes the review of the watchdog-list? All changes here are in preparation for
> the watchdog driver and do not affect the general RTC. Is that okay?

OK by me.  Be careful about the Kconfig setup when doing
cross-subsystem dependencies like this.  Otherwise you get sad emails
from Randy when his build breaks.

>
> ...
>
>  struct stmp3xxx_rtc_data {
>  	struct rtc_device *rtc;
>  	void __iomem *io;
>  	int irq_alarm;
>  };
>  
> +#ifdef CONFIG_STMP3XXX_RTC_WATCHDOG

Should it be

#if defined(CONFIG_STMP3XXX_RTC_WATCHDOG) || defined(CONFIG_STMP3XXX_RTC_WATCHDOG_MODULE)

?

> +struct platform_device stmp3xxx_wdt_pdev = {

static?

> +	.name = "stmp3xxx_rtc_wdt",
> +	.id = -1,
> +};
> +
> +void stmp3xxx_wdt_setup(struct device *dev, u32 timeout)

I'd suggest documenting `timeout' at least.  Why would one want to set
it to zero and what effect does that have?  What are its units?

> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct stmp3xxx_rtc_data *rtc_data = platform_get_drvdata(pdev);
> +	void __iomem *base;
> +
> +	if (timeout) {
> +		writel(timeout, rtc_data->io + STMP3XXX_RTC_WATCHDOG);
> +		base = rtc_data->io + MXS_SET_ADDR;
> +	} else {
> +		base = rtc_data->io + MXS_CLR_ADDR;
> +	}
> +	writel(STMP3XXX_RTC_CTRL_WATCHDOGEN, base + STMP3XXX_RTC_CTRL);
> +	writel(STMP3XXX_RTC_PERSISTENT1_FORCE_UPDATER,
> +		base + STMP3XXX_RTC_PERSISTENT1);
> +}
> +EXPORT_SYMBOL_GPL(stmp3xxx_wdt_setup);

The patch adds a global symbol but fails to declare that symbol in a
header file.  This is always wrong.

> +static void stmp3xxx_wdt_register(struct device *dev)
> +{
> +	stmp3xxx_wdt_pdev.dev.parent = dev;
> +	platform_device_register(&stmp3xxx_wdt_pdev);
> +}
> +#else
> +static void stmp3xxx_wdt_register(struct device *dev)
> +{
> +}
> +#endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */
> +
>  static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
>  {
>  	/*
> @@ -231,6 +274,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
>  		goto out_irq_alarm;
>  	}
>  
> +	stmp3xxx_wdt_register(&pdev->dev);
>  	return 0;


  reply	other threads:[~2011-09-28 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-28 12:29 [PATCH 0/4] watchdog: new driver for STMP3xxx/MX23/MX28 Wolfram Sang
2011-09-28 12:29 ` [PATCH 1/4] rtc: stmp3xxx: add wdt-accessor function Wolfram Sang
2011-09-28 19:28   ` Andrew Morton [this message]
2011-09-30 17:26     ` Wolfram Sang
2011-09-28 12:29 ` [PATCH 2/4] watchdog: add define to setup nowayout feature in the status-variable Wolfram Sang
2011-09-28 12:29 ` [PATCH 3/4] watchdog: add new driver for STMP3xxx and i.MX23/28 Wolfram Sang
2011-09-28 12:35 ` [PATCH 4/4] watchdog: remove old STMP driver Wolfram Sang

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=20110928122849.42f903a2.akpm@google.com \
    --to=akpm@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alessandro.zummo@towertech.it \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=w.sang@pengutronix.de \
    --cc=wim@iguana.be \
    /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