[Cbe-oss-dev] [PATCH 3/10 v2] MARS: task event flag fix bit or check

Yuji Mano Yuji.Mano at am.sony.com
Fri Aug 29 08:07:58 EST 2008


This fixes a bug in task event flag when checking the set bits when the mask
mode is MARS_TASK_EVENT_FLAG_MASK_OR.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
Acked-by: Kazunori Asayama <asayama at sm.sony.co.jp>

---
v2:
 - rebased patch

 src/host/lib/mars_task_event_flag.c |    8 ++++----
 src/mpu/lib/mars_task_event_flag.c  |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

--- a/src/host/lib/mars_task_event_flag.c
+++ b/src/host/lib/mars_task_event_flag.c
@@ -120,7 +120,7 @@ int mars_task_event_flag_set(struct mars
 		/* check condition based on wait mode */
 		switch (event_flag->wait_mask_mode[i]) {
 		case MARS_TASK_EVENT_FLAG_MASK_OR:
-			if ((bits | event_flag->wait_mask[i]) == 0)
+			if ((bits & event_flag->wait_mask[i]) == 0)
 				continue;
 			break;
 		case MARS_TASK_EVENT_FLAG_MASK_AND:
@@ -176,9 +176,9 @@ int mars_task_event_flag_wait(struct mar
 	/* check condition based on wait mode */
 	switch (mask_mode) {
 	case MARS_TASK_EVENT_FLAG_MASK_OR:
-		while ((event_flag->bits | mask) == 0) {
+		while ((event_flag->bits & mask) == 0) {
 			mars_mutex_unlock((struct mars_mutex *)event_flag);
-			while ((event_flag->bits | mask) == 0)
+			while ((event_flag->bits & mask) == 0)
 				sched_yield();
 			mars_mutex_lock((struct mars_mutex *)event_flag);
 		}
@@ -220,7 +220,7 @@ int mars_task_event_flag_try_wait(struct
 	/* check condition based on wait mode */
 	switch (mask_mode) {
 	case MARS_TASK_EVENT_FLAG_MASK_OR:
-		if ((event_flag->bits | mask) == 0) {
+		if ((event_flag->bits & mask) == 0) {
 			mars_mutex_unlock((struct mars_mutex *)event_flag);
 			return MARS_ERROR_BUSY;
 		}
--- a/src/mpu/lib/mars_task_event_flag.c
+++ b/src/mpu/lib/mars_task_event_flag.c
@@ -122,7 +122,7 @@ int mars_task_event_flag_set(uint64_t ev
 		/* check condition based on wait mode */
 		switch (event_flag.wait_mask_mode[i]) {
 		case MARS_TASK_EVENT_FLAG_MASK_OR:
-			if ((bits | event_flag.wait_mask[i]) == 0)
+			if ((bits & event_flag.wait_mask[i]) == 0)
 				continue;
 			break;
 		case MARS_TASK_EVENT_FLAG_MASK_AND:
@@ -198,7 +198,7 @@ int mars_task_event_flag_wait(uint64_t e
 	/* check condition based on wait mode */
 	switch (mask_mode) {
 	case MARS_TASK_EVENT_FLAG_MASK_OR:
-		if ((event_flag.bits | mask) == 0)
+		if ((event_flag.bits & mask) == 0)
 			wait = 1;
 		break;
 	case MARS_TASK_EVENT_FLAG_MASK_AND:
@@ -259,7 +259,7 @@ int mars_task_event_flag_try_wait(uint64
 	/* check condition based on wait mode */
 	switch (mask_mode) {
 	case MARS_TASK_EVENT_FLAG_MASK_OR:
-		if ((event_flag.bits | mask) == 0) {
+		if ((event_flag.bits & mask) == 0) {
 			mars_mutex_unlock_put(event_flag_ea,
 				(struct mars_mutex *)&event_flag);
 			return MARS_ERROR_BUSY;





More information about the cbe-oss-dev mailing list