[openib-general] [PATCH][SDP][15/22] Whitespace cleanup in sdp_queue.c

Tom Duffy Tom.Duffy at Sun.COM
Fri Feb 18 16:46:56 PST 2005


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

Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_queue.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_queue.c	(revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_queue.c	(working copy)
@@ -48,26 +48,17 @@ static struct sdpc_desc *_sdp_desc_q_get
 
 	SDP_CHECK_NULL(table, NULL);
 
-	if (NULL == table->head) {
-
+	if (NULL == table->head)
 		return NULL;
-	}
-
-	if (fifo) {
 
+	if (fifo)
 		element = table->head;
-	}
-	else {
-
+	else
 		element = table->head->prev;
-	}
-
-	if (element->next == element && element->prev == element) {
 
+	if (element->next == element && element->prev == element)
 		table->head = NULL;
-	}
 	else {
-
 		element->next->prev = element->prev;
 		element->prev->next = element->next;
 
@@ -98,28 +89,22 @@ static __inline__ int _sdp_desc_q_put(st
 	SDP_CHECK_NULL(table, -EINVAL);
 	SDP_CHECK_NULL(element, -EINVAL);
 
-	if (NULL != element->table) {
-
+	if (NULL != element->table)
 		return -EINVAL;
-	}
 
 	if (NULL == table->head) {
-
 		element->next = element;
 		element->prev = element;
 		table->head = element;
-	}
-	else {
-
+	} else {
 		element->next = table->head;
 		element->prev = table->head->prev;
 
 		element->next->prev = element;
 		element->prev->next = element;
 
-		if (fifo) {
+		if (fifo)
 			table->head = element;
-		}
 	}
 
 	table->size++;
@@ -150,21 +135,16 @@ int sdp_desc_q_remove(struct sdpc_desc *
 
 	table = element->table;
 
-	if (element->next == element && element->prev == element) {
-
+	if (element->next == element && element->prev == element)
 		table->head = NULL;
-	}
 	else {
-
 		next = element->next;
 		prev = element->prev;
 		next->prev = prev;
 		prev->next = next;
 
-		if (table->head == element) {
-
+		if (table->head == element)
 			table->head = next;
-		}
 	}
 
 	table->size--;
@@ -193,13 +173,9 @@ struct sdpc_desc *sdp_desc_q_lookup(stru
 	SDP_CHECK_NULL(lookup, NULL);
 
 	for (counter = 0, element = table->head;
-	     counter < table->size; counter++, element = element->next) {
-
-		if (0 == lookup(element, arg)) {
-
+	     counter < table->size; counter++, element = element->next)
+		if (0 == lookup(element, arg))
 			return element;
-		}
-	}
 
 	return NULL;
 } /* sdp_desc_q_lookup */
@@ -255,14 +231,10 @@ int sdp_desc_q_type_head(struct sdpc_des
 {
 	SDP_CHECK_NULL(table, -EINVAL);
 
-	if (NULL == table->head) {
-
+	if (NULL == table->head)
 		return SDP_DESC_TYPE_NONE;
-	}
-	else {
-
+	else
 		return table->head->type;
-	}
 } /* sdp_desc_q_type_head */
 
 /*
@@ -273,14 +245,10 @@ struct sdpc_desc *sdp_desc_q_look_type_h
 {
 	SDP_CHECK_NULL(table, NULL);
 
-	if (NULL == table->head) {
-
+	if (NULL == table->head)
 		return NULL;
-	}
-	else {
-
+	else
 		return ((type == table->head->type) ? table->head : NULL);
-	}
 } /* sdp_desc_q_look_type_head */
 
 /*
@@ -291,15 +259,11 @@ struct sdpc_desc *sdp_desc_q_look_type_t
 {
 	SDP_CHECK_NULL(table, NULL);
 
-	if (NULL == table->head) {
-
+	if (NULL == table->head)
 		return NULL;
-	}
-	else {
-
+	else
 		return ((type == table->head->prev->type) ?
 			table->head->prev : NULL);
-	}
 } /* sdp_desc_q_look_type_tail */
 
 /*
@@ -341,14 +305,11 @@ int sdp_desc_q_clear(struct sdpc_desc_q 
 	/*
 	 * drain the table of any objects
 	 */
-	while (NULL != (element = sdp_desc_q_get_head(table))) {
-
+	while (NULL != (element = sdp_desc_q_get_head(table)))
 		if (NULL != element->release) {
-
 			result = element->release(element);
 			SDP_EXPECT(!(0 > result));
 		}
-	}
 
 	return 0;
 } /* sdp_desc_q_clear */




More information about the general mailing list