[openib-general] [PATCH][SDP][6/22] Whitespace cleanup in sdp_event.c

Tom Duffy Tom.Duffy at Sun.COM
Fri Feb 18 16:45:24 PST 2005


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

Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_event.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_event.c	(revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_event.c	(working copy)
@@ -68,19 +68,15 @@ int sdp_cq_event_locked(struct ib_wc *co
 	 */
 	switch (comp->opcode) {
 	case IB_WC_RECV:
-
 		result = sdp_event_recv(conn, comp);
 		break;
 	case IB_WC_SEND:
-
 		result = sdp_event_send(conn, comp);
 		break;
 	case IB_WC_RDMA_READ:
-
 		result = sdp_event_read(conn, comp);
 		break;
 	case IB_WC_RDMA_WRITE:
-
 		result = sdp_event_write(conn, comp);
 		break;
 	default:
@@ -94,12 +90,10 @@ int sdp_cq_event_locked(struct ib_wc *co
 		case IB_WC_WR_FLUSH_ERR:
 			break;
 		case IB_WC_SUCCESS:
-
 			sdp_warn("unknown IB event. <%d>", comp->opcode);
 			result = -ERANGE;
 			break;
 		default:
-
 			sdp_warn("Unhandled status <%d> unknown event <%d>",
 				 comp->status, comp->opcode);
 			result = -EIO;
@@ -112,7 +106,6 @@ int sdp_cq_event_locked(struct ib_wc *co
 	 * release socket before error processing.
 	 */
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "ABORT on error <%d> event <%u:%llu:%u:%u>",
 			     result,
 			     comp->status,
@@ -125,10 +118,8 @@ int sdp_cq_event_locked(struct ib_wc *co
 		SDP_CONN_ST_SET(conn, SDP_CONN_ST_ERROR_CQ);
 
 		result = sdp_wall_abort(conn);
-		if (0 > result) {
-
+		if (0 > result)
 			sdp_dbg_warn(conn, "Error <%d> during abort", result);
-		}
 
 		return -EFAULT;
 	}
@@ -153,7 +144,6 @@ void sdp_cq_event_handler(struct ib_cq *
 	 */
 	conn = sdp_conn_table_lookup(hashent);
 	if (NULL == conn) {
-
 		sdp_dbg_warn(conn, "Unknown connection <%d> for cq event",
 			     hashent);
 		goto done;
@@ -176,26 +166,22 @@ void sdp_cq_event_handler(struct ib_cq *
 		 */
 		if (SDP_CONN_ST_REP_SENT == conn->state ||
 		    SDP_CONN_ST_RTU_SENT == conn->state) {
-
 			result = ib_cm_establish(conn->cm_id);
 			SDP_EXPECT(!(0 > result));
 		}
-		else {
-
+		else
 			sdp_dbg_warn(conn, "Unexpected locked state.");
-		}
 
 		conn->flags |= SDP_CONN_F_MASK_EVENT;
 		goto unlock;
 	}
 
-	if (0 == conn->lock.users) {
+	if (0 == conn->lock.users)
 		/*
 		 * dispatch CQ completions.
 		 */
 		(void)sdp_conn_cq_drain(cq, conn);
-	}
-	else {
+	else
 		/*
 		 * Mark the event which was received, for the unlock code to
 		 * process at a later time.
@@ -203,7 +189,6 @@ void sdp_cq_event_handler(struct ib_cq *
 		conn->flags |= ((cq == conn->recv_cq) ?
 				SDP_CONN_F_RECV_CQ_PEND :
 				SDP_CONN_F_SEND_CQ_PEND);
-	}
 
 unlock:
 	SDP_CONN_UNLOCK_BH(conn);
@@ -226,9 +211,8 @@ static int _sdp_cm_idle(struct ib_cm_id 
 	int result = 0;
 	int expect;
 
-	if (NULL == conn) {
+	if (NULL == conn)
 		return -EINVAL;
-	}
 	/*
 	 * IDLE should only be called after some other action on the comm_id,
 	 * which means the callback argument will be a SDP conn, since the
@@ -253,10 +237,8 @@ static int _sdp_cm_idle(struct ib_cm_id 
 		 * fall through
 		 */
 	case SDP_CONN_ST_REQ_SENT:	/* active open, Hello msg sent */
-
 		result = sdp_wall_recv_reject(conn, ECONNREFUSED);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> receiving CM reject.",
 				     result);
 			goto error;
@@ -264,7 +246,6 @@ static int _sdp_cm_idle(struct ib_cm_id 
 
 		break;
 	case SDP_CONN_ST_REP_SENT:	/* passive open, Hello ack msg sent */
-
 		result = sdp_wall_recv_failed(conn, ECONNREFUSED);
 		if (0 > result) {
 
@@ -286,7 +267,6 @@ static int _sdp_cm_idle(struct ib_cm_id 
 		break;
 	case SDP_CONN_ST_TIME_WAIT_1:
 	case SDP_CONN_ST_ESTABLISHED:
-
 		sdp_dbg_warn(conn, "Unexpected connection state");
 		/*
 		 * fall through
@@ -301,7 +281,6 @@ static int _sdp_cm_idle(struct ib_cm_id 
 
 		break;
 	default:
-
 		sdp_warn("Unknown conn state. conn <%d> state <%04x:%04x>",
 			 conn->hashent, conn->istate, conn->state);
 		result = -EINVAL;
@@ -332,9 +311,8 @@ static int _sdp_cm_established(struct ib
 	int expect;
 	struct sdpc_buff *buff;
 
-	if (NULL == conn) {
+	if (NULL == conn)
 		return -EINVAL;
-	}
 
 	sdp_dbg_ctrl(conn, "CM ESTABLISHED. commID <%08x>", cm_id->local_id);
 	/*
@@ -345,24 +323,17 @@ static int _sdp_cm_established(struct ib
 	 * check state
 	 */
 	switch (conn->state) {
-
 	case SDP_CONN_ST_REP_SENT:	/* passive open, Hello ack msg sent */
-
 		buff = sdp_buff_q_get_head(&conn->send_post);
-		if (NULL == buff) {
-
+		if (NULL == buff)
 			sdp_dbg_warn(conn, "hello ack missing in send pool");
-		}
-		else {
-
+		else
 			(void)sdp_buff_pool_put(buff);
-		}
 
 		SDP_CONN_ST_SET(conn, SDP_CONN_ST_ESTABLISHED);
 
 		result = sdp_wall_recv_confirm(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> confirming conn state",
 				     result);
 			/*
@@ -374,7 +345,6 @@ static int _sdp_cm_established(struct ib
 
 		result = sdp_send_flush(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> flushing send queue.",
 				     result);
 			goto error;
@@ -382,7 +352,6 @@ static int _sdp_cm_established(struct ib
 
 		result = sdp_recv_flush(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> flushing receives.",
 				     result);
 			goto error;
@@ -402,10 +371,8 @@ static int _sdp_cm_established(struct ib
 	case SDP_CONN_ST_DIS_PEND_R:
 		/* active open, and active close, confirm */
 	case SDP_CONN_ST_DIS_PEND_2:
-
 		result = sdp_send_flush(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> flushing receives.",
 				     result);
 			goto error;
@@ -419,11 +386,9 @@ static int _sdp_cm_established(struct ib
 		 * existing state correctly.
 		 */
 		result = sdp_cm_disconnect(conn);
-		if (0 > result) {
-
+		if (0 > result)
 			sdp_dbg_warn(conn, "Error <%d> posting CM disconnect",
 				     result);
-		}
 
 		break;
 	default:
@@ -454,10 +419,8 @@ static int _sdp_cm_timewait(struct ib_cm
 	int result = 0;
 	int expect;
 
-	if (NULL == conn) {
-
+	if (NULL == conn)
 		return -EINVAL;
-	}
 
 	sdp_dbg_ctrl(conn, "CM TIME WAIT. commID <%08x> event <%d>",
 		     cm_id->local_id, event->event);
@@ -507,14 +470,12 @@ static int _sdp_cm_timewait(struct ib_cm
 
 		result = sdp_wall_abort(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> during abort", result);
 			goto error;
 		}
 
 		break;
 	default:
-
 		sdp_warn("Unexpected conn state. conn <%d> state <%04x:%04x>",
 			 conn->hashent, conn->istate, conn->state);
 		result = -EINVAL;
@@ -551,44 +512,32 @@ int sdp_cm_event_handler(struct ib_cm_id
 	 * lookup the connection, on a REQ_RECV the sk will be empty.
 	 */
 	conn = sdp_conn_table_lookup(hashent);
-	if (NULL != conn) {
-
+	if (NULL != conn)
 		SDP_CONN_LOCK(conn);
-	}
-	else {
-
-		if (IB_CM_REQ_RCVD != cm_id->state) {
-
+	else
+		if (IB_CM_REQ_RCVD != cm_id->state)
 			sdp_dbg_warn(NULL, 
 				     "No conn <%d> CM state <%d> event <%d>",
 				     hashent, cm_id->state, event->event);
-		}
-	}
 
 	switch (cm_id->state) {
 	case IB_CM_REQ_RCVD:
-
 		result = sdp_cm_req_handler(cm_id, event);
 		break;
 	case IB_CM_REP_RCVD:
-
 		result = sdp_cm_rep_handler(cm_id, event, conn);
 		break;
 	case IB_CM_IDLE:
-
 		result = _sdp_cm_idle(cm_id, event, conn);
 		break;
 	case IB_CM_ESTABLISHED:
-
 		result = _sdp_cm_established(cm_id, event, conn);
 		break;
 	case IB_CM_DREQ_RCVD:
 	case IB_CM_TIMEWAIT:
-
 		result = _sdp_cm_timewait(cm_id, event, conn);
 		break;
 	default:
-
 		sdp_dbg_warn(conn, "Unexpected CM state <%d>", cm_id->state);
 		result = -EINVAL;
 	}
@@ -596,9 +545,7 @@ int sdp_cm_event_handler(struct ib_cm_id
 	 * if a socket was found, release the lock, and put the reference.
 	 */
 	if (NULL != conn) {
-
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, 
 				     "CM state <%d> event <%d> error <%d>",
 				     cm_id->state, event->event, result);




More information about the general mailing list