aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/dmi_scan.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-03-25 10:30:19 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 12:10:54 -0500
commitf083a329e63d471a5e9238e837772b1b76c218db (patch)
tree3d0955a4190ca886c3efa2e93e725d843e7d907b /arch/i386/kernel/dmi_scan.c
parente6fc99c6aba0350a3c4c0206b7047d4893491485 (diff)
[PATCH] x86_64: Clean up and tweak ACPI blacklist year code
- Move the core parser into dmi_scan.c. It can be useful for other subsystems too. - Differentiate between field doesn't exist and field is 0 or unparseable. The first case is likely an old BIOS with broken ACPI, the later is likely a slightly buggy BIOS where someone forget to edit the date. Don't blacklist in the later case. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/dmi_scan.c')
-rw-r--r--arch/i386/kernel/dmi_scan.c30
1 files changed, 30 insertions, 0 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}
301EXPORT_SYMBOL(dmi_find_device); 301EXPORT_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 */
309int 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}