diff options
-rw-r--r-- | arch/i386/kernel/dmi_scan.c | 30 | ||||
-rw-r--r-- | drivers/acpi/blacklist.c | 27 | ||||
-rw-r--r-- | include/linux/dmi.h | 2 |
3 files changed, 38 insertions, 21 deletions
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index ca2a0cbcac04..d2dfd9c8d691 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -299,3 +299,33 @@ struct dmi_device * dmi_find_device(int type, const char *name, | |||
299 | return NULL; | 299 | return NULL; |
300 | } | 300 | } |
301 | EXPORT_SYMBOL(dmi_find_device); | 301 | EXPORT_SYMBOL(dmi_find_device); |
302 | |||
303 | /** | ||
304 | * dmi_get_year - Return year of a DMI date | ||
305 | * @field: data index (like dmi_get_system_info) | ||
306 | * | ||
307 | * Returns -1 when the field doesn't exist. 0 when it is broken. | ||
308 | */ | ||
309 | int dmi_get_year(int field) | ||
310 | { | ||
311 | int year; | ||
312 | char *s = dmi_get_system_info(field); | ||
313 | |||
314 | if (!s) | ||
315 | return -1; | ||
316 | if (*s == '\0') | ||
317 | return 0; | ||
318 | s = strrchr(s, '/'); | ||
319 | if (!s) | ||
320 | return 0; | ||
321 | |||
322 | s += 1; | ||
323 | year = simple_strtoul(s, NULL, 0); | ||
324 | if (year && year < 100) { /* 2-digit year */ | ||
325 | year += 1900; | ||
326 | if (year < 1996) /* no dates < spec 1.0 */ | ||
327 | year += 100; | ||
328 | } | ||
329 | |||
330 | return year; | ||
331 | } | ||
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 9824f679a910..f9c972b26f4f 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -77,28 +77,13 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = { | |||
77 | 77 | ||
78 | static int __init blacklist_by_year(void) | 78 | static int __init blacklist_by_year(void) |
79 | { | 79 | { |
80 | int year; | 80 | int year = dmi_get_year(DMI_BIOS_DATE); |
81 | char *s = dmi_get_system_info(DMI_BIOS_DATE); | 81 | /* Doesn't exist? Likely an old system */ |
82 | 82 | if (year == -1) | |
83 | if (!s) | 83 | return 1; |
84 | return 0; | 84 | /* 0? Likely a buggy new BIOS */ |
85 | if (!*s) | 85 | if (year == 0) |
86 | return 0; | ||
87 | |||
88 | s = strrchr(s, '/'); | ||
89 | if (!s) | ||
90 | return 0; | 86 | return 0; |
91 | |||
92 | s += 1; | ||
93 | |||
94 | year = simple_strtoul(s, NULL, 0); | ||
95 | |||
96 | if (year < 100) { /* 2-digit year */ | ||
97 | year += 1900; | ||
98 | if (year < 1996) /* no dates < spec 1.0 */ | ||
99 | year += 100; | ||
100 | } | ||
101 | |||
102 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { | 87 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { |
103 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " | 88 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " |
104 | "acpi=force is required to enable ACPI\n", | 89 | "acpi=force is required to enable ACPI\n", |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 2e6bbe014157..64fd6c366604 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -68,6 +68,7 @@ extern char * dmi_get_system_info(int field); | |||
68 | extern struct dmi_device * dmi_find_device(int type, const char *name, | 68 | extern struct dmi_device * dmi_find_device(int type, const char *name, |
69 | struct dmi_device *from); | 69 | struct dmi_device *from); |
70 | extern void dmi_scan_machine(void); | 70 | extern void dmi_scan_machine(void); |
71 | extern int dmi_get_year(int field); | ||
71 | 72 | ||
72 | #else | 73 | #else |
73 | 74 | ||
@@ -75,6 +76,7 @@ static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } | |||
75 | static inline char * dmi_get_system_info(int field) { return NULL; } | 76 | static inline char * dmi_get_system_info(int field) { return NULL; } |
76 | static inline struct dmi_device * dmi_find_device(int type, const char *name, | 77 | static inline struct dmi_device * dmi_find_device(int type, const char *name, |
77 | struct dmi_device *from) { return NULL; } | 78 | struct dmi_device *from) { return NULL; } |
79 | static inline int dmi_get_year(int year) { return 0; } | ||
78 | 80 | ||
79 | #endif | 81 | #endif |
80 | 82 | ||