aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-26 03:15:14 -0400
committerMatthew Garrett <mjg@redhat.com>2010-10-21 09:36:47 -0400
commit762e1a2ff6c1116d8f6f175994753fa2319097f2 (patch)
treea44386f6d83243751c5fbfd542083c7b259d53f7
parent378306628e26d2945a1ed245f177a693c314e68d (diff)
WMI: use separate list head for storing wmi blocks
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> Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r--drivers/platform/x86/wmi.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index f6e85c8122de..dc528ba8617b 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -47,6 +47,7 @@ MODULE_LICENSE("GPL");
47#define PREFIX "ACPI: WMI: " 47#define PREFIX "ACPI: WMI: "
48 48
49static DEFINE_MUTEX(wmi_data_lock); 49static DEFINE_MUTEX(wmi_data_lock);
50static LIST_HEAD(wmi_block_list);
50 51
51struct guid_block { 52struct guid_block {
52 char guid[16]; 53 char guid[16];
@@ -70,7 +71,6 @@ struct wmi_block {
70 struct device *dev; 71 struct device *dev;
71}; 72};
72 73
73static struct wmi_block wmi_blocks;
74 74
75/* 75/*
76 * If the GUID data block is marked as expensive, we must enable and 76 * If the GUID data block is marked as expensive, we must enable and
@@ -234,7 +234,7 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
234 wmi_parse_guid(guid_string, tmp); 234 wmi_parse_guid(guid_string, tmp);
235 wmi_swap_bytes(tmp, guid_input); 235 wmi_swap_bytes(tmp, guid_input);
236 236
237 list_for_each(p, &wmi_blocks.list) { 237 list_for_each(p, &wmi_block_list) {
238 wblock = list_entry(p, struct wmi_block, list); 238 wblock = list_entry(p, struct wmi_block, list);
239 block = &wblock->gblock; 239 block = &wblock->gblock;
240 240
@@ -621,7 +621,7 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
621 params[0].type = ACPI_TYPE_INTEGER; 621 params[0].type = ACPI_TYPE_INTEGER;
622 params[0].integer.value = event; 622 params[0].integer.value = event;
623 623
624 list_for_each(p, &wmi_blocks.list) { 624 list_for_each(p, &wmi_block_list) {
625 wblock = list_entry(p, struct wmi_block, list); 625 wblock = list_entry(p, struct wmi_block, list);
626 gblock = &wblock->gblock; 626 gblock = &wblock->gblock;
627 627
@@ -709,7 +709,7 @@ static int wmi_create_devs(void)
709 struct device *guid_dev; 709 struct device *guid_dev;
710 710
711 /* Create devices for all the GUIDs */ 711 /* Create devices for all the GUIDs */
712 list_for_each(p, &wmi_blocks.list) { 712 list_for_each(p, &wmi_block_list) {
713 wblock = list_entry(p, struct wmi_block, list); 713 wblock = list_entry(p, struct wmi_block, list);
714 714
715 guid_dev = kzalloc(sizeof(struct device), GFP_KERNEL); 715 guid_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
@@ -746,7 +746,7 @@ static void wmi_remove_devs(void)
746 struct device *guid_dev; 746 struct device *guid_dev;
747 747
748 /* Delete devices for all the GUIDs */ 748 /* Delete devices for all the GUIDs */
749 list_for_each(p, &wmi_blocks.list) { 749 list_for_each(p, &wmi_block_list) {
750 wblock = list_entry(p, struct wmi_block, list); 750 wblock = list_entry(p, struct wmi_block, list);
751 751
752 guid_dev = wblock->dev; 752 guid_dev = wblock->dev;
@@ -785,7 +785,7 @@ static bool guid_already_parsed(const char *guid_string)
785 struct wmi_block *wblock; 785 struct wmi_block *wblock;
786 struct list_head *p; 786 struct list_head *p;
787 787
788 list_for_each(p, &wmi_blocks.list) { 788 list_for_each(p, &wmi_block_list) {
789 wblock = list_entry(p, struct wmi_block, list); 789 wblock = list_entry(p, struct wmi_block, list);
790 gblock = &wblock->gblock; 790 gblock = &wblock->gblock;
791 791
@@ -799,7 +799,7 @@ static void free_wmi_blocks(void)
799{ 799{
800 struct wmi_block *wblock, *next; 800 struct wmi_block *wblock, *next;
801 801
802 list_for_each_entry_safe(wblock, next, &wmi_blocks.list, list) { 802 list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
803 list_del(&wblock->list); 803 list_del(&wblock->list);
804 kfree(wblock); 804 kfree(wblock);
805 } 805 }
@@ -864,7 +864,7 @@ static acpi_status parse_wdg(acpi_handle handle)
864 wblock->handler = wmi_notify_debug; 864 wblock->handler = wmi_notify_debug;
865 wmi_method_enable(wblock, 1); 865 wmi_method_enable(wblock, 1);
866 } 866 }
867 list_add_tail(&wblock->list, &wmi_blocks.list); 867 list_add_tail(&wblock->list, &wmi_block_list);
868 } 868 }
869 869
870out_free_pointer: 870out_free_pointer:
@@ -927,7 +927,7 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event)
927 struct list_head *p; 927 struct list_head *p;
928 char guid_string[37]; 928 char guid_string[37];
929 929
930 list_for_each(p, &wmi_blocks.list) { 930 list_for_each(p, &wmi_block_list) {
931 wblock = list_entry(p, struct wmi_block, list); 931 wblock = list_entry(p, struct wmi_block, list);
932 block = &wblock->gblock; 932 block = &wblock->gblock;
933 933
@@ -987,8 +987,6 @@ static int __init acpi_wmi_init(void)
987{ 987{
988 int result; 988 int result;
989 989
990 INIT_LIST_HEAD(&wmi_blocks.list);
991
992 if (acpi_disabled) 990 if (acpi_disabled)
993 return -ENODEV; 991 return -ENODEV;
994 992