[PATCH v2 1/2] watchdog: NXP LPC18xx Watchdog Timer Driver

Ezequiel Garcia
2015-07-03T14:56:14Z

Hi Joachim,

On 1 July 2015 at 20:04, Joachim Eastwood <manabian@gmail.com> wrote:
[..]
>> +static int lpc18xx_wdt_start(struct watchdog_device *wdt_dev)
>> +{
>> + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev);
>> + unsigned int val;
>> +
>> + if (timer_pending(&lpc18xx_wdt->timer))
>> + del_timer(&lpc18xx_wdt->timer);
>> +
>> + val = readl(lpc18xx_wdt->base + LPC18XX_WDT_MOD);
>> + val |= LPC18XX_WDT_MOD_WDEN;
>> + val |= LPC18XX_WDT_MOD_WDRESET;
>> + writel(val, lpc18xx_wdt->base + LPC18XX_WDT_MOD);
>
> R-M-W sequence should probably be protect with a lock.
>

Notice the watchdog framework serializes this access (see the mutex in
watchdog_dev.c). So we only need protection for the registers
accessed in the timer and the restart handler.

--
Ezequiel Garc?a, VanguardiaSur