aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-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}