Message ID | 20210527220017.1266765-5-rasmus.villemoes@prevas.dk |
---|---|
State | Superseded |
Delegated to: | Stefan Roese |
Headers | show |
Series | handling all DM watchdogs in watchdog_reset() | expand |
On Thu, 27 May 2021 at 16:00, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote: > > In preparation for handling all DM watchdogs in watchdog_reset(), pull > out the code which handles starting (or not) the gd->watchdog_dev > device. > > Include the device name in various printfs. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > --- > drivers/watchdog/wdt-uclass.c | 37 ++++++++++++++++++++--------------- > 1 file changed, 21 insertions(+), 16 deletions(-) > Reviewed-by: Simon Glass <sjg@chromium.org>
On 28.05.21 00:00, Rasmus Villemoes wrote: > In preparation for handling all DM watchdogs in watchdog_reset(), pull > out the code which handles starting (or not) the gd->watchdog_dev > device. > > Include the device name in various printfs. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > drivers/watchdog/wdt-uclass.c | 37 ++++++++++++++++++++--------------- > 1 file changed, 21 insertions(+), 16 deletions(-) > > diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c > index 360f052227..5d5dbcd0f7 100644 > --- a/drivers/watchdog/wdt-uclass.c > +++ b/drivers/watchdog/wdt-uclass.c > @@ -24,11 +24,30 @@ struct wdt_priv { > ulong next_reset; > }; > > -int initr_watchdog(void) > +static void init_watchdog_dev(struct udevice *dev) > { > struct wdt_priv *priv; > int ret; > > + priv = dev_get_uclass_priv(dev); > + > + if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { > + printf("WDT: Not starting %s\n", dev->name); > + return; > + } > + > + ret = wdt_start(dev, priv->timeout * 1000, 0); > + if (ret != 0) { > + printf("WDT: Failed to start %s\n", dev->name); > + return; > + } > + > + printf("WDT: Started %s with%s servicing (%ds timeout)\n", dev->name, > + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); > +} > + > +int initr_watchdog(void) > +{ > /* > * Init watchdog: This will call the probe function of the > * watchdog driver, enabling the use of the device > @@ -42,21 +61,7 @@ int initr_watchdog(void) > return 0; > } > } > - priv = dev_get_uclass_priv(gd->watchdog_dev); > - > - if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { > - printf("WDT: Not starting\n"); > - return 0; > - } > - > - ret = wdt_start(gd->watchdog_dev, priv->timeout * 1000, 0); > - if (ret != 0) { > - printf("WDT: Failed to start\n"); > - return 0; > - } > - > - printf("WDT: Started with%s servicing (%ds timeout)\n", > - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); > + init_watchdog_dev(gd->watchdog_dev); > > return 0; > } > Viele Grüße, Stefan
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 360f052227..5d5dbcd0f7 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -24,11 +24,30 @@ struct wdt_priv { ulong next_reset; }; -int initr_watchdog(void) +static void init_watchdog_dev(struct udevice *dev) { struct wdt_priv *priv; int ret; + priv = dev_get_uclass_priv(dev); + + if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { + printf("WDT: Not starting %s\n", dev->name); + return; + } + + ret = wdt_start(dev, priv->timeout * 1000, 0); + if (ret != 0) { + printf("WDT: Failed to start %s\n", dev->name); + return; + } + + printf("WDT: Started %s with%s servicing (%ds timeout)\n", dev->name, + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); +} + +int initr_watchdog(void) +{ /* * Init watchdog: This will call the probe function of the * watchdog driver, enabling the use of the device @@ -42,21 +61,7 @@ int initr_watchdog(void) return 0; } } - priv = dev_get_uclass_priv(gd->watchdog_dev); - - if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { - printf("WDT: Not starting\n"); - return 0; - } - - ret = wdt_start(gd->watchdog_dev, priv->timeout * 1000, 0); - if (ret != 0) { - printf("WDT: Failed to start\n"); - return 0; - } - - printf("WDT: Started with%s servicing (%ds timeout)\n", - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); + init_watchdog_dev(gd->watchdog_dev); return 0; }
In preparation for handling all DM watchdogs in watchdog_reset(), pull out the code which handles starting (or not) the gd->watchdog_dev device. Include the device name in various printfs. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> --- drivers/watchdog/wdt-uclass.c | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-)