mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>, rpurdie@rpsys.net
Subject: [PATCH 15/34] drivers/leds changes for SMBIOS and System Firmware
Date: Mon, 18 Jul 2011 09:08:29 -0400	[thread overview]
Message-ID: <1310994528-26276-16-git-send-email-prarit@redhat.com> (raw)
In-Reply-To: <1310994528-26276-1-git-send-email-prarit@redhat.com>

As part of the new SMBIOS and System Firmware code:

- Replace old dmi* structures and functions with new sysfw* and smbios*
structures and functions in individual drivers
- cleanup sysfw_id lookup tables

Cc: rpurdie@rpsys.net
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 drivers/leds/leds-clevo-mail.c |   78 ++++++++++++++++++----------------------
 drivers/leds/leds-ss4200.c     |   23 +++++-------
 2 files changed, 44 insertions(+), 57 deletions(-)

diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
index a498135..63047de 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -1,14 +1,10 @@
-
-#include <linux/module.h>
-
-#include <linux/platform_device.h>
 #include <linux/err.h>
-#include <linux/leds.h>
-
-#include <linux/io.h>
-#include <linux/dmi.h>
-
 #include <linux/i8042.h>
+#include <linux/io.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/sysfw.h>
 
 #define CLEVO_MAIL_LED_OFF		0x0084
 #define CLEVO_MAIL_LED_BLINK_1HZ	0x008A
@@ -20,11 +16,12 @@ MODULE_LICENSE("GPL");
 
 static unsigned int __initdata nodetect;
 module_param_named(nodetect, nodetect, bool, 0);
-MODULE_PARM_DESC(nodetect, "Skip DMI hardware detection");
+MODULE_PARM_DESC(nodetect, "Skip SMBIOS hardware detection");
 
 static struct platform_device *pdev;
 
-static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id)
+static int __init
+clevo_mail_led_smbios_callback(const struct sysfw_id *id)
 {
 	printk(KERN_INFO KBUILD_MODNAME ": '%s' found\n", id->ident);
 	return 1;
@@ -39,55 +36,55 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id)
  * detected as working, but in reality it is not) as low as
  * possible.
  */
-static struct dmi_system_id __initdata mail_led_whitelist[] = {
+static struct sysfw_id __initdata mail_led_whitelist[] = {
 	{
-		.callback = clevo_mail_led_dmi_callback,
+		.callback = clevo_mail_led_smbios_callback,
 		.ident = "Clevo D410J",
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "VIA"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "K8N800"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "VT8204B")
+			SYSFW_MATCH(SYSFW_SYS_VENDOR, "VIA"),
+			SYSFW_MATCH(SYSFW_PRODUCT_NAME, "K8N800"),
+			SYSFW_MATCH(SYSFW_PRODUCT_VERSION, "VT8204B")
 		}
 	},
 	{
-		.callback = clevo_mail_led_dmi_callback,
+		.callback = clevo_mail_led_smbios_callback,
 		.ident = "Clevo M5x0N",
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
-			DMI_MATCH(DMI_PRODUCT_NAME, "M5x0N")
+			SYSFW_MATCH(SYSFW_SYS_VENDOR, "CLEVO Co."),
+			SYSFW_MATCH(SYSFW_PRODUCT_NAME, "M5x0N")
 		}
 	},
 	{
-		.callback = clevo_mail_led_dmi_callback,
+		.callback = clevo_mail_led_smbios_callback,
 		.ident = "Positivo Mobile",
 		.matches = {
-			DMI_MATCH(DMI_BOARD_VENDOR, "CLEVO Co. "),
-			DMI_MATCH(DMI_BOARD_NAME, "M5X0V "),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Positivo Mobile"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "VT6198")
+			SYSFW_MATCH(SYSFW_BOARD_VENDOR, "CLEVO Co. "),
+			SYSFW_MATCH(SYSFW_BOARD_NAME, "M5X0V "),
+			SYSFW_MATCH(SYSFW_PRODUCT_NAME, "Positivo Mobile"),
+			SYSFW_MATCH(SYSFW_PRODUCT_VERSION, "VT6198")
 		}
 	},
 	{
-		.callback = clevo_mail_led_dmi_callback,
+		.callback = clevo_mail_led_smbios_callback,
 		.ident = "Clevo D400P",
 		.matches = {
-			DMI_MATCH(DMI_BOARD_VENDOR, "Clevo"),
-			DMI_MATCH(DMI_BOARD_NAME, "D400P"),
-			DMI_MATCH(DMI_BOARD_VERSION, "Rev.A"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "0106")
+			SYSFW_MATCH(SYSFW_BOARD_VENDOR, "Clevo"),
+			SYSFW_MATCH(SYSFW_BOARD_NAME, "D400P"),
+			SYSFW_MATCH(SYSFW_BOARD_VERSION, "Rev.A"),
+			SYSFW_MATCH(SYSFW_PRODUCT_VERSION, "0106")
 		}
 	},
 	{
-		.callback = clevo_mail_led_dmi_callback,
+		.callback = clevo_mail_led_smbios_callback,
 		.ident = "Clevo D410V",
 		.matches = {
-			DMI_MATCH(DMI_BOARD_VENDOR, "Clevo, Co."),
-			DMI_MATCH(DMI_BOARD_NAME, "D400V/D470V"),
-			DMI_MATCH(DMI_BOARD_VERSION, "SS78B"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "Rev. A1")
+			SYSFW_MATCH(SYSFW_BOARD_VENDOR, "Clevo, Co."),
+			SYSFW_MATCH(SYSFW_BOARD_NAME, "D400V/D470V"),
+			SYSFW_MATCH(SYSFW_BOARD_VERSION, "SS78B"),
+			SYSFW_MATCH(SYSFW_PRODUCT_VERSION, "Rev. A1")
 		}
 	},
