Skip to contentSkip to conversation

dmi_scan.c cleanups.

PATCH In review Stelian Pop 3 participants 3 messages Jul 9, 2001 – Jul 10, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmi_scan.c cleanups.

This patch cleans up the printk code in dmi_scan.c (the previous code gave compile warnings on enabling the printk).

Stelian.

arch/i386/kernel/dmi_scan.c +26 -26
diff -uNr --exclude-from=dontdiff linux-2.4.6-ac2.orig/arch/i386/kernel/dmi_scan.c linux-2.4.6-ac2/arch/i386/kernel/dmi_scan.c
@@ -14,8 +14,8 @@
 	u16	handle;
 };
 
-#define dmi_printk(x)
-//#define dmi_printk(x) printk(x)
+#define dmi_printk while(0) printk
+//#define dmi_printk printk
 
 static char * __init dmi_string(struct dmi_header *dm, u8 s)
 {
@@ -78,13 +78,13 @@
 			u16 len=buf[7]<<8|buf[6];
 			u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
 
-			dmi_printk((KERN_INFO "DMI %d.%d present.\n",
-				buf[14]>>4, buf[14]&0x0F));
-			dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n",
+			dmi_printk(KERN_INFO "DMI %d.%d present.\n",
+				buf[14]>>4, buf[14]&0x0F);
+			dmi_printk(KERN_INFO "%d structures occupying %d bytes.\n",
 				buf[13]<<8|buf[12],
-				buf[7]<<8|buf[6]));
-			dmi_printk((KERN_INFO "DMI table at 0x%08X.\n",
-				buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8]));
+				buf[7]<<8|buf[6]);
+			dmi_printk(KERN_INFO "DMI table at 0x%08X.\n",
+				buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8]);
 			if(dmi_table(base,len, num, decode)==0)
 				return 0;
 		}
@@ -355,13 +355,13 @@
 			p=dmi_string(dm,data[4]);
 			if(*p)
 			{
-				dmi_printk(("BIOS Vendor: %s\n", p));
+				dmi_printk("BIOS Vendor: %s\n", p);
 				dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
-				dmi_printk(("BIOS Version: %s\n", 
-					dmi_string(dm, data[5])));
+				dmi_printk("BIOS Version: %s\n", 
+					dmi_string(dm, data[5]));
 				dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
-				dmi_printk(("BIOS Release: %s\n",
-					dmi_string(dm, data[8])));
+				dmi_printk("BIOS Release: %s\n",
+					dmi_string(dm, data[8]));
 				dmi_save_ident(dm, DMI_BIOS_DATE, 8);
 			}
 			break;
@@ -370,36 +370,36 @@
 			p=dmi_string(dm,data[4]);
 			if(*p)
 			{
-				dmi_printk(("System Vendor: %s.\n",p));
+				dmi_printk("System Vendor: %s.\n",p);
 				dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
-				dmi_printk(("Product Name: %s.\n",
-					dmi_string(dm, data[5])));
+				dmi_printk("Product Name: %s.\n",
+					dmi_string(dm, data[5]));
 				dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
-				dmi_printk(("Version %s.\n",
-					dmi_string(dm, data[6])));
+				dmi_printk("Version %s.\n",
+					dmi_string(dm, data[6]));
 				dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
-				dmi_printk(("Serial Number %s.\n",
-					dmi_string(dm, data[7])));
+				dmi_printk("Serial Number %s.\n",
+					dmi_string(dm, data[7]));
 			}
 			break;
 		case 2:
 			p=dmi_string(dm,data[4]);
 			if(*p)
 			{
-				dmi_printk(("Board Vendor: %s.\n",p));
+				dmi_printk("Board Vendor: %s.\n",p);
 				dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
-				dmi_printk(("Board Name: %s.\n",
-					dmi_string(dm, data[5])));
+				dmi_printk("Board Name: %s.\n",
+					dmi_string(dm, data[5]));
 				dmi_save_ident(dm, DMI_BOARD_NAME, 5);
-				dmi_printk(("Board Version: %s.\n",
-					dmi_string(dm, data[6])));
+				dmi_printk("Board Version: %s.\n",
+					dmi_string(dm, data[6]));
 				dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
 			}
 			break;
 		case 3:
 			p=dmi_string(dm,data[8]);
 			if(*p && *p!=' ')
-				dmi_printk(("Asset Tag: %s.\n", p));
+				dmi_printk("Asset Tag: %s.\n", p);
 			break;
 	}
 }
Signature · 4 lines
Stelian Pop <[email protected]>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|
#1 lore raw
Quoted 2 lines · Stelian Pop

This patch cleans up the printk code in dmi_scan.c (the previous code gave compile warnings on enabling the printk).

A much smaller (but not necessarily better) patch would simply be:

i386/kernel/dmi_scan.c renamed from i386/kernel/dmi_scan.c.orig +1 -1
@@ -15,7 +15,7 @@
 };
 
 #define dmi_printk(x)
-//#define dmi_printk(x) printk(x)
+//#define dmi_printk(x) printk x
 
 static char * __init dmi_string(struct dmi_header *dm, u8 s)
 {
Signature · 3 lines
        Bob Dunlop
        [email protected]
        www.xyzzy.clara.co.uk
#2 lore raw
In reply to Stelian Pop
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"stelian" == Stelian Pop <[email protected]> writes:

Hi
how about var args macros?

stelian> diff -uNr --exclude-from=dontdiff linux-2.4.6-ac2.orig/arch/i386/kernel/dmi_scan.c linux-2.4.6-ac2/arch/i386/kernel/dmi_scan.c
stelian> --- linux-2.4.6-ac2.orig/arch/i386/kernel/dmi_scan.c Mon Jul 9 10:25:52 2001
stelian> +++ linux-2.4.6-ac2/arch/i386/kernel/dmi_scan.c Mon Jul 9 11:03:29 2001
stelian> @@ -14,8 +14,8 @@
stelian> u16 handle;
stelian> };

stelian> -#define dmi_printk(x)
stelian> -//#define dmi_printk(x) printk(x)
stelian> +#define dmi_printk while(0) printk
stelian> +//#define dmi_printk printk

#define dmp_printk(x...) printk(x)

once, here, put labels to the printks will be also a nice idea.

Later, Juan.

Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy