change log for rtems (2010-07-26)

rtems-vc at rtems.org rtems-vc at rtems.org
Mon Jul 26 14:10:34 UTC 2010


 *joel*:
2010-07-26	Joel Sherrill <joel.sherrilL at OARcorp.com>

	* rtems/src/ratemonperiod.c: Use if not switch since all cases of enum
	are not valid and switch was generating dead code.

M 1.2520  cpukit/ChangeLog
M   1.28  cpukit/rtems/src/ratemonperiod.c

diff -u rtems/cpukit/ChangeLog:1.2519 rtems/cpukit/ChangeLog:1.2520
--- rtems/cpukit/ChangeLog:1.2519	Sun Jul 25 10:13:35 2010
+++ rtems/cpukit/ChangeLog	Mon Jul 26 08:49:01 2010
@@ -1,3 +1,8 @@
+2010-07-26	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	* rtems/src/ratemonperiod.c: Use if not switch since all cases of enum
+	are not valid and switch was generating dead code.
+
 2010-07-25	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* sapi/include/rtems/init.h: Mark rtems_shutdown_executive as a

diff -u rtems/cpukit/rtems/src/ratemonperiod.c:1.27 rtems/cpukit/rtems/src/ratemonperiod.c:1.28
--- rtems/cpukit/rtems/src/ratemonperiod.c:1.27	Tue Dec 15 12:26:41 2009
+++ rtems/cpukit/rtems/src/ratemonperiod.c	Mon Jul 26 08:49:01 2010
@@ -1,7 +1,7 @@
 /*
  *  Rate Monotonic Manager - Period Blocking and Status
  *
- *  COPYRIGHT (c) 1989-2009.
+ *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -280,94 +280,89 @@
       }
 
       _ISR_Disable( level );
-      switch ( the_period->state ) {
-        case RATE_MONOTONIC_INACTIVE: {
+      if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
+        _ISR_Enable( level );
 
-          _ISR_Enable( level );
+        /*
+         *  Baseline statistics information for the beginning of a period.
+         */
+        _Rate_monotonic_Initiate_statistics( the_period );
+
+        the_period->state = RATE_MONOTONIC_ACTIVE;
+        _Watchdog_Initialize(
+          &the_period->Timer,
+          _Rate_monotonic_Timeout,
+          id,
+          NULL
+        );
 
-          /*
-           *  Baseline statistics information for the beginning of a period.
-           */
-          _Rate_monotonic_Initiate_statistics( the_period );
+        the_period->next_length = length;
 
-          the_period->state = RATE_MONOTONIC_ACTIVE;
-          _Watchdog_Initialize(
-            &the_period->Timer,
-            _Rate_monotonic_Timeout,
-            id,
-            NULL
-          );
-
-          the_period->next_length = length;
-
-          _Watchdog_Insert_ticks( &the_period->Timer, length );
-          _Thread_Enable_dispatch();
-          return RTEMS_SUCCESSFUL;
-        }
-        case RATE_MONOTONIC_ACTIVE:
+        _Watchdog_Insert_ticks( &the_period->Timer, length );
+        _Thread_Enable_dispatch();
+        return RTEMS_SUCCESSFUL;
+      }
 
-          /*
-           *  Update statistics from the concluding period.
-           */
-          _Rate_monotonic_Update_statistics( the_period );
-
-          /*
-           *  This tells the _Rate_monotonic_Timeout that this task is
-           *  in the process of blocking on the period and that we
-           *  may be changing the length of the next period.
-           */
-          the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING;
-          the_period->next_length = length;
-
-          _ISR_Enable( level );
-
-          _Thread_Executing->Wait.id = the_period->Object.id;
-          _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
-
-          /*
-           *  Did the watchdog timer expire while we were actually blocking
-           *  on it?
-           */
-          _ISR_Disable( level );
-            local_state = the_period->state;
-            the_period->state = RATE_MONOTONIC_ACTIVE;
-          _ISR_Enable( level );
-
-          /*
-           *  If it did, then we want to unblock ourself and continue as
-           *  if nothing happen.  The period was reset in the timeout routine.
-           */
-          if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )
-            _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
-
-          _Thread_Enable_dispatch();
-          return RTEMS_SUCCESSFUL;
-          break;
-
-        case RATE_MONOTONIC_EXPIRED:
-
-          /*
-           *  Update statistics from the concluding period
-           */
-          _Rate_monotonic_Update_statistics( the_period );
+      if ( the_period->state == RATE_MONOTONIC_ACTIVE ) {
+        /*
+         *  Update statistics from the concluding period.
+         */
+        _Rate_monotonic_Update_statistics( the_period );
+
+        /*
+         *  This tells the _Rate_monotonic_Timeout that this task is
+         *  in the process of blocking on the period and that we
+         *  may be changing the length of the next period.
+         */
+        the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING;
+        the_period->next_length = length;
+
+        _ISR_Enable( level );
+
+        _Thread_Executing->Wait.id = the_period->Object.id;
+        _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
+
+        /*
+         *  Did the watchdog timer expire while we were actually blocking
+         *  on it?
+         */
+        _ISR_Disable( level );
+          local_state = the_period->state;
+          the_period->state = RATE_MONOTONIC_ACTIVE;
+        _ISR_Enable( level );
 
-          _ISR_Enable( level );
+        /*
+         *  If it did, then we want to unblock ourself and continue as
+         *  if nothing happen.  The period was reset in the timeout routine.
+         */
+        if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING )
+          _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD );
 
-          the_period->state = RATE_MONOTONIC_ACTIVE;
-          the_period->next_length = length;
+        _Thread_Enable_dispatch();
+        return RTEMS_SUCCESSFUL;
+      }
 
-          _Watchdog_Insert_ticks( &the_period->Timer, length );
-          _Thread_Enable_dispatch();
-          return RTEMS_TIMEOUT;
-
-        case RATE_MONOTONIC_OWNER_IS_BLOCKING:
-        case RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING:
-          /*
-           *  These should never happen.
-           */
-          break;
+      if ( the_period->state == RATE_MONOTONIC_EXPIRED ) {
+	/*
+	 *  Update statistics from the concluding period
+	 */
+	_Rate_monotonic_Update_statistics( the_period );
+
+	_ISR_Enable( level );
+
+	the_period->state = RATE_MONOTONIC_ACTIVE;
+	the_period->next_length = length;
+
+	_Watchdog_Insert_ticks( &the_period->Timer, length );
+	_Thread_Enable_dispatch();
+	return RTEMS_TIMEOUT;
       }
 
+      /*
+       *  These should never happen so just return invalid Id.
+       *    - RATE_MONOTONIC_OWNER_IS_BLOCKING:
+       *    - RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING:
+       */
 #if defined(RTEMS_MULTIPROCESSING)
     case OBJECTS_REMOTE:            /* should never return this */
 #endif



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100726/e1efc380/attachment-0001.html>


More information about the vc mailing list