-	{ }
+	{}
 };
 
 static void clevo_mail_led_set(struct led_classdev *led_cdev,
@@ -176,21 +173,16 @@ static struct platform_driver clevo_mail_led_driver = {
 static int __init clevo_mail_led_init(void)
 {
 	int error = 0;
-	int count = 0;
 
 	/* Check with the help of DMI if we are running on supported hardware */
-	if (!nodetect) {
-		count = dmi_check_system(mail_led_whitelist);
-	} else {
-		count = 1;
+	if (nodetect) {
 		printk(KERN_ERR KBUILD_MODNAME ": Skipping DMI detection. "
 		       "If the driver works on your hardware please "
 		       "report model and the output of dmidecode in tracker "
 		       "at http://sourceforge.net/projects/clevo-mailled/\n");
-	}
-
-	if (!count)
+	} else if (!sysfw_callback(mail_led_whitelist)) {
 		return -ENODEV;
+	}
 
 	pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
 	if (!IS_ERR(pdev)) {
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
index 614ebeb..0b6b6fa 100644
--- a/drivers/leds/leds-ss4200.c
+++ b/drivers/leds/leds-ss4200.c
@@ -21,13 +21,13 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/dmi.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/sysfw.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
 
@@ -73,7 +73,7 @@ static const struct pci_device_id ich7_lpc_pci_id[] =
 
 MODULE_DEVICE_TABLE(pci, ich7_lpc_pci_id);
 
-static int __init ss4200_led_dmi_callback(const struct dmi_system_id *id)
+static int __init ss4200_led_smbios_callback(const struct sysfw_id *id)
 {
 	pr_info("detected '%s'\n", id->ident);
 	return 1;
@@ -81,7 +81,7 @@ static int __init ss4200_led_dmi_callback(const struct dmi_system_id *id)
 
 static unsigned int __initdata nodetect;
 module_param_named(nodetect, nodetect, bool, 0);
-MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection");
+MODULE_PARM_DESC(nodetect, "Skip SMBIOS-based hardware detection");
 
 /*
  * struct nas_led_whitelist - List of known good models
@@ -92,14 +92,14 @@ MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection");
  * detected as working, but in reality it is not) as low as
  * possible.
  */
-static struct dmi_system_id __initdata nas_led_whitelist[] = {
+static struct sysfw_id __initdata nas_led_whitelist[] = {
 	{
-		.callback = ss4200_led_dmi_callback,
+		.callback = ss4200_led_smbios_callback,
 		.ident = "Intel SS4200-E",
 		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "SS4200-E"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00")
+			SYSFW_MATCH(SYSFW_SYS_VENDOR, "Intel"),
+			SYSFW_MATCH(SYSFW_PRODUCT_NAME, "SS4200-E"),
+			SYSFW_MATCH(SYSFW_PRODUCT_VERSION, "1.00.00")
 		}
 	},
 	{}
@@ -504,16 +504,11 @@ static int __init nas_gpio_init(void)
 {
 	int i;
 	int ret = 0;
-	int nr_devices = 0;
 
-	nr_devices = dmi_check_system(nas_led_whitelist);
 	if (nodetect) {
 		pr_info("skipping hardware autodetection\n");
 		pr_info("Please send 'dmidecode' output to dave@sr71.net\n");
-		nr_devices++;
-	}
-
-	if (nr_devices <= 0) {
+	} else if (!sysfw_callback(nas_led_whitelist)) {
 		pr_info("no LED devices found\n");
 		return -ENODEV;
 	}
-- 
1.6.5.2


  parent reply	other threads:[~2011-07-18 13:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 13:08 [PATCH 00/34] System Firmware and SMBIOS Support [v3] Prarit Bhargava
2011-07-18 13:08 ` [PATCH 01/34] System Firmware Interface Prarit Bhargava
2011-07-19  0:43   ` Andi Kleen
2011-07-19  9:05     ` Alan Cox
2011-07-19 12:23       ` Prarit Bhargava
2011-07-19 13:25         ` Andi Kleen
2011-07-19 13:52           ` Prarit Bhargava
2011-07-19 13:21       ` Andi Kleen
2011-07-19 13:39         ` Prarit Bhargava
2011-07-19 13:46           ` Andi Kleen
2011-07-19 13:58             ` Prarit Bhargava
2011-07-25 19:03   ` [lm-sensors] " Jean Delvare
2011-08-10 13:26     ` Prarit Bhargava
2011-07-18 13:08 ` [PATCH 02/34] New SMBIOS driver for x86 and ia64 Prarit Bhargava
2011-07-18 13:08 ` [PATCH 03/34] arch specific changes for SMBIOS and System Firmware Prarit Bhargava
2011-07-18 13:08 ` [PATCH 04/34] drivers/acpi changes for SMBIOS and System Firmware interface Prarit Bhargava
2011-07-18 13:08 ` [PATCH 05/34] drivers/ata changes for SMBIOS and System Firmware Prarit Bhargava
2011-07-18 13:08 ` [PATCH 06/34] drivers/floppy " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 07/34] drivers/char " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 08/34] drivers/crypto " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 09/34] drivers/gpio " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 10/34] drivers/gpu " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 11/34] drivers/hwmon " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 12/34] drivers/i2c " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 13/34] drivers/ide " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 14/34] drivers/input " Prarit Bhargava
2011-07-18 13:08 ` Prarit Bhargava [this message]
2011-07-18 13:08 ` [PATCH 16/34] drivers/media " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 17/34] drivers/misc " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 18/34] drivers/mtd " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 19/34] drivers/net " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 20/34] drivers/pci " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 21/34] drivers/platform " Prarit Bhargava
2011-08-11  4:30   ` Jonathan Woithe
2011-07-18 13:08 ` [PATCH 22/34] drivers/pnp " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 23/34] drivers/power " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 24/34] drivers/rtc " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 25/34] drivers/staging " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 26/34] drivers/tty " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 27/34] drivers/usb " Prarit Bhargava
2011-07-19 19:47   ` Alan Stern
2011-07-18 13:08 ` [PATCH 28/34] drivers/video " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 29/34] drivers/w1 " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 30/34] drivers/watchdog " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 31/34] include/linux/acpi.h " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 32/34] Kernel panic " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 33/34] sound/pci/hda " Prarit Bhargava
2011-07-18 13:08 ` [PATCH 34/34] Remove old DMI & SMBIOS code and make SMBIOS default on Prarit Bhargava

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1310994528-26276-16-git-send-email-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome