From: Andrey Panin Various coding style and whitespace cleanups. Signed-off-by: Andrew Morton --- 25-akpm/arch/i386/kernel/dmi_scan.c | 108 +++++++++++++++++------------------- 1 files changed, 51 insertions(+), 57 deletions(-) diff -puN arch/i386/kernel/dmi_scan.c~dmi-codingstyle-and-whitespace-cleanups arch/i386/kernel/dmi_scan.c --- 25/arch/i386/kernel/dmi_scan.c~dmi-codingstyle-and-whitespace-cleanups Fri May 28 14:28:47 2004 +++ 25-akpm/arch/i386/kernel/dmi_scan.c Fri May 28 14:28:47 2004 @@ -22,9 +22,9 @@ int es7000_plat = 0; struct dmi_header { - u8 type; - u8 length; - u16 handle; + u8 type; + u8 length; + u16 handle; }; #undef DMI_DEBUG @@ -37,15 +37,14 @@ struct dmi_header static char * __init dmi_string(struct dmi_header *dm, u8 s) { - u8 *bp=(u8 *)dm; - bp+=dm->length; - if(!s) + u8 *bp = ((u8 *) dm) + dm->length; + + if (!s) return ""; s--; - while(s>0 && *bp) - { - bp+=strlen(bp); - bp++; + + while (s > 0 && *bp) { + bp += strlen(bp) + 1; s--; } return bp; @@ -58,13 +57,12 @@ static char * __init dmi_string(struct d static int __init dmi_table(u32 base, int len, int num, void (*decode)(struct dmi_header *)) { - u8 *buf; + u8 *buf, *data; struct dmi_header *dm; - u8 *data; - int i=0; + int i = 0; buf = bt_ioremap(base, len); - if(buf==NULL) + if (buf == NULL) return -1; data = buf; @@ -74,20 +72,19 @@ static int __init dmi_table(u32 base, in * OR we run off the end of the table (also happens) */ - while(ilength; - while(data-buflength; + while (((data - buf) < (len - 1)) && (data[0] || data[1])) data++; - if(data-buf>4, buf[14]&0x0F); + buf[14] >> 4, buf[14] & 0x0F); else printk(KERN_INFO "DMI present.\n"); dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n", num, len)); dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", base)); - if(dmi_table(base,len, num, decode)==0) + if (!dmi_table(base, len, num, decode)) return 0; } - fp+=16; + fp += 16; } return -1; } @@ -150,12 +146,13 @@ static void __init dmi_save_ident(struct { char *d = (char*)dm; char *p = dmi_string(dm, d[string]); - if(p==NULL || *p == 0) + + if (!p || !*p) return; if (dmi_ident[slot]) return; - dmi_ident[slot] = alloc_bootmem(strlen(p)+1); - if(dmi_ident[slot]) + dmi_ident[slot] = alloc_bootmem(strlen(p) + 1); + if (dmi_ident[slot]) strcpy(dmi_ident[slot], p); else printk(KERN_ERR "dmi_save_ident: out of memory.\n"); @@ -1054,25 +1051,23 @@ static __init void dmi_check_blacklist(v #ifdef CONFIG_ACPI_BOOT #define ACPI_BLACKLIST_CUTOFF_YEAR 2001 - if (dmi_ident[DMI_BIOS_DATE]) { - char *s = strrchr(dmi_ident[DMI_BIOS_DATE], '/'); - if (s) { - int year, disable = 0; - s++; - year = simple_strtoul(s,NULL,0); - if (year >= 1000) - disable = year < ACPI_BLACKLIST_CUTOFF_YEAR; + if (dmi_ident[DMI_BIOS_DATE]) { + char *s = strrchr(dmi_ident[DMI_BIOS_DATE], '/'); + if (s) { + int disable = 0, year = simple_strtoul(++s, NULL, 0); + + if (year >= 1000) + disable = year < ACPI_BLACKLIST_CUTOFF_YEAR; else if (year < 1 || (year > 90 && year <= 99)) - disable = 1; - if (disable && !acpi_force) { + disable = 1; + if (disable && !acpi_force) { printk(KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n", s); printk(KERN_NOTICE "You can enable it with acpi=force\n"); disable_acpi(); - } + } } } #endif - dmi_check_system(dmi_blacklist); } @@ -1132,8 +1127,7 @@ static void __init dmi_decode(struct dmi void __init dmi_scan_machine(void) { - int err = dmi_iterate(dmi_decode); - if(err == 0) + if (!dmi_iterate(dmi_decode)) dmi_check_blacklist(); else printk(KERN_INFO "DMI not present.\n"); _