[openib-general] [PATCH] SDP & CM: change some functions to return void

Tom Duffy tduffy at sun.com
Fri May 13 08:27:58 PDT 2005


This patch changes some functions to return void rather than an int
since they were always returning 0, thus making checking return values
rather pointless.  The patch touches both SDP and CM.

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

Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_link.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_link.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_link.c	(working copy)
@@ -720,19 +720,7 @@ int sdp_link_addr_init(void)
 	int result;
 
 	sdp_dbg_init("Link level services initialization.");
-#if 0
-	/*
-	 * Install async event handler, to clear cache on port down
-	 */
-	result = tsIbAsynchronousEventHandlerRegister(TS_IB_PORT_ERROR,
-						      _tsSdpAsyncEventFunc,
-						      NULL,
-						      &_tsSdpAsyncHandle);
-	if (result) {
-		
-		goto error_async;
-	}
-#endif
+
 	info_cache = kmem_cache_create("sdp_path_info",
 					sizeof(struct sdp_path_info),
 					0, SLAB_HWCACHE_ALIGN,
@@ -784,7 +772,7 @@ error_path:
 /*
  * sdp_link_addr_cleanup - cleanup the link address retrival code
  */
-int sdp_link_addr_cleanup(void)
+void sdp_link_addr_cleanup(void)
 {
 	struct sdp_path_info *info;
 
@@ -809,12 +797,4 @@ int sdp_link_addr_cleanup(void)
 	 */
 	kmem_cache_destroy(info_cache);
 	kmem_cache_destroy(wait_cache);
-#if 0
-	/*
-	 * release async event handler
-	 */
-	(void)tsIbAsynchronousEventHandlerUnregister(_tsSdpAsyncHandle);
-#endif
-
-	return 0;
 }
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_inet.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_inet.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_inet.c	(working copy)
@@ -1553,15 +1553,15 @@ static int __init sdp_init(void)
 
 	return 0;
 error_sock:
-	(void)sdp_conn_table_clear();
+	sdp_conn_table_clear();
 error_conn:
-	(void)sdp_buff_pool_destroy();
+	sdp_buff_pool_destroy();
 error_buff:
-	(void)sdp_link_addr_cleanup();
+	sdp_link_addr_cleanup();
 error_link:
 	sdp_main_advt_cleanup();
 error_advt:
-	(void)sdp_main_proc_cleanup();
+	sdp_main_proc_cleanup();
 error_proc:
 	return result;		/* success */
 }
@@ -1579,15 +1579,15 @@ static void __exit sdp_exit(void)
 	/*
 	 * connection table
 	 */
-	(void)sdp_conn_table_clear();
+	sdp_conn_table_clear();
 	/*
 	 * delete buffer memory
 	 */
-	(void)sdp_buff_pool_destroy();
+	sdp_buff_pool_destroy();
 	/*
 	 * delete link information
 	 */
-	(void)sdp_link_addr_cleanup();
+	sdp_link_addr_cleanup();
 	/*
 	 * delete advertisment table
 	 */
@@ -1595,7 +1595,7 @@ static void __exit sdp_exit(void)
 	/*
 	 * proc tables
 	 */
-	(void)sdp_main_proc_cleanup();
+	sdp_main_proc_cleanup();
 }
 
 module_init(sdp_init);
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proto.h
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proto.h	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proto.h	(working copy)
@@ -186,13 +186,13 @@ void sdp_iocb_q_remove(struct sdpc_iocb 
 
 int sdp_iocb_register(struct sdpc_iocb *iocb, struct sdp_opt *conn);
 
-int sdp_iocb_release(struct sdpc_iocb *iocb);
+void sdp_iocb_release(struct sdpc_iocb *iocb);
 
 int sdp_iocb_complete(struct sdpc_iocb *iocb, ssize_t status);
 
 int sdp_iocb_lock(struct sdpc_iocb *iocb);
 
-int sdp_iocb_unlock(struct sdpc_iocb *iocb);
+void sdp_iocb_unlock(struct sdpc_iocb *iocb);
 
 /*
  * Generic object managment
@@ -236,7 +236,7 @@ void sdp_desc_q_clear(struct sdpc_desc_q
  */
 int sdp_main_proc_init(void);
 
-int sdp_main_proc_cleanup(void);
+void sdp_main_proc_cleanup(void);
 
 /*
  * connection table
@@ -249,7 +249,7 @@ int sdp_conn_table_init(int proto_family
 			int send_buff_max,
 			int send_usig_max);
 
-int sdp_conn_table_clear(void);
+void sdp_conn_table_clear(void);
 
 int sdp_proc_dump_conn_main(char *buffer,
 			    int   max_size,
@@ -434,7 +434,7 @@ int sdp_link_path_lookup(u32 dst_addr,
 
 int sdp_link_addr_init(void);
 
-int sdp_link_addr_cleanup(void);
+void sdp_link_addr_cleanup(void);
 
 /*
  * Function types
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_conn.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_conn.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_conn.c	(working copy)
@@ -613,7 +613,7 @@ static void sdp_desc_q_cancel_iocb(struc
 			 NULL))) {
 
 		sdp_iocb_q_remove(iocb);
-		(void)sdp_iocb_complete(iocb, error);
+		sdp_iocb_complete(iocb, error);
 	}
 }
 
@@ -741,11 +741,7 @@ void sdp_conn_destruct(struct sdp_opt *c
 	 */
 	if (conn->cm_id) {
 		sdp_dbg_warn(conn, "destroying CM ID.");
-
-		result = ib_destroy_cm_id(conn->cm_id);
-		if (result)
-			sdp_dbg_warn(conn, "Error <%d> detroying CM ID",
-				     result);
+		ib_destroy_cm_id(conn->cm_id);
 	}
 	/*
 	 * check consistancy
@@ -1826,7 +1822,7 @@ error:
 	}
 
 	if (!IS_ERR(hca->fmr_pool))
-		(void)ib_destroy_fmr_pool(hca->fmr_pool);
+		ib_destroy_fmr_pool(hca->fmr_pool);
 
 	if (!IS_ERR(hca->mem_h))
 		(void)ib_dereg_mr(hca->mem_h);
@@ -1861,7 +1857,7 @@ static void sdp_device_remove_one(struct
 	}
 
 	if (!IS_ERR(hca->fmr_pool))
-		(void)ib_destroy_fmr_pool(hca->fmr_pool);
+		ib_destroy_fmr_pool(hca->fmr_pool);
 
 	if (!IS_ERR(hca->mem_h))
 		(void)ib_dereg_mr(hca->mem_h);
@@ -1999,7 +1995,7 @@ int sdp_conn_table_init(int proto_family
 
 	return 0;
 error_listen:
-	(void)ib_destroy_cm_id(dev_root_s.listen_id);
+	ib_destroy_cm_id(dev_root_s.listen_id);
 error_cm_id:
 	kmem_cache_destroy(dev_root_s.sock_cache);
 error_sock:
@@ -2019,8 +2015,8 @@ error_hca:
 /*
  * sdp_conn_table_clear - destroy connection managment and tables
  */
-int sdp_conn_table_clear(void)
- {
+void sdp_conn_table_clear(void)
+{
 	sdp_dbg_init("Deleting connection tables.");
 #if 0
 	struct sdp_opt *conn;
@@ -2055,7 +2051,5 @@ int sdp_conn_table_clear(void)
 	/*
 	 * stop listening
 	 */
-	(void)ib_destroy_cm_id(dev_root_s.listen_id);
-
-	return 0;
+	ib_destroy_cm_id(dev_root_s.listen_id);
 }
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_wall.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_wall.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_wall.c	(working copy)
@@ -422,8 +422,6 @@ void sdp_wall_recv_drop(struct sdp_opt *
 
 		break;
 	}
-
-	return;
 }
 
 /*
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_recv.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_recv.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_recv.c	(working copy)
@@ -447,7 +447,7 @@ release:
 	iocb->flags &= ~SDP_IOCB_F_ACTIVE;
 	iocb->flags &= ~SDP_IOCB_F_RDMA_W;
 
-	(void)sdp_iocb_release(iocb);
+	sdp_iocb_release(iocb);
 error:
 	return result;
 }
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proc.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proc.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_proc.c	(working copy)
@@ -127,7 +127,7 @@ static struct sdpc_proc_ent file_entry_l
 /*
  * sdp_main_proc_cleanup - cleanup the proc filesystem entries
  */
-int sdp_main_proc_cleanup(void)
+void sdp_main_proc_cleanup(void)
 {
 	struct sdpc_proc_ent *sub_entry;
 	int counter;
@@ -149,8 +149,6 @@ int sdp_main_proc_cleanup(void)
 	dir_root = NULL;
 
 	sdp_dbg_init("/proc filesystem cleanup complete.");
-
-	return 0;
 }
 
 /*
@@ -212,6 +210,6 @@ int sdp_main_proc_init(void)
 
 	return 0;		/* success */
 error:
-	(void)sdp_main_proc_cleanup();
+	sdp_main_proc_cleanup();
 	return result;
 }
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_iocb.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_iocb.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_iocb.c	(working copy)
@@ -47,7 +47,7 @@ static do_mlock_ptr_t mlock_ptr = NULL;
 /*
  * do_iocb_unlock - unlock the memory for an IOCB
  */
