Skip to contentSkip to conversation

2.6 drivers/net lp46e replace SIZE macros

PATCH In review acripps 2 participants 2 messages Jun 9, 2007

Subsystems (2)
lore
Share & tools
lore

acripps

author
#0 lore raw

PATCH 2/4 2.6 drivers/net lp46e replace SIZE macros

Replaced SIZE(x) macro with the more descriptive ARRAY_SIZE(arr) macro defined in kernel.h
Also removed 22 lines of code that will never be compiled because of preprocessor directive: #if 0
compile tested, no compile time issues found.

drivers/net/lp486e.c +0 -27
diff -Nuar linux-2.6/drivers/net/lp486e.c linux-2.6-patched/drivers/net/lp486e.c
@@ -515,33 +515,6 @@
 	outb(0, IOADDR+8);
 }
 
-#define SIZE(x)	(sizeof(x)/sizeof((x)[0]))
-
-#if 0
-/* selftest or dump */
-static void
-i596_port_do(struct net_device *dev, int portcmd, char *cmdname) {
-	struct i596_private *lp = dev->priv;
-	u16 *outp;
-	int i, m;
-
-	memset((void *)&(lp->dump), 0, sizeof(struct i596_dump));
-	outp = &(lp->dump.dump[0]);
-
-	PORT(va_to_pa(outp), portcmd);
-	mdelay(30);             /* random, unmotivated */
-
-	printk("lp486e i82596 %s result:\n", cmdname);
-	for (m = SIZE(lp->dump.dump); m && lp->dump.dump[m-1] = 0; m--)
-		;
-	for (i = 0; i < m; i++) {
-		printk(" %04x", lp->dump.dump[i]);
-		if (i%8 = 7)
-			printk("\n");
-	}
-	printk("\n");
-}
-#endif
 
 static int
 i596_scp_setup(struct net_device *dev) {

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 35 lines · acripps

Replaced SIZE(x) macro with the more descriptive ARRAY_SIZE(arr) macro defined in kernel.h
Also removed 22 lines of code that will never be compiled because of preprocessor directive: #if 0
compile tested, no compile time issues found.

diff -Nuar linux-2.6/drivers/net/lp486e.c linux-2.6-patched/drivers/net/lp486e.c

drivers/net/lp486e.c +0 -20
@@ -515,33 +515,6 @@
 	outb(0, IOADDR+8);
 }
 
-#define SIZE(x)	(sizeof(x)/sizeof((x)[0]))
-
-#if 0
-/* selftest or dump */
-static void
-i596_port_do(struct net_device *dev, int portcmd, char *cmdname) {
-	struct i596_private *lp = dev->priv;
-	u16 *outp;
-	int i, m;
-
-	memset((void *)&(lp->dump), 0, sizeof(struct i596_dump));
-	outp = &(lp->dump.dump[0]);
-
-	PORT(va_to_pa(outp), portcmd);
-	mdelay(30);             /* random, unmotivated */
-
-	printk("lp486e i82596 %s result:\n", cmdname);
-	for (m = SIZE(lp->dump.dump); m && lp->dump.dump[m-1] = 0; m--)
-		;
-	for (i = 0; i < m; i++) {

drivers/net/lp486e.c line 520

Quoted 10 lines
drivers/net/lp486e.c +0 -7
-		printk(" %04x", lp->dump.dump[i]);
-		if (i%8 = 7)
-			printk("\n");
-	}
-	printk("\n");
-}
-#endif
 
 static int
 i596_scp_setup(struct net_device *dev) {

a couple points:

1) just because something is surrounded by "#if 0" doesn't mean it can simply be deleted. there's all kinds of emotional baggage associated with some of these snippets, and some developers aren't ready to let these things go just yet.

2) the patch above has nothing to do with "ARRAY_SIZE", so your patch description is inappropriate. you're simply deleting the SIZE() macro, nothing more.

rday

Signature · 11 lines
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors