[PATCH] Staging: wlan-ng: fix many style warnings in hfa384x_usb.c

Previous thread: [PATCH] KEYS: Fix an RCU warning in the reading of user keys by David Howells on Wednesday, April 21, 2010 - 9:36 am. (2 messages)

Next thread: Driver for SMM665 power controller by Guenter Roeck on Wednesday, April 21, 2010 - 10:36 am. (1 message)
From: Alessandro Ghedini
Date: Wednesday, April 21, 2010 - 10:29 am

This patch fixes most of the style warnings found with checkpatch.pl in the
hfa384x_usb.c file.

Signed-off-by: Alessandro Ghedini <al3xbio@gmail.com>
---
 drivers/staging/wlan-ng/hfa384x_usb.c |   59 ++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 5df56f0..db819be 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -62,7 +62,7 @@
 *
 * hfa384x_drvr_xxxconfig  An example of the drvr level abstraction. These
 *			functions are wrappers for the RID get/set
-*			sequence. They 	call copy_[to|from]_bap() and
+*			sequence. They call copy_[to|from]_bap() and
 *			cmd_access().	These functions operate on the
 *			RIDs and buffers without validation.  The caller
 *			is responsible for that.
@@ -351,7 +351,9 @@ static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
 	hw->rx_urb_skb = skb;
 
 	result = -ENOLINK;
-	if (!hw->wlandev->hwremoved && !test_bit(WORK_RX_HALT, &hw->usb_flags)) {
+	if (!hw->wlandev->hwremoved && \
+			!test_bit(WORK_RX_HALT, &hw->usb_flags)) {
+
 		result = SUBMIT_URB(&hw->rx_urb, memflags);
 
 		/* Check whether we need to reset the RX pipe */
@@ -451,7 +453,7 @@ static void hfa384x_usb_defer(struct work_struct *data)
 	if (test_bit(WORK_RX_HALT, &hw->usb_flags)) {
 		int ret;
 
-		usb_kill_urb(&hw->rx_urb);	/* Cannot be holding spinlock! */
+		usb_kill_urb(&hw->rx_urb); /* Cannot be holding spinlock! */
 
 		ret = usb_clear_halt(hw->usb, hw->endp_in);
 		if (ret != 0) {
@@ -1226,7 +1228,7 @@ int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis)
 *
 * Arguments:
 *	hw		device structure
-*	ctlx	 	CTLX ptr
+*	ctlx		CTLX ptr
 *	completor	functor object to decide what to
 *			do with the CTLX's result.
 *
@@ -2075,12 +2077,9 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len)
 			    (j * ...
From: Joe Perches
Date: Wednesday, April 21, 2010 - 10:59 am

Using line continuations like this is unnecessary and undesirable.

Most kernel code uses a form like:

	if (!thw->wlandev->hwremoved &&
	    !test_bit(WORK_RX_HALT, &hw->usb_flags))


Checkpatch isn't correct here.

Another option is to use pr_<level> with
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
so logging messages identify the unit/module
like shown below.   A secondary benefit is the
code becomes slightly shorter.

A possible enhancement might be to use netdev_<level>
instead of pr_<level> where appropriate.

 drivers/staging/wlan-ng/hfa384x_usb.c |  169 ++++++++++++++-------------------
 1 files changed, 73 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 5df56f0..0995f85 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -110,6 +110,8 @@
 * --------------------------------------------------------------------
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -356,9 +358,8 @@ static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
 
 		/* Check whether we need to reset the RX pipe */
 		if (result == -EPIPE) {
-			printk(KERN_WARNING
-			       "%s rx pipe stalled: requesting reset\n",
-			       hw->wlandev->netdev->name);
+			pr_warning("%s rx pipe stalled: requesting reset\n",
+				   hw->wlandev->netdev->name);
 			if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags))
 				schedule_work(&hw->usb_work);
 		}
@@ -406,9 +407,8 @@ static int submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags)
 
 			/* Test whether we need to reset the TX pipe */
 			if (result == -EPIPE) {
-				printk(KERN_WARNING
-				       "%s tx pipe stalled: requesting reset\n",
-				       netdev->name);
+				pr_warning("%s tx pipe stalled: requesting reset\n",
+					   netdev->name);
 				set_bit(WORK_TX_HALT, &hw->usb_flags);
 ...
From: Greg KH
Date: Wednesday, April 21, 2010 - 11:03 am

Put stuff like this on the line before, not after the code please.

thanks,

greg k-h
--

Previous thread: [PATCH] KEYS: Fix an RCU warning in the reading of user keys by David Howells on Wednesday, April 21, 2010 - 9:36 am. (2 messages)

Next thread: Driver for SMM665 power controller by Guenter Roeck on Wednesday, April 21, 2010 - 10:36 am. (1 message)