[PATCH] staging: hv: trivial logging corrections

Joe Perches joe at perches.com
Tue Oct 4 20:35:00 UTC 2011


Corrections to format strings and logging code alignment.

DPRINT_<LEVEL> formats do not use newline terminations.
dev_<level> formats use newline terminations.
Coalesce format strings.
Align arguments as appropriate.
Miscellaneous trailing period deletions for consistency.
Miscellaneous typo "satisy" to "satisfy" correction.

Signed-off-by: Joe Perches <joe at perches.com>
---

I believe this should still apply after moving some files
out of staging.

 drivers/staging/hv/hv_mouse.c   |    7 +-
 drivers/staging/hv/netvsc.c     |  125 ++++++++++++++++++++------------------
 drivers/staging/hv/netvsc_drv.c |   15 ++---
 drivers/staging/hv/storvsc.c    |    5 +-
 4 files changed, 79 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index d957fc2..4d930ec 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -899,13 +899,12 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len)
 			input_device_ctx->connected = 1;
 
 			DPRINT_INFO(INPUTVSC_DRV,
-				     "HID device claimed by input\n");
+				    "HID device claimed by input");
 		}
 
 		if (!hid_dev->claimed) {
 			DPRINT_ERR(INPUTVSC_DRV,
-				    "HID device not claimed by "
-				    "input or hiddev\n");
+				   "HID device not claimed by input or hiddev");
 		}
 
 		input_device_ctx->hid_device = hid_dev;
@@ -929,7 +928,7 @@ static int __init mousevsc_init(void)
 {
 	struct hv_driver *drv = &mousevsc_drv;
 
-	DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");
+	DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing");
 
 	memcpy(&drv->dev_type, &mouse_guid,
 	       sizeof(struct hv_guid));
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index dc5e5c4..4ff0cde 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -18,6 +18,7 @@
  *   Haiyang Zhang <haiyangz at microsoft.com>
  *   Hank Janssen  <hjanssen at microsoft.com>
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
@@ -170,8 +171,8 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
 		 * have a leak rather than continue and a bugchk
 		 */
 		if (ret != 0) {
-			dev_err(&net_device->dev->device, "unable to send "
-				"revoke receive buffer to netvsp");
+			dev_err(&net_device->dev->device,
+				"unable to send revoke receive buffer to netvsp\n");
 			return -1;
 		}
 	}
@@ -186,7 +187,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
 		 */
 		if (ret != 0) {
 			dev_err(&net_device->dev->device,
-				   "unable to teardown receive buffer's gpadl");
+				"unable to teardown receive buffer's gpadl\n");
 			return -1;
 		}
 		net_device->recv_buf_gpadl_handle = 0;
@@ -217,8 +218,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)
 
 	net_device = get_outbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "unable to get net device..."
-			   "device being destroyed?");
+		dev_err(&device->device,
+			"unable to get net device...device being destroyed?\n");
 		return -1;
 	}
 
@@ -226,8 +227,9 @@ static int netvsc_init_recv_buf(struct hv_device *device)
 		(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
 				get_order(net_device->recv_buf_size));
 	if (!net_device->recv_buf) {
-		dev_err(&device->device, "unable to allocate receive "
-			"buffer of size %d", net_device->recv_buf_size);
+		dev_err(&device->device,
+			"unable to allocate receive buffer of size %d\n",
+			net_device->recv_buf_size);
 		ret = -1;
 		goto cleanup;
 	}
@@ -242,7 +244,7 @@ static int netvsc_init_recv_buf(struct hv_device *device)
 				    &net_device->recv_buf_gpadl_handle);
 	if (ret != 0) {
 		dev_err(&device->device,
-			"unable to establish receive buffer's gpadl");
+			"unable to establish receive buffer's gpadl\n");
 		goto cleanup;
 	}
 
@@ -266,7 +268,7 @@ static int netvsc_init_recv_buf(struct hv_device *device)
 			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 	if (ret != 0) {
 		dev_err(&device->device,
-			"unable to send receive buffer's gpadl to netvsp");
+			"unable to send receive buffer's gpadl to netvsp\n");
 		goto cleanup;
 	}
 
