X86 platform drivers
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Matthew Garrett <mjg@redhat.com>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>,
	platform-driver-x86@vger.kernel.org
Subject: [PATCH 07/10] WMI: use separate list head for storing wmi blocks
Date: Thu, 26 Aug 2010 00:15:14 -0700	[thread overview]
Message-ID: <20100826071514.7976.77547.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100826071442.7976.93972.stgit@localhost.localdomain>

Do not abuse wmi_block structure to hold the head of list
of blocks, use separate list_head for that.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/platform/x86/wmi.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index e9064fb..7b68dce 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -47,6 +47,7 @@ MODULE_LICENSE("GPL");
 #define PREFIX "ACPI: WMI: "
 
 static DEFINE_MUTEX(wmi_data_lock);
+static LIST_HEAD(wmi_block_list);
 
 struct guid_block {
 	char guid[16];
@@ -70,7 +71,6 @@ struct wmi_block {
 	struct device *dev;
 };
 
-static struct wmi_block wmi_blocks;
 
 /*
  * If the GUID data block is marked as expensive, we must enable and
@@ -246,7 +246,7 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
 	wmi_parse_guid(guid_string, tmp);
 	wmi_swap_bytes(tmp, guid_input);
 
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 		block = &wblock->gblock;
 
@@ -633,7 +633,7 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
 	params[0].type = ACPI_TYPE_INTEGER;
 	params[0].integer.value = event;
 
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 		gblock = &wblock->gblock;
 
@@ -721,7 +721,7 @@ static int wmi_create_devs(void)
 	struct device *guid_dev;
 
 	/* Create devices for all the GUIDs */
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 
 		guid_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
@@ -758,7 +758,7 @@ static void wmi_remove_devs(void)
 	struct device *guid_dev;
 
 	/* Delete devices for all the GUIDs */
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 
 		guid_dev = wblock->dev;
@@ -797,7 +797,7 @@ static bool guid_already_parsed(const char *guid_string)
 	struct wmi_block *wblock;
 	struct list_head *p;
 
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 		gblock = &wblock->gblock;
 
@@ -811,7 +811,7 @@ static void free_wmi_blocks(void)
 {
 	struct wmi_block *wblock, *next;
 
-	list_for_each_entry_safe(wblock, next, &wmi_blocks.list, list) {
+	list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
 		list_del(&wblock->list);
 		kfree(wblock);
 	}
@@ -876,7 +876,7 @@ static acpi_status parse_wdg(acpi_handle handle)
 			wblock->handler = wmi_notify_debug;
 			wmi_method_enable(wblock, 1);
 		}
-		list_add_tail(&wblock->list, &wmi_blocks.list);
+		list_add_tail(&wblock->list, &wmi_block_list);
 	}
 
 out_free_pointer:
@@ -939,7 +939,7 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
 	struct list_head *p;
 	char guid_string[37];
 
-	list_for_each(p, &wmi_blocks.list) {
+	list_for_each(p, &wmi_block_list) {
 		wblock = list_entry(p, struct wmi_block, list);
 		block = &wblock->gblock;
 
@@ -999,8 +999,6 @@ static int __init acpi_wmi_init(void)
 {
 	int result;
 
-	INIT_LIST_HEAD(&wmi_blocks.list);
-
 	if (acpi_disabled)
 		return -ENODEV;
 

  parent reply	other threads:[~2010-08-26  7:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26  7:14 [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-08-26  7:14 ` [PATCH 02/10] WMI: free wmi blocks when parse_wdg() fails Dmitry Torokhov
2010-09-12 17:19   ` Carlos Corbacho
2010-08-26  7:14 ` [PATCH 03/10] WMI: fix wmi_gtoa() to actully terminate the string Dmitry Torokhov
2010-09-12 17:28   ` Carlos Corbacho
2010-08-26  7:14 ` [PATCH 04/10] WMI: do not leak memory in parse_wdg() Dmitry Torokhov
2010-09-12 17:29   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 05/10] WMI: fix potential NULL pointer dereference Dmitry Torokhov
2010-09-12 17:30   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 06/10] WMI: simplify handling of returned WMI blocks in parse_wdg() Dmitry Torokhov
2010-09-12 17:39   ` Carlos Corbacho
2010-08-26  7:15 ` Dmitry Torokhov [this message]
2010-09-12 17:40   ` [PATCH 07/10] WMI: use separate list head for storing wmi blocks Carlos Corbacho
2010-08-26  7:15 ` [PATCH 08/10] WMI: use pr_err() and friends Dmitry Torokhov
2010-09-12 17:42   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 09/10] WMI: make use of class device's attributres Dmitry Torokhov
2010-09-12 17:50   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 10/10] WMI: embed struct device directly into wmi_block Dmitry Torokhov
2010-09-12  7:29 ` [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-09-12 17:14 ` Carlos Corbacho
2010-10-01 17:00   ` Dmitry Torokhov

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=20100826071514.7976.77547.stgit@localhost.localdomain \
    --to=dmitry.torokhov@gmail.com \
    --cc=carlos@strangeworlds.co.uk \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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