diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2024-05-21 10:46:51 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2024-06-16 12:13:41 +0200 |
commit | df2b3829c67fc059fb4b6d8d7dfdc5946d199674 (patch) | |
tree | d6e9345a986cb7f17c5385b4d91aed29ee360317 /common | |
parent | 3a11eada38efbbe1517662d196d11c2e20d2b5ca (diff) | |
download | u-boot-df2b3829c67fc059fb4b6d8d7dfdc5946d199674.tar.gz u-boot-df2b3829c67fc059fb4b6d8d7dfdc5946d199674.tar.bz2 u-boot-df2b3829c67fc059fb4b6d8d7dfdc5946d199674.zip |
wdt-uclass: prevent multiple cyclic_register calls
Currently, the cyclic_register() done in wdt_start() is not undone in
wdt_stop(). Moreover, calling wdt_start multiple times (which is
perfectly allowed on an already started device, e.g. to change the
timeout value) will result in another struct cyclic_info being
registered, referring to the same watchdog device.
This can easily be seen on e.g. a wandboard:
=> cyclic list
function: watchdog@20bc000, cpu-time: 22 us, frequency: 1.01 times/s
=> wdt list
watchdog@20bc000 (imx_wdt)
=> wdt dev watchdog@20bc000
=> wdt start 50000
WDT: Started watchdog@20bc000 with servicing every 1000ms (50s timeout)
=> cyclic list
function: watchdog@20bc000, cpu-time: 37 us, frequency: 1.03 times/s
function: watchdog@20bc000, cpu-time: 241 us, frequency: 1.01 times/s
=> wdt start 12345
WDT: Started watchdog@20bc000 with servicing every 1000ms (12s timeout)
=> cyclic list
function: watchdog@20bc000, cpu-time: 36 us, frequency: 1.03 times/s
function: watchdog@20bc000, cpu-time: 100 us, frequency: 1.04 times/s
function: watchdog@20bc000, cpu-time: 299 us, frequency: 1.00 times/s
So properly unregister the watchdog device from the cyclic framework
in wdt_stop(). In wdt_start(), we cannot just skip the registration,
as the (new) timeout value may mean that we have to ask the cyclic
framework to call us more often. So if we're already running,
first unregister the old cyclic instance.
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'common')
0 files changed, 0 insertions, 0 deletions