@@ -277,10 +279,10 @@ static int netvsc_init_recv_buf(struct hv_device *device)
 	/* Check the response */
 	if (init_packet->msg.v1_msg.
 	    send_recv_buf_complete.status != NVSP_STAT_SUCCESS) {
-		dev_err(&device->device, "Unable to complete receive buffer "
-			   "initialzation with NetVsp - status %d",
-			   init_packet->msg.v1_msg.
-			   send_recv_buf_complete.status);
+		dev_err(&device->device,
+			"Unable to complete receive buffer initialzation with NetVsp - status %d\n",
+			init_packet->msg.v1_msg.
+			send_recv_buf_complete.status);
 		ret = -1;
 		goto cleanup;
 	}
@@ -333,8 +335,8 @@ static int netvsc_connect_vsp(struct hv_device *device)
 
 	net_device = get_outbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "unable to get net device..."
-			   "device being destroyed?");
+		dev_err(&device->device,
+			"unable to get net device...device being destroyed?\n");
 		return -1;
 	}
 
@@ -422,14 +424,14 @@ int netvsc_device_remove(struct hv_device *device)
 	/* Stop outbound traffic ie sends and receives completions */
 	net_device = release_outbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "No net device present!!");
+		dev_err(&device->device, "No net device present!!\n");
 		return -1;
 	}
 
 	/* Wait for all send completions */
 	while (atomic_read(&net_device->num_outstanding_sends)) {
 		dev_err(&device->device,
-			"waiting for %d requests to complete...",
+			"waiting for %d requests to complete...\n",
 			atomic_read(&net_device->num_outstanding_sends));
 		udelay(100);
 	}
@@ -440,7 +442,7 @@ int netvsc_device_remove(struct hv_device *device)
 	net_device = release_inbound_net_device(device);
 
 	/* At this point, no one should be accessing netDevice except in here */
-	dev_notice(&device->device, "net device safe to remove");
+	dev_notice(&device->device, "net device safe to remove\n");
 
 	/* Now, we can close the channel safely */
 	vmbus_close(device->channel);
@@ -465,8 +467,8 @@ static void netvsc_send_completion(struct hv_device *device,
 
 	net_device = get_inbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "unable to get net device..."
-			   "device being destroyed?");
+		dev_err(&device->device,
+			"unable to get net device...device being destroyed?\n");
 		return;
 	}
 
@@ -494,8 +496,9 @@ static void netvsc_send_completion(struct hv_device *device,
 
 		atomic_dec(&net_device->num_outstanding_sends);
 	} else {
-		dev_err(&device->device, "Unknown send completion packet type- "
-			   "%d received!!", nvsp_packet->hdr.msg_type);
+		dev_err(&device->device,
+			"Unknown send completion packet type - %d received!!\n",
+			nvsp_packet->hdr.msg_type);
 	}
 
 	put_net_device(device);
@@ -511,8 +514,9 @@ int netvsc_send(struct hv_device *device,
 
 	net_device = get_outbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "net device (%p) shutting down..."
-			   "ignoring outbound packets", net_device);
+		dev_err(&device->device,
+			"net device (%p) shutting down...ignoring outbound packets\n",
+			net_device);
 		return -2;
 	}
 
@@ -547,8 +551,8 @@ int netvsc_send(struct hv_device *device,
 	}
 
 	if (ret != 0)
-		dev_err(&device->device, "Unable to send packet %p ret %d",
-			   packet, ret);
+		dev_err(&device->device, "Unable to send packet %p ret %d\n",
+			packet, ret);
 
 	atomic_inc(&net_device->num_outstanding_sends);
 	put_net_device(device);
@@ -580,20 +584,22 @@ retry_send_cmplt:
 	} else if (ret == -1) {
 		/* no more room...wait a bit and attempt to retry 3 times */
 		retries++;
-		dev_err(&device->device, "unable to send receive completion pkt"
-			" (tid %llx)...retrying %d", transaction_id, retries);
+		dev_err(&device->device,
+			"unable to send receive completion pkt (tid %llx)...retrying %d\n",
+			transaction_id, retries);
 
 		if (retries < 4) {
 			udelay(100);
 			goto retry_send_cmplt;
 		} else {
-			dev_err(&device->device, "unable to send receive "
-				"completion pkt (tid %llx)...give up retrying",
+			dev_err(&device->device,
+				"unable to send receive completion pkt (tid %llx)...give up retrying\n",
 				transaction_id);
 		}
 	} else {
-		dev_err(&device->device, "unable to send receive "
-			"completion pkt - %llx", transaction_id);
+		dev_err(&device->device,
+			"unable to send receive completion pkt - %llx\n",
+			transaction_id);
 	}
 }
 
