[openib-general] [PATCH][DAPL] Fix sparse warnings on dapl builds

Tom Duffy tduffy at sun.com
Wed Apr 27 13:53:21 PDT 2005


This patch fixes all the sparse warnings during build of dat,
dat-provider, and ib_at.

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_connect.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_connect.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_connect.c	(working copy)
@@ -263,7 +263,7 @@ dapl_ep_connect(DAT_EP_HANDLE ep_handle,
 						       connect_evd_handle,
 						       DAT_CONNECTION_EVENT_UNREACHABLE,
 						       (DAT_HANDLE) ep_ptr, 0,
-						       0);
+						       NULL);
 			dat_status = DAT_SUCCESS;
 		}
 	} else {
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_module.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_module.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_module.c	(working copy)
@@ -44,7 +44,7 @@ MODULE_DESCRIPTION("DAT Provider for Inf
 MODULE_AUTHOR("James Lentini");
 
 int g_dapl_dbg_type = 0;
-MODULE_PARM(g_dapl_dbg_type, "i");
+module_param(g_dapl_dbg_type, int, 0644);
 MODULE_PARM_DESC(g_dapl_dbg_type, "Enable dapl debug types");
 
 static int dapl_init(void);
@@ -209,13 +209,13 @@ void DAT_PROVIDER_FINI_FUNC_NAME(const D
 	(void)dapl_provider_list_remove(provider_info->ia_name);
 }
 
-struct ib_client dapl_client = {
+static struct ib_client dapl_client = {
 	.name = "dapl",
 	.add = dapl_add_one,
 	.remove = dapl_remove_one
 };
 
-char *dev_name_suffix_table[3] = {
+static char *dev_name_suffix_table[3] = {
 	"",
 	"a",
 	"b"
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_provider.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_provider.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_provider.c	(working copy)
@@ -53,7 +53,7 @@ DAPL_PROVIDER_LIST g_dapl_provider_list;
 
 DAT_PROVIDER g_dapl_provider_template = {
 	NULL,
-	0,
+	NULL,
 	&dapl_ia_open,
 	&dapl_ia_query,
 	&dapl_ia_close,
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_cm.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_cm.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_cm.c	(working copy)
@@ -628,7 +628,7 @@ dapl_ib_setup_conn_listener(DAPL_IA * ia
 	if (status) {
 		/* need to destroy CM ID ??? */
 
-		sp_ptr->cm_srvc_handle = 0;
+		sp_ptr->cm_srvc_handle = NULL;
 
 		if (status == -EBUSY)
 			return DAT_CONN_QUAL_IN_USE;
@@ -799,22 +799,6 @@ DAT_RETURN dapl_ib_accept_connection(DAT
 	return DAT_SUCCESS;
 }
 
-DAT_RETURN dapl_ib_comm_established(DAPL_EP * ep_ptr)
-{
-	int status;
-	DAT_RETURN dat_status = DAT_SUCCESS;
-
-	status = ib_send_cm_rtu(ep_ptr->cm_handle, NULL, 0);
-	if (status) {
-		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
-			     " dapl_ib_comm_established: ib_send_cm_rtu failed: %d cm_handle: %x\n",
-			     status, ep_ptr->cm_handle);
-		return DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, 0);
-	}
-
-	return dat_status;
-}
-
 /*
  * ib_cm_get_remote_gid 
  */
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.c	(working copy)
@@ -683,7 +683,7 @@ dapl_ib_mw_unbind(DAPL_RMR * rmr,
 	mw_bind_prop.mw_access_flags = 0;
 	mw_bind_prop.send_flags =
 	    (is_signaled == DAT_TRUE) ? IB_SEND_SIGNALED : 0;
-	mw_bind_prop.mr = 0;
+	mw_bind_prop.mr = NULL;
 	mw_bind_prop.wr_id = (u64) (uintptr_t) cookie;
 	ib_status = ib_bind_mw(ep->qp_handle, rmr->mw_handle, &mw_bind_prop);
 	if (ib_status < 0) {
@@ -954,16 +954,6 @@ dapl_ib_get_async_event(ib_error_record_
 }
 
 DAT_RETURN
-dapl_ib_ncompletion_notify(ib_hca_handle_t hca_handle,
-			   ib_cq_handle_t cq_handle, DAT_COUNT num)
-{
-	int ib_status;
-
-	ib_status = ib_req_ncomp_notif(cq_handle, num);
-	return dapl_ib_status_convert(ib_status);
-}
-
-DAT_RETURN
 dapl_ib_get_hca_ids(ib_hca_handle_t hca, u8 port, union ib_gid * gid, u16 * lid)
 {
 	int status;
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_timer_util.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_timer_util.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_timer_util.c	(working copy)
@@ -52,7 +52,7 @@
 #include "dapl.h"
 #include "dapl_timer_util.h"
 
-struct timer_head {
+static struct timer_head {
 	DAPL_LLIST_HEAD timer_list_head;
 	spinlock_t lock;
 	DAPL_OS_WAIT_OBJECT wait_object;
@@ -63,7 +63,7 @@ typedef struct timer_head DAPL_TIMER_HEA
 
 void dapl_timer_thread(void *arg);
 
-void dapl_timer_init()
+void dapl_timer_init(void)
 {
 	/*
 	 * Set up the timer thread elements. The timer thread isn't
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.h
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.h	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_openib_util.h	(working copy)
@@ -105,7 +105,7 @@ typedef struct ib_shm_transport {
 	ib_mr_handle_t mr_handle;
 } ib_shm_transport_t;
 
-#define 	 IB_INVALID_HANDLE	       0
+#define 	 IB_INVALID_HANDLE	       NULL
 
 #define 	 IB_MAX_REQ_PDATA_SIZE	    92
 #define 	 IB_MAX_REP_PDATA_SIZE	    196
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_cr_accept.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_cr_accept.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_cr_accept.c	(working copy)
@@ -190,7 +190,7 @@ dapl_cr_accept(DAT_CR_HANDLE cr_handle,
 							   request_evd_handle,
 							   DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR,
 							   (DAT_HANDLE) ep_ptr,
-							   0, 0);
+							   0, NULL);
 
 			cr_ptr->header.magic = DAPL_MAGIC_CR_DESTROYED;
 		} else {
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_rmr_util.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_rmr_util.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_rmr_util.c	(working copy)
@@ -49,7 +49,7 @@ DAPL_RMR *dapl_rmr_alloc(DAPL_PZ * pz)
 	rmr->header.handle_type = DAT_HANDLE_TYPE_RMR;
 	rmr->header.owner_ia = pz->header.owner_ia;
 	rmr->header.user_context.as_64 = 0;
-	rmr->header.user_context.as_ptr = 0;
+	rmr->header.user_context.as_ptr = NULL;
 	dapl_llist_init_entry(&rmr->header.ia_list_entry);
 	dapl_ia_link_rmr(rmr->header.owner_ia, rmr);
 	spin_lock_init(&rmr->header.lock);
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_util.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_util.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_util.c	(working copy)
@@ -368,7 +368,7 @@ void dapl_ep_timeout(uintptr_t arg)
 	(void)dapl_evd_post_connection_event((DAPL_EVD *) ep_ptr->param.
 					     connect_evd_handle,
 					     DAT_CONNECTION_EVENT_TIMED_OUT,
-					     (DAT_HANDLE) ep_ptr, 0, 0);
+					     (DAT_HANDLE) ep_ptr, 0, NULL);
 }
 
 /*
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_evd_util.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_evd_util.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_evd_util.c	(working copy)
@@ -358,7 +358,7 @@ void dapl_evd_eh_print_cqe(ib_work_compl
 		"OP_COMP_AND_SWAP",
 		"OP_FETCH_AND_ADD",
 		"OP_BIND_MW",
-		0
+		NULL
 	};
 	dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK,
 		     "\t >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<\n");
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_disconnect.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_disconnect.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_ep_disconnect.c	(working copy)
@@ -144,7 +144,7 @@ dapl_ep_disconnect(DAT_EP_HANDLE ep_hand
 		evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;
 		dapl_evd_post_connection_event(evd_ptr,
 					       DAT_CONNECTION_EVENT_DISCONNECTED,
-					       (DAT_HANDLE) ep_ptr, 0, 0);
+					       (DAT_HANDLE) ep_ptr, 0, NULL);
 		dat_status = DAT_SUCCESS;
 		goto bail;
 	}
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_hash.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_hash.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_hash.c	(working copy)
@@ -145,7 +145,7 @@ dapl_hash_rehash(DAPL_HASH_ELEM * elemen
 			return;
 		}
 	}
-	*head = 0;
+	*head = NULL;
 }
 
 /*
@@ -209,7 +209,7 @@ dapl_hash_add(DAPL_HASH_TABLEP p_table,
 		 */
 		p_table->table[hashValue].key = key;
 		p_table->table[hashValue].datum = datum;
-		p_table->table[hashValue].next_element = 0;
+		p_table->table[hashValue].next_element = NULL;
 		p_table->num_entries++;
 		status = DAT_TRUE;
 	} else {
@@ -222,7 +222,7 @@ dapl_hash_add(DAPL_HASH_TABLEP p_table,
 			DAPL_HASH_ELEM *lastelement;
 			newelement->key = key;
 			newelement->datum = datum;
-			newelement->next_element = 0;
+			newelement->next_element = NULL;
 			for (lastelement = &p_table->table[hashValue];
 			     lastelement->next_element;
 			     lastelement = lastelement->next_element) {
@@ -354,7 +354,7 @@ DAT_RETURN dapl_hash_create(DAT_COUNT ta
 	for (i = 0; i < table_size; i++) {
 		p_table->table[i].datum = NO_DATUM_VALUE;
 		p_table->table[i].key = 0;
-		p_table->table[i].next_element = 0;
+		p_table->table[i].next_element = NULL;
 	}
 
 	*pp_table = p_table;
Index: gen2/users/jlentini/linux-kernel/dat-provider/dapl_llist.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat-provider/dapl_llist.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat-provider/dapl_llist.c	(working copy)
@@ -71,7 +71,7 @@ void dapl_llist_init_entry(DAPL_LLIST_EN
 {
 	entry->blink = NULL;
 	entry->flink = NULL;
-	entry->data = 0;
+	entry->data = NULL;
 	entry->list_head = NULL;
 }
 
Index: gen2/users/jlentini/linux-kernel/patches/at.c
===================================================================
--- gen2/users/jlentini/linux-kernel/patches/at.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/patches/at.c	(working copy)
@@ -118,7 +118,7 @@ struct async {
 	int sa_id;
 };
 
-struct async pending_reqs;	/* dummy head for cyclic list */
+static struct async pending_reqs;	/* dummy head for cyclic list */
 
 struct ib_at_src {
 	u32 ip;
@@ -320,7 +320,7 @@ static void req_free(struct async *pend)
 
 	pend->status = IB_AT_STATUS_INVALID;
 	pend->type = IBAT_REQ_NONE;
-	pend->sa_query = 0;
+	pend->sa_query = NULL;
 }
 
 static int req_start(struct async *q, struct async *pend,
@@ -336,7 +336,7 @@ static int req_start(struct async *q, st
 
 	if (parent) {
 		DEBUG("wait on parent %p", parent);
-		pend->next = pend->prev = 0;
+		pend->next = pend->prev = NULL;
 		pend->parent = parent;
 		pend->waiting = parent->waiting;
 		parent->waiting = pend;
@@ -344,8 +344,8 @@ static int req_start(struct async *q, st
 		return 0;	/* waiting on other request */
 	}
 
-	pend->waiting = 0;
-	pend->parent = 0;
+	pend->waiting = NULL;
+	pend->parent = NULL;
 
 	DEBUG("link to pending list %p", q);
 	pend->next = q;
@@ -396,7 +396,7 @@ static void req_end(struct async *pend, 
 		if (!*rr)
 			WARN("pending request not found in parent request!");
 
-		pend->waiting = 0;
+		pend->waiting = NULL;
 		DEBUG("child %p removed from parent %p list",
 			pend, pend->parent);
 	}
@@ -405,10 +405,10 @@ static void req_end(struct async *pend, 
 		DEBUG("pend %p ending child req %p", pend, waiting);
 		pend->waiting = waiting->waiting;
 
-		waiting->waiting = 0;
-		waiting->parent = 0;
+		waiting->waiting = NULL;
+		waiting->parent = NULL;
 
-		req_end(waiting, nrec, 0);
+		req_end(waiting, nrec, NULL);
 	}
 
 	if (pend->next) {
@@ -483,7 +483,7 @@ static struct async *lookup_pending(stru
 			break;
 
 	spin_unlock_irqrestore(&q->lock, flags);
-	return a == q ? 0 : a;
+	return a == q ? NULL : a;
 }
 
 static struct async *lookup_req_id(struct async *q, u64 id)
@@ -498,7 +498,7 @@ static struct async *lookup_req_id(struc
 			break;
 
 	spin_unlock_irqrestore(&q->lock, flags);
-	return a == q ? 0 : a;
+	return a == q ? NULL : a;
 }
 
 static void flush_pending(struct async *q)
@@ -509,7 +509,7 @@ static void flush_pending(struct async *
 	DEBUG("flushing pending q %p", q);
 	spin_lock_irqsave(&q->lock, flags);
 	while ((a = q->next) != q)
-		req_end(a, -EINTR, 0);
+		req_end(a, -EINTR, NULL);
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 
@@ -561,7 +561,7 @@ route_req_complete(struct route_req *req
 	for (pend = req->pend.waiting; pend; pend = pend->waiting)	
 		route_req_output(req, pend->data);
 
-	req_end(&req->pend, 1, 0);
+	req_end(&req->pend, 1, NULL);
 }
 
 static void
@@ -587,7 +587,7 @@ path_req_complete(int status, struct ib_
 		return;
 	}
 
-	req->pend.sa_query = 0;
+	req->pend.sa_query = NULL;
 
 	req->pend.nelem = path_req_output(req, resp, 1,
 					  req->pend.data, req->pend.nelem);
@@ -597,7 +597,7 @@ path_req_complete(int status, struct ib_
 		pend->nelem = path_req_output(req, resp, 1,
 					      pend->data, pend->nelem);
 
-	req_end(&req->pend, req->pend.nelem, 0);
+	req_end(&req->pend, req->pend.nelem, NULL);
 	spin_unlock_irqrestore(&pending_reqs.lock, flags);
 }
 
@@ -624,7 +624,7 @@ static void ib_at_sweep(void *data)
 			     (req->dst_ip & 0xff000000) >> 24,
 			     jiffies, pend->start);
 
-			req_end(pend, -ETIMEDOUT, 0);
+			req_end(pend, -ETIMEDOUT, NULL);
 		}
 	}
 
@@ -902,7 +902,7 @@ int ib_at_cancel(u64 req_id)
 
 	/* Promote first child to be pending req */
 	if ((child = a->waiting)) {
-		child->parent = 0;
+		child->parent = NULL;
 
 		/* link child after parent in pending list */
 		child->next = a->next;
@@ -910,10 +910,10 @@ int ib_at_cancel(u64 req_id)
 		a->next->prev = child;
 		a->next = child;
 
-		a->waiting = 0;		/* clear to avoid cancelling childs */
+		a->waiting = NULL;	/* clear to avoid cancelling childs */
 	}
 
-	req_end(a, -EINTR, 0);
+	req_end(a, -EINTR, NULL);
 
 	spin_unlock_irqrestore(&pending_reqs.lock, flags);
 
Index: gen2/users/jlentini/linux-kernel/dat/dr.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat/dr.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat/dr.c	(working copy)
@@ -86,7 +86,7 @@ DAT_RETURN dat_dr_fini(void)
  * Function: dat_dr_insert
  ************************************************************************/
 
-extern DAT_RETURN
+DAT_RETURN
 dat_dr_insert(const DAT_PROVIDER_INFO * info, DAT_DR_ENTRY * entry)
 {
 	DAT_RETURN status;
@@ -134,7 +134,7 @@ dat_dr_insert(const DAT_PROVIDER_INFO * 
  * Function: dat_dr_remove
  ************************************************************************/
 
-extern DAT_RETURN dat_dr_remove(const DAT_PROVIDER_INFO * info)
+DAT_RETURN dat_dr_remove(const DAT_PROVIDER_INFO * info)
 {
 	DAT_DR_ENTRY *data;
 	DAT_DICTIONARY_ENTRY dict_entry;
@@ -180,7 +180,7 @@ extern DAT_RETURN dat_dr_remove(const DA
  * Function: dat_dr_provider_open
  ************************************************************************/
 
-extern DAT_RETURN
+DAT_RETURN
 dat_dr_provider_open(const DAT_PROVIDER_INFO * info,
 		     DAT_IA_OPEN_FUNC * p_ia_open_func)
 {
@@ -206,7 +206,7 @@ dat_dr_provider_open(const DAT_PROVIDER_
  * Function: dat_dr_provider_close
  ************************************************************************/
 
-extern DAT_RETURN dat_dr_provider_close(const DAT_PROVIDER_INFO * info)
+DAT_RETURN dat_dr_provider_close(const DAT_PROVIDER_INFO * info)
 {
 	DAT_RETURN status;
 	DAT_DR_ENTRY *data;
Index: gen2/users/jlentini/linux-kernel/dat/core.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat/core.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat/core.c	(working copy)
@@ -77,7 +77,7 @@ static DAT_MODULE_STATE g_module_state =
 
 static DAT_DBG_CLASS g_dbg_class = DAT_DBG_CLASS_ERROR;
 
-MODULE_PARM(g_dbg_class, "i");
+module_param(g_dbg_class, int, 0644);
 MODULE_PARM_DESC(g_dbg_class,
 		 "Bit mask to specify class of DAT debug messages.");
 
Index: gen2/users/jlentini/linux-kernel/dat/consumer.c
===================================================================
--- gen2/users/jlentini/linux-kernel/dat/consumer.c	(revision 2219)
+++ gen2/users/jlentini/linux-kernel/dat/consumer.c	(working copy)
@@ -48,7 +48,7 @@
  *
  ***********************************************************************/
 
-DAT_RETURN dat_strerror_major(DAT_RETURN value, const char **message)
+static DAT_RETURN dat_strerror_major(DAT_RETURN value, const char **message)
 {
 	switch (DAT_GET_TYPE(value)) {
 	case DAT_SUCCESS:
@@ -168,7 +168,7 @@ DAT_RETURN dat_strerror_major(DAT_RETURN
  * Function: dat_strerror_minor
  *
  ***********************************************************************/
-DAT_RETURN dat_strerror_minor(DAT_RETURN value, const char **message)
+static DAT_RETURN dat_strerror_minor(DAT_RETURN value, const char **message)
 {
 	switch (DAT_GET_SUBTYPE(value)) {
 
@@ -1480,17 +1480,6 @@ DAT_RETURN dat_cr_handoff(DAT_CR_HANDLE 
 	return DAT_CR_HANDOFF(cr_handle, handoff);
 }
 
-DAT_RETURN dat_evd_kquery(DAT_EVD_HANDLE evd_handle,
-			  DAT_EVD_PARAM_MASK evd_param_mask,
-			  DAT_EVD_PARAM * evd_param)
-{
-	if (evd_handle == NULL) {
-		return DAT_ERROR(DAT_INVALID_HANDLE,
-				 DAT_INVALID_HANDLE_EVD_REQUEST);
-	}
-	return DAT_EVD_QUERY(evd_handle, evd_param_mask, evd_param);
-}
-
 DAT_RETURN dat_lmr_query(DAT_LMR_HANDLE lmr_handle,
 			 DAT_LMR_PARAM_MASK lmv_param_mask,
 			 DAT_LMR_PARAM * lmr_param)




More information about the general mailing list