summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/watchdogadjusttochain.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-17 14:21:28 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-17 14:21:28 +0000
commit5f930f07fb9fa11e081af4154ec40106305fbdd7 (patch)
treebd93b8a9444931ace59ec29c43e842497d9644f5 /cpukit/score/src/watchdogadjusttochain.c
parentremoving unneeded files (diff)
downloadrtems-5f930f07fb9fa11e081af4154ec40106305fbdd7.tar.bz2
2009-07-17 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/watchdogadjusttochain.c: Correct bug in recent rework. Coverage not impacted.
Diffstat (limited to 'cpukit/score/src/watchdogadjusttochain.c')
-rw-r--r--cpukit/score/src/watchdogadjusttochain.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/cpukit/score/src/watchdogadjusttochain.c b/cpukit/score/src/watchdogadjusttochain.c
index 6fedb9d0e1..0578276429 100644
--- a/cpukit/score/src/watchdogadjusttochain.c
+++ b/cpukit/score/src/watchdogadjusttochain.c
@@ -33,46 +33,51 @@ void _Watchdog_Adjust_to_chain(
ISR_Level level;
Watchdog_Control *first;
- if ( !units )
+ if ( units <= 0 ) {
return;
+ }
_ISR_Disable( level );
- if ( !_Chain_Is_empty( header ) ) {
- while ( units ) {
- first = _Watchdog_First( header );
+ while ( 1 ) {
+ if ( units <= 0 ) {
+ break;
+ }
+ if ( _Chain_Is_empty( header ) ) {
+ break;
+ }
+ first = _Watchdog_First( header );
- /*
- * If it is longer than "units" until the first element on the chain
- * fires, then bump it and quit.
- */
- if ( units < first->delta_interval ) {
- first->delta_interval -= units;
- break;
- }
+ /*
+ * If it is longer than "units" until the first element on the chain
+ * fires, then bump it and quit.
+ */
+ if ( units < first->delta_interval ) {
+ first->delta_interval -= units;
+ break;
+ }
- /*
- * The first set happens in less than units, so take all of them
- * off the chain and adjust units to reflect this.
- */
- units -= first->delta_interval;
- first->delta_interval = 0;
+ /*
+ * The first set happens in less than units, so take all of them
+ * off the chain and adjust units to reflect this.
+ */
+ units -= first->delta_interval;
+ first->delta_interval = 0;
- while (1) {
- _Chain_Extract_unprotected( &first->Node );
- _Chain_Append_unprotected( to_fire, &first->Node );
+ while ( 1 ) {
+ _Chain_Extract_unprotected( &first->Node );
+ _Chain_Append_unprotected( to_fire, &first->Node );
_ISR_Flash( level );
-
- if ( _Chain_Is_empty( header ) )
- break;
-
- first = _Watchdog_First( header );
- if ( first->delta_interval != 0 )
- break;
- }
+
+ if ( _Chain_Is_empty( header ) )
+ break;
+ first = _Watchdog_First( header );
+ if ( first->delta_interval != 0 )
+ break;
}
}
+
_ISR_Enable( level );
}