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

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Fri Jul 3 07:56:14 PDT 2015


Hi Joachim,

On 1 July 2015 at 20:04, Joachim  Eastwood <manabian at 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
www.vanguardiasur.com.ar



More information about the linux-arm-kernel mailing list