[ofa-general] [PATCH 2/5][v1.2] dapl: fix compiler warnings in common code

Arlin Davis arlin.r.davis at intel.com
Mon Sep 1 19:25:59 PDT 2008


Cleanup uDAPL common code. 

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_ep_get_status.c |    1 +
 dapl/common/dapl_ep_modify.c     |    2 +-
 dapl/common/dapl_rmr_bind.c      |    4 +++-
 dapl/udapl/dapl_evd_wait.c       |   17 ++++++++++-------
 dapl/udapl/dapl_lmr_create.c     |    5 +++--
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/dapl/common/dapl_ep_get_status.c b/dapl/common/dapl_ep_get_status.c
index a931355..3266134 100644
--- a/dapl/common/dapl_ep_get_status.c
+++ b/dapl/common/dapl_ep_get_status.c
@@ -38,6 +38,7 @@
 
 #include "dapl.h"
 #include "dapl_ring_buffer_util.h"
+#include "dapl_cookie.h"
 
 /*
  * dapl_ep_get_status
diff --git a/dapl/common/dapl_ep_modify.c b/dapl/common/dapl_ep_modify.c
index 74e3331..05b39db 100644
--- a/dapl/common/dapl_ep_modify.c
+++ b/dapl/common/dapl_ep_modify.c
@@ -84,7 +84,7 @@ dapl_ep_modify (
 {
     DAPL_IA				*ia;
     DAPL_EP				*ep1, *ep2;
-    DAT_EP_ATTR				ep_attr1, ep_attr2;
+    DAT_EP_ATTR				ep_attr1 = {0}, ep_attr2 = {0};
     DAPL_EP				new_ep, copy_of_old_ep;
     DAPL_EP				alloc_ep; /* Holder for resources.  */
     DAPL_PZ				*tmp_pz;
diff --git a/dapl/common/dapl_rmr_bind.c b/dapl/common/dapl_rmr_bind.c
index 905ea2c..c9dc02f 100644
--- a/dapl/common/dapl_rmr_bind.c
+++ b/dapl/common/dapl_rmr_bind.c
@@ -84,15 +84,17 @@ dapli_rmr_bind_fuse (
     DAPL_COOKIE			*cookie;
     DAT_RETURN 			dat_status;
     DAT_BOOLEAN			is_signaled;
+    DAPL_HASH_DATA		hash_lmr;
 
     dat_status = dapls_hash_search (rmr->header.owner_ia->hca_ptr->lmr_hash_table,
 				    lmr_triplet->lmr_context,
-				    (DAPL_HASH_DATA *) &lmr);
+				    &hash_lmr);
     if ( DAT_SUCCESS != dat_status)
     {
 	dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
 	goto bail;
     }
+    lmr = (DAPL_LMR*)hash_lmr;
 
     /* if the ep in unconnected return an error. IB requires that the */
     /* QP be connected to change a memory window binding since:       */
diff --git a/dapl/udapl/dapl_evd_wait.c b/dapl/udapl/dapl_evd_wait.c
index 966cef0..a03c5ea 100644
--- a/dapl/udapl/dapl_evd_wait.c
+++ b/dapl/udapl/dapl_evd_wait.c
@@ -141,27 +141,30 @@ DAT_RETURN dapl_evd_wait (
     waitable = evd_ptr->evd_waitable;
 
     dapl_os_assert ( sizeof(DAT_COUNT) == sizeof(DAPL_EVD_STATE) );
-    evd_state = dapl_os_atomic_assign ( (DAPL_ATOMIC *)&evd_ptr->evd_state,
-					(DAT_COUNT) DAPL_EVD_STATE_OPEN,
-					(DAT_COUNT) DAPL_EVD_STATE_WAITED );
-    dapl_os_unlock ( &evd_ptr->header.lock );
+    evd_state = evd_ptr->evd_state;
+    if (evd_ptr->evd_state == DAPL_EVD_STATE_OPEN)
+	evd_ptr->evd_state = DAPL_EVD_STATE_WAITED;
 
     if ( evd_state != DAPL_EVD_STATE_OPEN )
     {
 	/* Bogus state, bail out */
 	dat_status = DAT_ERROR (DAT_INVALID_STATE,0);
+	dapl_os_unlock ( &evd_ptr->header.lock );
 	goto bail;
     }
 
     if (!waitable)
     {
 	/* This EVD is not waitable, reset the state and bail */
-	(void) dapl_os_atomic_assign ((DAPL_ATOMIC *)&evd_ptr->evd_state,
-					(DAT_COUNT) DAPL_EVD_STATE_WAITED,
-					evd_state);
+	if (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED)
+		evd_ptr->evd_state = evd_state;
+
 	dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_UNWAITABLE);
+	dapl_os_unlock ( &evd_ptr->header.lock );
 	goto bail;
     }
+    dapl_os_unlock ( &evd_ptr->header.lock );
+
 
     /*
      * We now own the EVD, even though we don't have the lock anymore,
diff --git a/dapl/udapl/dapl_lmr_create.c b/dapl/udapl/dapl_lmr_create.c
index 2a71864..b2492ea 100644
--- a/dapl/udapl/dapl_lmr_create.c
+++ b/dapl/udapl/dapl_lmr_create.c
@@ -202,6 +202,7 @@ dapli_lmr_create_lmr (
     DAPL_LMR 			*lmr;
     DAT_REGION_DESCRIPTION 	reg_desc;
     DAT_RETURN			dat_status;
+    DAPL_HASH_DATA		hash_lmr;
 
     dapl_dbg_log (DAPL_DBG_TYPE_API,
     		  "dapl_lmr_create_lmr (%p, %p, %p, %x, %p, %p, %p, %p)\n",
@@ -215,13 +216,13 @@ dapli_lmr_create_lmr (
 
     dat_status = dapls_hash_search (ia->hca_ptr->lmr_hash_table, 
 				    original_lmr->param.lmr_context, 
-				    (DAPL_HASH_DATA *) &lmr);
+				    &hash_lmr);
      if ( dat_status != DAT_SUCCESS )
     {
 	dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);
 	goto bail;
     }
-
+    lmr = (DAPL_LMR*)hash_lmr;
     reg_desc.for_lmr_handle = (DAT_LMR_HANDLE) original_lmr;
 
     lmr = dapl_lmr_alloc (ia, 
-- 
1.5.2.5





More information about the general mailing list