-static int do_iocb_unlock(struct sdpc_iocb *iocb)
+static void do_iocb_unlock(struct sdpc_iocb *iocb)
 {
 	struct vm_area_struct *vma;
 
@@ -90,28 +90,24 @@ static int do_iocb_unlock(struct sdpc_io
 		else
 			vma = NULL;
 	}
-
-	return 0;
 }
 
 /*
  * sdp_iocb_unlock - unlock the memory for an IOCB
  */
-int sdp_iocb_unlock(struct sdpc_iocb *iocb)
+void sdp_iocb_unlock(struct sdpc_iocb *iocb)
 {
-	int result;
-
 	/*
 	 * check if IOCB is locked.
 	 */
 	if (!(iocb->flags & SDP_IOCB_F_LOCKED))
-		return 0;
+		return;
 	/*
 	 * spin lock since this could be from interrupt context.
 	 */
 	down_write(&iocb->mm->mmap_sem);
 	
-	result = do_iocb_unlock(iocb);
+	do_iocb_unlock(iocb);
 
 	up_write(&iocb->mm->mmap_sem);
 
@@ -125,8 +121,6 @@ int sdp_iocb_unlock(struct sdpc_iocb *io
 	 * mark IOCB unlocked.
 	 */
 	iocb->flags &= ~SDP_IOCB_F_LOCKED;
-
-	return result;
 }
 
 /*
@@ -331,7 +325,7 @@ int sdp_iocb_lock(struct sdpc_iocb *iocb
 	return 0;
 err_save:
 
-	(void)do_iocb_unlock(iocb);
+	do_iocb_unlock(iocb);
 err_lock:
 	/*
 	 * unlock the mm and restore capabilities.
@@ -402,15 +396,13 @@ done:
 /*
  * sdp_mem_lock_cleanup - cleanup the memory locking tables
  */
-static int sdp_mem_lock_cleanup(void)
+static void sdp_mem_lock_cleanup(void)
 {
 	sdp_dbg_init("Memory Locking cleanup.");
 	/*
 	 * null out entries.
 	 */
 	mlock_ptr = NULL;
-	
-	return 0;
 }
 
 /*
@@ -472,12 +464,12 @@ error:
 /*
  * sdp_iocb_release - unregister an IOCBs memory
  */
-int sdp_iocb_release(struct sdpc_iocb *iocb)
+void sdp_iocb_release(struct sdpc_iocb *iocb)
 {
 	int result;
 
 	if (!(iocb->flags & SDP_IOCB_F_REG))
-		return 0;
+		return;
 
 	result = ib_fmr_pool_unmap(iocb->mem);
 	if (result < 0)
@@ -485,8 +477,6 @@ int sdp_iocb_release(struct sdpc_iocb *i
 			    result, iocb->key, iocb->addr);
 
 	iocb->flags &= ~(SDP_IOCB_F_REG);
-
-	return 0;
 }
 
 /*
@@ -500,17 +490,11 @@ static void do_iocb_complete(void *arg)
 	/*
 	 * release memory
 	 */
-	result = sdp_iocb_release(iocb);
-	if (result < 0)
-		sdp_dbg_err("Error <%d> releasing IOCB <%d> memory <%ld>",
-			    result, iocb->key, iocb->addr);
+	sdp_iocb_release(iocb);
 	/*
 	 * unlock now, after aio_complete the mm reference will be released.
 	 */
-	result = sdp_iocb_unlock(iocb);
-	if (result < 0)
-		sdp_dbg_err("Error <%d> unlocking IOCB <%d memory <%ld>>",
-			    result, iocb->key, iocb->addr);
+	sdp_iocb_unlock(iocb);
 	/*
 	 * callback to complete IOCB
 	 */
@@ -633,11 +617,11 @@ int sdp_iocb_destroy(struct sdpc_iocb *i
 	/*
 	 * release iocb registered memory
 	 */
-	(void)sdp_iocb_release(iocb);
+	sdp_iocb_release(iocb);
 	/*
 	 * unlock IOCB memory
 	 */
-	(void)sdp_iocb_unlock(iocb);
+	sdp_iocb_unlock(iocb);
 	/*
 	 * array dealloc
 	 */
@@ -870,7 +854,7 @@ int sdp_main_iocb_init(void)
 
 	return 0;
 error_iocb_c:
-	(void)sdp_mem_lock_cleanup();
+	sdp_mem_lock_cleanup();
 	return result;
 }
 
@@ -891,5 +875,5 @@ void sdp_main_iocb_cleanup(void)
 	/*
 	 * cleanup memory locking
 	 */
-	(void)sdp_mem_lock_cleanup();
+	sdp_mem_lock_cleanup();
 }
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_event.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_event.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_event.c	(working copy)
@@ -143,7 +143,7 @@ void sdp_cq_event_handler(struct ib_cq *
 	if (!conn) {
 		sdp_dbg_warn(conn, "Unknown connection <%d> for cq event",
 			     hashent);
-		goto done;
+		return;
 	}
 	/*
 	 * lock the bottom half of the socket. If the connection is in use,
@@ -190,8 +190,6 @@ void sdp_cq_event_handler(struct ib_cq *
 unlock:
 	SDP_CONN_UNLOCK_IRQ(conn, flags);
 	sdp_conn_put(conn);
-done:
-	return;
 }
 
 /*
Index: linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_buff.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_buff.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/ulp/sdp/sdp_buff.c	(working copy)
@@ -724,7 +724,7 @@ int sdp_buff_pool_chain_put(struct sdpc_
 
 	main_pool->pool.size += count;
 
-	(void)sdp_buff_pool_release_check(main_pool);
+	sdp_buff_pool_release_check(main_pool);
 
 	spin_unlock_irqrestore(&main_pool->lock, flags);
 
Index: linux-2.6.11-openib/drivers/infiniband/include/ib_cm.h
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/include/ib_cm.h	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/include/ib_cm.h	(working copy)
@@ -309,7 +309,7 @@ struct ib_cm_id *ib_create_cm_id(ib_cm_h
  *
  * This call blocks until the connection identifier is destroyed.
  */
-int ib_destroy_cm_id(struct ib_cm_id *cm_id);
+void ib_destroy_cm_id(struct ib_cm_id *cm_id);
 
 /**
  * ib_cm_listen - Initiates listening on the specified service ID for
Index: linux-2.6.11-openib/drivers/infiniband/include/ib_fmr_pool.h
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/include/ib_fmr_pool.h	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/include/ib_fmr_pool.h	(working copy)
@@ -78,7 +78,7 @@ struct ib_pool_fmr {
 struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd             *pd,
 				       struct ib_fmr_pool_param *params);
 
-int ib_destroy_fmr_pool(struct ib_fmr_pool *pool);
+void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);
 
 int ib_flush_fmr_pool(struct ib_fmr_pool *pool);
 
Index: linux-2.6.11-openib/drivers/infiniband/core/cm.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/core/cm.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/core/cm.c	(working copy)
@@ -580,7 +580,7 @@ static void cm_reset_to_idle(struct cm_i
 	}
 }
 
-int ib_destroy_cm_id(struct ib_cm_id *cm_id)
+void ib_destroy_cm_id(struct ib_cm_id *cm_id)
 {
 	struct cm_id_private *cm_id_priv;
 	struct cm_work *work;
@@ -644,7 +644,6 @@ retest:
 	while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
 		cm_free_work(work);
 	kfree(cm_id_priv);
-	return 0;
 }
 EXPORT_SYMBOL(ib_destroy_cm_id);
 
Index: linux-2.6.11-openib/drivers/infiniband/core/fmr_pool.c
===================================================================
--- linux-2.6.11-openib/drivers/infiniband/core/fmr_pool.c	(revision 2334)
+++ linux-2.6.11-openib/drivers/infiniband/core/fmr_pool.c	(working copy)
@@ -329,7 +329,7 @@ EXPORT_SYMBOL(ib_create_fmr_pool);
  *
  * Destroy an FMR pool and free all associated resources.
  */
-int ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
+void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
 {
 	struct ib_pool_fmr *fmr;
 	struct ib_pool_fmr *tmp;
@@ -352,8 +352,6 @@ int ib_destroy_fmr_pool(struct ib_fmr_po
 
 	kfree(pool->cache_bucket);
 	kfree(pool);
-
-	return 0;
 }
 EXPORT_SYMBOL(ib_destroy_fmr_pool);
 




More information about the general mailing list