[PATCH 2/5] DMI: create dmi_dump_entries()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Len Brown <len.brown@xxxxxxxxx>

Create a routine to dump the requested DMI entries to the console.

Signed-off-by: Len Brown <len.brown@xxxxxxxxx>
---
 drivers/firmware/dmi_scan.c |   19 +++++++++++++++++++
 include/linux/dmi.h         |    2 ++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 0cdadea..11e475d 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -470,3 +470,22 @@ int dmi_get_year(int field)
 	return year;
 }
 
+/**
+ *	dmi_dump_entries - print DMI entries to console
+ *	@entries:	bit-mask specifying dmi_field(s)
+ *
+ *	Returns 0 on success
+ */
+int dmi_dump_entries(int entries)
+{
+	int index;
+
+	if (!dmi_available)
+		return -1;
+
+	for (index = 0; index < DMI_STRING_MAX; ++index) {
+		if (entries & (1 << index))
+			printk(KERN_INFO "%d. %s\n", index, dmi_ident[index]);
+	}
+	return 0;
+}
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b1251b2..61469f6 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -79,6 +79,7 @@ extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
 extern int dmi_available;
+extern int dmi_dump_entries(int entries);
 
 #else
 
@@ -89,6 +90,7 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
 #define dmi_available 0
+static inline int dmi_dump_entries(int entries) { return -1; }
 
 #endif
 
-- 
1.5.4.rc3.14.g44397

-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux