Skip to contentSkip to conversation

Staging: ft1000-usb: fixed a few code style issues

PATCH In review Anders Darander 2 participants 3 messages Mar 31, 2014 – Apr 1, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: ft1000-usb: fixed a few code style issues

Fixed a few code style issues, particularly:

Add do {} while (0) wrapper around seq_* macros.
Change printk(KERN_WARN...) to netdev_warn(...).

---
Changes:
v2: * Fix syntax errors (adding missing ; and }).

 drivers/staging/ft1000/ft1000-usb/ft1000_proc.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +14 -11
index 2575d0d..e89b5d2 100644
@@ -32,17 +32,20 @@
 
 
 #define seq_putx(m, message, size, var) \
-	seq_printf(m, message);	\
-	for (i = 0; i < (size - 1); i++) \
-		seq_printf(m, "%02x:", var[i]); \
-	seq_printf(m, "%02x\n", var[i])
+	do { \
+		seq_printf(m, message);	\
+		for (i = 0; i < (size - 1); i++) \
+			seq_printf(m, "%02x:", var[i]); \
+		seq_printf(m, "%02x\n", var[i]);	\
+	} while (0)
 
 #define seq_putd(m, message, size, var) \
-	seq_printf(m, message); \
-	for (i = 0; i < (size - 1); i++) \
-		seq_printf(m, "%d.", var[i]); \
-	seq_printf(m, "%d\n", var[i])
-
+	do { \
+		seq_printf(m, message); \
+		for (i = 0; i < (size - 1); i++) \
+			seq_printf(m, "%d.", var[i]); \
+		seq_printf(m, "%d\n", var[i]);	      \
+	} while (0)
 
 #define FTNET_PROC init_net.proc_net
 
@@ -200,7 +203,7 @@ int ft1000_init_proc(struct net_device *dev)
 
 	info->ft1000_proc_dir = proc_mkdir(FT1000_PROC_DIR, FTNET_PROC);
 	if (info->ft1000_proc_dir == NULL) {
-		printk(KERN_WARNING "Unable to create %s dir.\n",
+		netdev_warn(dev, "Unable to create %s dir.\n",
 			FT1000_PROC_DIR);
 		goto fail;
 	}
@@ -210,7 +213,7 @@ int ft1000_init_proc(struct net_device *dev)
 				 &ft1000_proc_fops, dev);
 
 	if (!ft1000_proc_file) {
-		printk(KERN_WARNING "Unable to create /proc entry.\n");
+		netdev_warn(dev, "Unable to create /proc entry.\n");
 		goto fail_entry;
 	}
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 4 lines · Anders Darander

Fixed a few code style issues, particularly:

Add do {} while (0) wrapper around seq_* macros.
Change printk(KERN_WARN...) to netdev_warn(...).

That's 2 different things, please split this up into 2 different patches.

Remember, one patch does one thing.

thanks,

greg k-h

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 4 lines · Anders Darander

Fixed a few code style issues, particularly:

Add do {} while (0) wrapper around seq_* macros.
Change printk(KERN_WARN...) to netdev_warn(...).

That's 2 different things, please split this up into 2 different patches.

Split up patches on their way.

Quoted 1 line

Remember, one patch does one thing.

Sure.

In this case I deemed them to be small and though not the same, but still mosly coding style issues. Though, I can certainly see that the printk to netdev_warn actually adds more than just a coding style clean-up.

Cheers,
Anders