[ofa-general] ***SPAM*** [PATCH] iSER: Fix coding style issue according to checkpatch

Dotan Barak dotanba at gmail.com
Fri Oct 17 19:31:04 PDT 2008


Fixed several coding style issues in iSER, according to checkpatch.pl:
* Missing spaces
* Spaces instead of tabs
* Long lines
* Assignment in "if condition"

Signed-off-by: Dotan Barak <dotanba at gmail.com>

---

diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5a1cf25..1a5325f 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -78,7 +78,7 @@ static struct scsi_transport_template *iscsi_iser_scsi_transport;
 static unsigned int iscsi_max_lun = 512;
 module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO);
 
-int iser_debug_level = 0;
+int iser_debug_level;
 
 MODULE_DESCRIPTION("iSER (iSCSI Extensions for RDMA) Datamover "
 		   "v" DRV_VER " (" DRV_DATE ")");
@@ -331,7 +331,7 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
 	/* binds the iSER connection retrieved from the previously
 	 * connected ep_handle to the iSCSI layer connection. exchanges
 	 * connection pointers */
-	iser_err("binding iscsi conn %p to iser_conn %p\n",conn,ib_conn);
+	iser_err("binding iscsi conn %p to iser_conn %p\n", conn, ib_conn);
 	iser_conn = conn->dd_data;
 	ib_conn->iser_conn = iser_conn;
 	iser_conn->ib_conn  = ib_conn;
@@ -491,7 +491,8 @@ iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
 }
 
 static void
-iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
+iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn,
+			  struct iscsi_stats *stats)
 {
 	struct iscsi_conn *conn = cls_conn->dd_data;
 
@@ -583,24 +584,24 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
 		iscsi_suspend_tx(ib_conn->iser_conn->iscsi_conn);
 
 
-	iser_err("ib conn %p state %d\n",ib_conn, ib_conn->state);
+	iser_err("ib conn %p state %d\n", ib_conn, ib_conn->state);
 	iser_conn_terminate(ib_conn);
 }
 
 static struct scsi_host_template iscsi_iser_sht = {
-	.module                 = THIS_MODULE,
-	.name                   = "iSCSI Initiator over iSER, v." DRV_VER,
-	.queuecommand           = iscsi_queuecommand,
-	.change_queue_depth	= iscsi_change_queue_depth,
-	.sg_tablesize           = ISCSI_ISER_SG_TABLESIZE,
-	.max_sectors		= 1024,
-	.cmd_per_lun            = ISCSI_MAX_CMD_PER_LUN,
-	.eh_abort_handler       = iscsi_eh_abort,
-	.eh_device_reset_handler= iscsi_eh_device_reset,
-	.eh_host_reset_handler	= iscsi_eh_host_reset,
-	.use_clustering         = DISABLE_CLUSTERING,
-	.proc_name              = "iscsi_iser",
-	.this_id                = -1,
+	.module                  = THIS_MODULE,
+	.name                    = "iSCSI Initiator over iSER, v." DRV_VER,
+	.queuecommand            = iscsi_queuecommand,
+	.change_queue_depth	 = iscsi_change_queue_depth,
+	.sg_tablesize            = ISCSI_ISER_SG_TABLESIZE,
+	.max_sectors		 = 1024,
+	.cmd_per_lun             = ISCSI_MAX_CMD_PER_LUN,
+	.eh_abort_handler        = iscsi_eh_abort,
+	.eh_device_reset_handler = iscsi_eh_device_reset,
+	.eh_host_reset_handler	 = iscsi_eh_host_reset,
+	.use_clustering          = DISABLE_CLUSTERING,
+	.proc_name               = "iscsi_iser",
+	.this_id                 = -1
 };
 
 static struct iscsi_transport iscsi_iser_transport = {
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 81a8262..4c7e8da 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -163,7 +163,7 @@ struct iser_data_buf {
 	unsigned long      data_len;  /* total data len                       */
 	unsigned int       dma_nents; /* returned by dma_map_sg               */
 	char       	   *copy_buf; /* allocated copy buf for SGs unaligned *
-	                               * for rdma which are copied            */
+				       * for rdma which are copied            */
 	struct scatterlist sg_single; /* SG-ified clone of a non SG SC or     *
 				       * unaligned SG                         */
   };
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index cdd2831..16a59b7 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -91,7 +91,7 @@ static int iser_prepare_read_cmd(struct iscsi_task *task,
 		return -EINVAL;
 	}
 
-	err = iser_reg_rdma_mem(iser_task,ISER_DIR_IN);
+	err = iser_reg_rdma_mem(iser_task, ISER_DIR_IN);
 	if (err) {
 		iser_err("Failed to set up Data-IN RDMA\n");
 		return err;
@@ -141,7 +141,7 @@ iser_prepare_write_cmd(struct iscsi_task *task,
 		return -EINVAL;
 	}
 
-	err = iser_reg_rdma_mem(iser_task,ISER_DIR_OUT);
+	err = iser_reg_rdma_mem(iser_task, ISER_DIR_OUT);
 	if (err != 0) {
 		iser_err("Failed to register write cmd RDMA mem\n");
 		return err;
@@ -304,7 +304,7 @@ iser_check_xmit(struct iscsi_conn *conn, void *task)
 
 	if (atomic_read(&iser_conn->ib_conn->post_send_buf_count) ==
 	    ISER_QP_MAX_REQ_DTOS) {
-		iser_dbg("%ld can't xmit task %p\n",jiffies,task);
+		iser_dbg("%ld can't xmit task %p\n", jiffies, task);
 		return -ENOBUFS;
 	}
 	return 0;
@@ -328,7 +328,8 @@ int iser_send_command(struct iscsi_conn *conn,
 	struct scsi_cmnd *sc  =  task->sc;
 
 	if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
-		iser_err("Failed to send, conn: 0x%p is not up\n", iser_conn->ib_conn);
+		iser_err("Failed to send, conn: 0x%p is not up\n",
+			 iser_conn->ib_conn);
 		return -EPERM;
 	}
 	if (iser_check_xmit(conn, task))
@@ -362,7 +363,7 @@ int iser_send_command(struct iscsi_conn *conn,
 	if (hdr->flags & ISCSI_FLAG_CMD_WRITE) {
 		err = iser_prepare_write_cmd(task,
 					     task->imm_count,
-				             task->imm_count +
+					     task->imm_count +
 					     task->unsol_count,
 					     edtl);
 		if (err)
@@ -386,7 +387,7 @@ int iser_send_command(struct iscsi_conn *conn,
 
 send_command_error:
 	iser_dto_buffs_release(send_dto);
-	iser_err("conn %p failed task->itt %d err %d\n",conn, task->itt, err);
+	iser_err("conn %p failed task->itt %d err %d\n", conn, task->itt, err);
 	return err;
 }
 
@@ -407,7 +408,8 @@ int iser_send_data_out(struct iscsi_conn *conn,
 	int err = 0;
 
 	if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
-		iser_err("Failed to send, conn: 0x%p is not up\n", iser_conn->ib_conn);
+		iser_err("Failed to send, conn: 0x%p is not up\n",
+			 iser_conn->ib_conn);
 		return -EPERM;
 	}
 
@@ -419,7 +421,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
 	buf_offset   = ntohl(hdr->offset);
 
 	iser_dbg("%s itt %d dseg_len %d offset %d\n",
-		 __func__,(int)itt,(int)data_seg_len,(int)buf_offset);
+		 __func__, (int)itt, (int)data_seg_len, (int)buf_offset);
 
 	tx_desc = kmem_cache_alloc(ig.desc_cache, GFP_NOIO);
 	if (tx_desc == NULL) {
@@ -463,7 +465,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
 send_data_out_error:
 	iser_dto_buffs_release(send_dto);
 	kmem_cache_free(ig.desc_cache, tx_desc);
-	iser_err("conn %p failed err %d\n",conn, err);
+	iser_err("conn %p failed err %d\n", conn, err);
 	return err;
 }
 
@@ -480,7 +482,8 @@ int iser_send_control(struct iscsi_conn *conn,
 	struct iser_device *device;
 
 	if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
-		iser_err("Failed to send, conn: 0x%p is not up\n", iser_conn->ib_conn);
+		iser_err("Failed to send, conn: 0x%p is not up\n",
+			 iser_conn->ib_conn);
 		return -EPERM;
 	}
 
@@ -524,7 +527,7 @@ int iser_send_control(struct iscsi_conn *conn,
 
 send_control_error:
 	iser_dto_buffs_release(send_dto);
-	iser_err("conn %p failed err %d\n",conn, err);
+	iser_err("conn %p failed err %d\n", conn, err);
 	return err;
 }
 
@@ -545,7 +548,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
 
 	hdr = &rx_desc->iscsi_header;
 
-	iser_dbg("op 0x%x itt 0x%x\n", hdr->opcode,hdr->itt);
+	iser_dbg("op 0x%x itt 0x%x\n", hdr->opcode, hdr->itt);
 
 	if (dto_xfer_len > ISER_TOTAL_HEADERS_LEN) { /* we have data */
 		rx_data_len = dto_xfer_len - ISER_TOTAL_HEADERS_LEN;
@@ -568,7 +571,7 @@ void iser_rcv_completion(struct iser_desc *rx_desc,
 				 conn->iscsi_conn, opcode, hdr->itt);
 		else {
 			iser_task = task->dd_data;
-			iser_dbg("itt %d task %p\n",hdr->itt, task);
+			iser_dbg("itt %d task %p\n", hdr->itt, task);
 			iser_task->status = ISER_TASK_STATUS_COMPLETED;
 			iser_task_rdma_finalize(iser_task);
 			iscsi_put_task(task);
@@ -611,7 +614,7 @@ void iser_snd_completion(struct iser_desc *tx_desc)
 	atomic_dec(&ib_conn->post_send_buf_count);
 
 	if (resume_tx) {
-		iser_dbg("%ld resuming tx\n",jiffies);
+		iser_dbg("%ld resuming tx\n", jiffies);
 		scsi_queue_work(conn->session->host, &conn->xmitwork);
 	}
 
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index b9453d0..1918312 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -116,7 +116,7 @@ static int iser_start_rdma_unaligned_sg(struct iscsi_iser_task *iser_task,
 
 	if (mem == NULL) {
 		iser_err("Failed to allocate mem size %d %d for copying sglist\n",
-			 data->size,(int)cmd_data_len);
+			 data->size, (int)cmd_data_len);
 		return -ENOMEM;
 	}
 
@@ -272,7 +272,8 @@ static int iser_sg_to_page_vec(struct iser_data_buf *data,
 
 	}
 	page_vec->data_size = total_sz;
-	iser_dbg("page_vec->data_size:%d cur_page %d\n", page_vec->data_size,cur_page);
+	iser_dbg("page_vec->data_size:%d cur_page %d\n",
+		 page_vec->data_size, cur_page);
 	return cur_page;
 }
 
@@ -350,7 +351,7 @@ static void iser_dump_page_vec(struct iser_page_vec *page_vec)
 	iser_err("page vec length %d data size %d\n",
 		 page_vec->length, page_vec->data_size);
 	for (i = 0; i < page_vec->length; i++)
-		iser_err("%d %lx\n",i,(unsigned long)page_vec->pages[i]);
+		iser_err("%d %lx\n", i, (unsigned long)page_vec->pages[i]);
 }
 
 static void iser_page_vec_build(struct iser_data_buf *data,
@@ -364,7 +365,7 @@ static void iser_page_vec_build(struct iser_data_buf *data,
 
 	iser_dbg("Translating sg sz: %d\n", data->dma_nents);
 	page_vec_len = iser_sg_to_page_vec(data, page_vec, ibdev);
-	iser_dbg("sg len %d page_vec_len %d\n", data->dma_nents,page_vec_len);
+	iser_dbg("sg len %d page_vec_len %d\n", data->dma_nents, page_vec_len);
 
 	page_vec->length = page_vec_len;
 
@@ -478,7 +479,7 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *iser_task,
 			iser_err("page_vec: data_size = 0x%x, length = %d, offset = 0x%x\n",
 				 ib_conn->page_vec->data_size, ib_conn->page_vec->length,
 				 ib_conn->page_vec->offset);
-			for (i=0 ; i<ib_conn->page_vec->length ; i++)
+			for (i = 0; i < ib_conn->page_vec->length; i++)
 				iser_err("page_vec[%d] = 0x%llx\n", i,
 					 (unsigned long long) ib_conn->page_vec->pages[i]);
 			return err;
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 26ff621..3b8569d 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -51,7 +51,7 @@ static void iser_cq_event_callback(struct ib_event *cause, void *context)
 
 static void iser_qp_event_callback(struct ib_event *cause, void *context)
 {
-	iser_err("got qp event %d\n",cause->event);
+	iser_err("got qp event %d\n", cause->event);
 }
 
 /**
@@ -137,7 +137,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
 	device = ib_conn->device;
 
 	ib_conn->page_vec = kmalloc(sizeof(struct iser_page_vec) +
-				    (sizeof(u64) * (ISCSI_ISER_SG_TABLESIZE +1)),
+				    (sizeof(u64) * (ISCSI_ISER_SG_TABLESIZE + 1)),
 				    GFP_KERNEL);
 	if (!ib_conn->page_vec) {
 		ret = -ENOMEM;
@@ -269,7 +269,7 @@ static void iser_device_try_release(struct iser_device *device)
 {
 	mutex_lock(&ig.device_list_mutex);
 	device->refcount--;
-	iser_err("device %p refcount %d\n",device,device->refcount);
+	iser_err("device %p refcount %d\n", device, device->refcount);
 	if (!device->refcount) {
 		iser_free_device_ib_res(device);
 		list_del(&device->ig_list);
@@ -296,7 +296,8 @@ static int iser_conn_state_comp_exch(struct iser_conn *ib_conn,
 	int ret;
 
 	spin_lock_bh(&ib_conn->lock);
-	if ((ret = (ib_conn->state == comp)))
+	ret = (ib_conn->state == comp);
+	if (ret)
 		ib_conn->state = exch;
 	spin_unlock_bh(&ib_conn->lock);
 	return ret;
@@ -352,7 +353,7 @@ void iser_conn_terminate(struct iser_conn *ib_conn)
 	err = rdma_disconnect(ib_conn->cma_id);
 	if (err)
 		iser_err("Failed to disconnect, conn: 0x%p err %d\n",
-			 ib_conn,err);
+			 ib_conn, err);
 
 	wait_event_interruptible(ib_conn->wait,
 				 ib_conn->state == ISER_CONN_DOWN);
@@ -456,11 +457,13 @@ static void iser_disconnected_handler(struct rdma_cm_id *cma_id)
 	}
 }
 
-static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
+static int iser_cma_handler(struct rdma_cm_id *cma_id,
+			    struct rdma_cm_event *event)
 {
 	int ret = 0;
 
-	iser_err("event %d conn %p id %p\n",event->event,cma_id->context,cma_id);
+	iser_err("event %d conn %p id %p\n", event->event, cma_id->context,
+		 cma_id);
 
 	switch (event->event) {
 	case RDMA_CM_EVENT_ADDR_RESOLVED:
@@ -515,7 +518,7 @@ int iser_connect(struct iser_conn   *ib_conn,
 	struct sockaddr *src, *dst;
 	int err = 0;
 
-	sprintf(ib_conn->name,"%d.%d.%d.%d:%d",
+	sprintf(ib_conn->name, "%d.%d.%d.%d:%d",
 		NIPQUAD(dst_addr->sin_addr.s_addr), dst_addr->sin_port);
 
 	/* the device is known only --after-- address resolution */
@@ -623,7 +626,7 @@ void iser_unreg_mem(struct iser_mem_reg *reg)
 {
 	int ret;
 
-	iser_dbg("PHYSICAL Mem.Unregister mem_h %p\n",reg->mem_h);
+	iser_dbg("PHYSICAL Mem.Unregister mem_h %p\n", reg->mem_h);
 
 	ret = ib_fmr_pool_unmap((struct ib_pool_fmr *)reg->mem_h);
 	if (ret)
@@ -635,7 +638,8 @@ void iser_unreg_mem(struct iser_mem_reg *reg)
 /**
  * iser_dto_to_iov - builds IOV from a dto descriptor
  */
-static void iser_dto_to_iov(struct iser_dto *dto, struct ib_sge *iov, int iov_len)
+static void iser_dto_to_iov(struct iser_dto *dto, struct ib_sge *iov,
+			    int iov_len)
 {
 	int		     i;
 	struct ib_sge	     *sge;
@@ -799,7 +803,8 @@ static void iser_cq_tasklet_fn(unsigned long data)
 			} else /* type == ISCSI_TX_CONTROL/SCSI_CMD/DOUT */
 				iser_snd_completion(desc);
 		} else {
-			iser_err("comp w. error op %d status %d\n",desc->type,wc.status);
+			iser_err("comp w. error op %d status %d\n",
+				 desc->type, wc.status);
 			iser_handle_comp_error(desc);
 		}
 	}



More information about the general mailing list