@@ -614,8 +620,8 @@ static void netvsc_receive_completion(void *context)
 	 */
 	net_device = get_inbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "unable to get net device..."
-			   "device being destroyed?");
+		dev_err(&device->device,
+			"unable to get net device...device being destroyed?\n");
 		return;
 	}
 
@@ -666,8 +672,8 @@ static void netvsc_receive(struct hv_device *device,
 
 	net_device = get_inbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "unable to get net device..."
-			   "device being destroyed?");
+		dev_err(&device->device,
+			"unable to get net device...device being destroyed?\n");
 		return;
 	}
 
@@ -676,8 +682,8 @@ static void netvsc_receive(struct hv_device *device,
 	 * packet
 	 */
 	if (packet->type != VM_PKT_DATA_USING_XFER_PAGES) {
-		dev_err(&device->device, "Unknown packet type received - %d",
-			   packet->type);
+		dev_err(&device->device, "Unknown packet type received - %d\n",
+			packet->type);
 		put_net_device(device);
 		return;
 	}
@@ -688,8 +694,8 @@ static void netvsc_receive(struct hv_device *device,
 	/* Make sure this is a valid nvsp packet */
 	if (nvsp_packet->hdr.msg_type !=
 	    NVSP_MSG1_TYPE_SEND_RNDIS_PKT) {
-		dev_err(&device->device, "Unknown nvsp packet type received-"
-			" %d", nvsp_packet->hdr.msg_type);
+		dev_err(&device->device, "Unknown nvsp packet type received - %d\n",
+			nvsp_packet->hdr.msg_type);
 		put_net_device(device);
 		return;
 	}
@@ -697,9 +703,10 @@ static void netvsc_receive(struct hv_device *device,
 	vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;
 
 	if (vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID) {
-		dev_err(&device->device, "Invalid xfer page set id - "
-			   "expecting %x got %x", NETVSC_RECEIVE_BUFFER_ID,
-			   vmxferpage_packet->xfer_pageset_id);
+		dev_err(&device->device,
+			"Invalid xfer page set id - expecting %x got %x\n",
+			NETVSC_RECEIVE_BUFFER_ID,
+			vmxferpage_packet->xfer_pageset_id);
 		put_net_device(device);
 		return;
 	}
@@ -724,8 +731,8 @@ static void netvsc_receive(struct hv_device *device,
 	 * some of the xfer page packet ranges...
 	 */
 	if (count < 2) {
-		dev_err(&device->device, "Got only %d netvsc pkt...needed "
-			"%d pkts. Dropping this xfer page packet completely!",
+		dev_err(&device->device,
+			"Got only %d netvsc pkt...needed %d pkts. Dropping this xfer page packet completely!\n",
 			count, vmxferpage_packet->range_cnt + 1);
 
 		/* Return it to the freelist */
@@ -752,8 +759,8 @@ static void netvsc_receive(struct hv_device *device,
 	xferpage_packet->count = count - 1;
 
 	if (xferpage_packet->count != vmxferpage_packet->range_cnt) {
-		dev_err(&device->device, "Needed %d netvsc pkts to satisy "
-			"this xfer page...got %d",
+		dev_err(&device->device,
+			"Needed %d netvsc pkts to satisfy this xfer page...got %d\n",
 			vmxferpage_packet->range_cnt, xferpage_packet->count);
 	}
 
@@ -851,8 +858,9 @@ static void netvsc_channel_cb(void *context)
 
 	net_device = get_inbound_net_device(device);
 	if (!net_device) {
-		dev_err(&device->device, "net device (%p) shutting down..."
-			   "ignoring inbound packets", net_device);
+		dev_err(&device->device,
+			"net device (%p) shutting down...ignoring inbound packets\n",
+			net_device);
 		goto out;
 	}
 
@@ -873,10 +881,9 @@ static void netvsc_channel_cb(void *context)
 
 				default:
 					dev_err(&device->device,
-						   "unhandled packet type %d, "
-						   "tid %llx len %d\n",
-						   desc->type, request_id,
-						   bytes_recvd);
+						"unhandled packet type %d, tid %llx len %d\n",
+						desc->type,
+						request_id, bytes_recvd);
 					break;
 				}
 
@@ -902,8 +909,8 @@ static void netvsc_channel_cb(void *context)
 			if (buffer == NULL) {
 				/* Try again next time around */
 				dev_err(&device->device,
-					   "unable to allocate buffer of size "
-					   "(%d)!!", bytes_recvd);
+					"unable to allocate buffer of size (%d)!!\n",
+					bytes_recvd);
 				break;
 			}
 
@@ -960,19 +967,19 @@ int netvsc_device_add(struct hv_device *device, void *additional_info)
 			 netvsc_channel_cb, device);
 
 	if (ret != 0) {
-		dev_err(&device->device, "unable to open channel: %d", ret);
+		dev_err(&device->device, "unable to open channel: %d\n", ret);
 		ret = -1;
 		goto cleanup;
 	}
 
 	/* Channel is opened */
-	pr_info("hv_netvsc channel opened successfully");
+	pr_info("hv_netvsc channel opened successfully\n");
 
 	/* Connect with the NetVsp */
 	ret = netvsc_connect_vsp(device);
 	if (ret != 0) {
-		dev_err(&device->device,
-			"unable to connect to NetVSP - %d", ret);
+		dev_err(&device->device, "unable to connect to NetVSP - %d\n",
+			ret);
 		ret = -1;
 		goto close;
 	}
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 61989f0..821089d 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -18,6 +18,7 @@
  *   Haiyang Zhang <haiyangz at microsoft.com>
  *   Hank Janssen  <hjanssen at microsoft.com>
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/init.h>
@@ -76,14 +77,14 @@ static int netvsc_open(struct net_device *net)
 		/* Open up the device */
 		ret = rndis_filter_open(device_obj);
 		if (ret != 0) {
-			netdev_err(net, "unable to open device (ret %d).\n",
+			netdev_err(net, "unable to open device (ret %d)\n",
 				   ret);
 			return ret;
 		}
 
 		netif_start_queue(net);
 	} else {
-		netdev_err(net, "unable to open device...link is down.\n");
+		netdev_err(net, "unable to open device...link is down\n");
 	}
 
 	return ret;
@@ -99,7 +100,7 @@ static int netvsc_close(struct net_device *net)
 
 	ret = rndis_filter_close(device_obj);
 	if (ret != 0)
-		netdev_err(net, "unable to close device (ret %d).\n", ret);
+		netdev_err(net, "unable to close device (ret %d)\n", ret);
 
 	return ret;
 }
@@ -209,8 +210,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
 	struct net_device_context *ndev_ctx;
 
 	if (!net) {
-		netdev_err(net, "got link status but net device "
-				"not initialized yet\n");
+		netdev_err(net, "got link status but net device not initialized yet\n");
 		return;
 	}
 
@@ -240,8 +240,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
 	unsigned long flags;
 
 	if (!net) {
-		netdev_err(net, "got receive callback but net device"
-			" not initialized yet\n");
+		netdev_err(net, "got receive callback but net device not initialized yet\n");
 		return 0;
 	}
 
@@ -444,7 +443,7 @@ static int __init netvsc_drv_init(void)
 	struct hv_driver *drv = &netvsc_drv;
 	int ret;
 
-	pr_info("initializing....");
+	pr_info("initializing....\n");
 
 	if (!dmi_check_system(hv_netvsc_dmi_table))
 		return -ENODEV;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 3029786..6d5568c 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -272,8 +272,9 @@ static void storvsc_on_io_completion(struct hv_device *device,
 		/* CHECK_CONDITION */
 		if (vstor_packet->vm_srb.srb_status & 0x80) {
 			/* autosense data available */
-			DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data "
-				    "valid - len %d\n", request,
+			DPRINT_WARN(STORVSC,
+				    "storvsc pkt %p autosense data valid - len %d",
+				    request,
 				    vstor_packet->vm_srb.sense_info_length);
 
 			memcpy(request->sense_buffer,





More information about the devel mailing list