From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] watchdog: imx2_wdt: convert to watchdog core api
Date: Mon, 7 Apr 2014 09:48:11 -0700 [thread overview]
Message-ID: <20140407164811.GA28025@roeck-us.net> (raw)
In-Reply-To: <1396722580-7058-1-git-send-email-agust@denx.de>
On Sat, Apr 05, 2014 at 08:29:40PM +0200, Anatolij Gustschin wrote:
> Convert the imx2_wdt driver to the new watchdog core api.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
Looks pretty good, just a couple of nitpicks.
> ---
> NOTE: This patch applies on top of the imx2_wdt regmap-mmio support
> patch series http://comments.gmane.org/gmane.linux.kernel/1677735
>
> drivers/watchdog/Kconfig | 1 +
> drivers/watchdog/imx2_wdt.c | 292 ++++++++++++++++++-------------------------
> 2 files changed, 124 insertions(+), 169 deletions(-)
>
[ ... ]
> -static void imx2_wdt_timer_ping(unsigned long arg)
> -{
> - /* ping it every imx2_wdt.timeout / 2 seconds to prevent reboot */
> - imx2_wdt_ping();
> - mod_timer(&imx2_wdt.timer, jiffies + imx2_wdt.timeout * HZ / 2);
> + regmap_read(wdev->regmap, IMX2_WDT_WCR, &val);
> +
> + if (val & IMX2_WDT_WCR_WDE)
> + return true;
> + return false;
> }
You can simplyfy this to
return val & IMX2_WDT_WCR_WDE;
since C auto-converts from int to bool. If you feel fancy and don't
trust the C compiler, another option would be
return !!(val & IMX2_WDT_WCR_WDE);
which would at least drop the if statement.
[ ... ]
> +
> + wdog->timeout = clamp_t(unsigned, timeout, 1, IMX2_WDT_MAX_TIME);
> + if (wdog->timeout != timeout)
> dev_warn(&pdev->dev, "Initial timeout out of range! "
> - "Clamped from %u to %u\n", timeout, imx2_wdt.timeout);
> + "Clamped from %u to %u\n", timeout, wdog->timeout);
Somewhat unrelated, but this results in a checkpatch warning.
I would suggest to put the string in a single line.
dev_warn(&pdev->dev,
"Initial timeout out of range! Clamped from %u to %u\n",
timeout, wdog->timeout);
Guenter
next prev parent reply other threads:[~2014-04-07 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-05 18:29 [PATCH] watchdog: imx2_wdt: convert to watchdog core api Anatolij Gustschin
2014-04-07 16:48 ` Guenter Roeck [this message]
2014-04-07 21:30 ` Anatolij Gustschin
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=20140407164811.GA28025@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).