On Fri, Nov 16, 2012 at 06:55:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
> this will allow to ping the watchdog via poller
> 
>  /*
>   * Note: this simple framework supports one watchdog only.
>   */
>  static struct watchdog *watchdog;
>  
> +static void watchdog_poller_func(struct poller_struct *poller)
> +{
> +     watchdog->keep_alive(watchdog);
> +}
> +
> +static struct poller_struct watchdog_poller = {
> +     .func = watchdog_poller_func,
> +};
> +
>  int watchdog_register(struct watchdog *wd)
>  {
>       if (watchdog != NULL)
>               return -EBUSY;
>  
>       watchdog = wd;
> +
> +     if (watchdog->keep_alive) {
> +             int ret;
> +
> +             ret = poller_register(&watchdog_poller);
> +             if (ret) {
> +                     watchdog = NULL;
> +                     return ret;
> +             }
> +     }

Currently the watchdog is supposed to be kept alive with periodically
calling the watchdog (or wd) command. A user may decide to just
periodically ping the watchdog from C code, but this should be a users
decision (i.e. some enhancement to the wd command) and should be
available for i.MX aswell.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to