[PATCH 1/7] watchdog: add keep alive support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Nov 19 05:08:02 EST 2012


On 10:38 Mon 19 Nov     , Sascha Hauer wrote:
> 
> 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.

no this is broken

this should be completly automatic I agree that the user need to control it

we are not going to add 100s of call in barebox for this

like did U-Boot

Barebox need to ping the wtach automticly via poler
and manage soft timeout

as some watchdog have short timeout so this will make the soft tiemout (user
timeout) hw indepedant as in linux

Best Regards,
J.



More information about the barebox mailing list