WMI: remove EC region handler when _WDG parsing fails
PATCH 1/10 WMI: remove EC region handler when _WDG parsing fails
Driver initialization was forgetting to remove EC address space handler in cases when parse_wdg() method failed.
---
drivers/platform/x86/wmi.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/platform/x86/wmi.c +7 -2
@@ -968,12 +968,17 @@ static int acpi_wmi_add(struct acpi_device *device)ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler, NULL, NULL); -if (ACPI_FAILURE (status)) +if (ACPI_FAILURE (status)) { + printk(KERN_ERR PREFIX "Error installing EC region handler\n");return -ENODEV ; + } status =parse_wdg (device->handle);if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); +acpi_remove_address_space_handler (device->handle, +ACPI_ADR_SPACE_EC , + &acpi_wmi_ec_space_handler); + printk(KERN_ERR PREFIX "Failed to parse WDG method\n");return -ENODEV ; }
PATCH 2/10 WMI: free wmi blocks when parse_wdg() fails
---
drivers/platform/x86/wmi.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-)
drivers/platform/x86/wmi.c +15 -10
@@ -807,6 +807,16 @@ static bool guid_already_parsed(const char *guid_string)return false; } +static void free_wmi_blocks (void ) +{ +struct wmi_block *wblock, *next; + +list_for_each_entry_safe (wblock, next, &wmi_blocks.list, list) { +list_del (&wblock->list); +kfree (wblock); + } +} +/* * Parse the _WDG method for the GUID data blocks */
@@ -865,7 +875,7 @@ static acpi_status parse_wdg(acpi_handle handle) wblock->handle = handle;if (debug_event) { wblock->handler = wmi_notify_debug; - status =wmi_method_enable (wblock,1 ); +wmi_method_enable (wblock,1 ); }list_add_tail (&wblock->list, &wmi_blocks.list); }
@@ -875,6 +885,9 @@ out_free_gblock: out_free_pointer:kfree (out.pointer); +if (ACPI_FAILURE (status)) +free_wmi_blocks (); +return status; }
@@ -1014,19 +1027,11 @@ static int __init acpi_wmi_init(void) static void __exit acpi_wmi_exit(void) { -struct list_head *p, *tmp; -struct wmi_block *wblock; -wmi_class_exit ();acpi_bus_unregister_driver (&acpi_wmi_driver); -list_for_each_safe (p, tmp, &wmi_blocks.list) { - wblock = list_entry(p, struct wmi_block, list); - -list_del (p); -kfree (wblock); - } +free_wmi_blocks (); printk(KERN_INFO PREFIX "Mapper unloaded\n"); }
Re: [PATCH 02/10] WMI: free wmi blocks when parse_wdg() fails
Quoted 1 line · On Thursday 26 August 2010 08:14:48 Dmitry Torokhov wrote:
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 66 lines
---
drivers/platform/x86/wmi.c | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-)drivers/platform/x86/wmi.c +15
-10@@ -807,6 +807,16 @@ static bool guid_already_parsed(const char *guid_string) return false; } +static void free_wmi_blocks (void ) +{ +struct wmi_block *wblock, *next; + +list_for_each_entry_safe (wblock, next, &wmi_blocks.list, list) { +list_del (&wblock->list); +kfree (wblock); + } +} +/* * Parse the _WDG method for the GUID data blocks */ @@ -865,7 +875,7 @@ static acpi_status parse_wdg(acpi_handle handle) wblock->handle = handle;if (debug_event) { wblock->handler = wmi_notify_debug; - status =wmi_method_enable (wblock,1 ); +wmi_method_enable (wblock,1 ); }list_add_tail (&wblock->list, &wmi_blocks.list); }@@ -875,6 +885,9 @@ out_free_gblock: out_free_pointer:kfree (out.pointer); +if (ACPI_FAILURE (status)) +free_wmi_blocks (); +return status; }@@ -1014,19 +1027,11 @@ static int __init acpi_wmi_init(void) static void __exit acpi_wmi_exit(void) { -struct list_head *p, *tmp; -struct wmi_block *wblock; -wmi_class_exit ();acpi_bus_unregister_driver (&acpi_wmi_driver); -list_for_each_safe (p, tmp, &wmi_blocks.list) { - wblock = list_entry(p, struct wmi_block, list); - -list_del (p); -kfree (wblock); - } +free_wmi_blocks (); printk(KERN_INFO PREFIX "Mapper unloaded\n"); }
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 3/10 WMI: fix wmi_gtoa() to actully terminate the string
In reply to Dmitry TorokhovCourtesy of sparse...
---
drivers/platform/x86/wmi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/wmi.c +1 -1
@@ -232,7 +232,7 @@ static int wmi_gtoa(const char *in, char *out)for (i =10 ; i <=15 ; i++) out +=sprintf (out,"%02X" , in[i] &0xFF ); - out ='\0' ; + *out ='\0' ;return 0 ; }
Re: [PATCH 03/10] WMI: fix wmi_gtoa() to actully terminate the string
Quoted 3 lines · On Thursday 26 August 2010 08:14:53 Dmitry Torokhov wrote:
Courtesy of sparse...
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 17 lines
---
drivers/platform/x86/wmi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/platform/x86/wmi.c +1
-1@@ -232,7 +232,7 @@ static int wmi_gtoa(const char *in, char *out)for (i =10 ; i <=15 ; i++) out +=sprintf (out,"%02X" , in[i] &0xFF ); - out ='\0' ; + *out ='\0' ;return 0 ; }
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 4/10 WMI: do not leak memory in parse_wdg()
In reply to Dmitry TorokhovIf we _WDG returned object that is not buffer we were forgetting to free memory allocated for that object.
---
drivers/platform/x86/wmi.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/platform/x86/wmi.c +4 -2
@@ -837,8 +837,10 @@ static acpi_status parse_wdg(acpi_handle handle) obj = (union acpi_object *) out.pointer; -if (obj->type !=ACPI_TYPE_BUFFER ) -return AE_ERROR ; +if (obj->type !=ACPI_TYPE_BUFFER ) { + status =AE_ERROR ; + goto out_free_pointer; + } total = obj->buffer.length /sizeof (struct guid_block );
Re: [PATCH 04/10] WMI: do not leak memory in parse_wdg()
Quoted 4 lines · On Thursday 26 August 2010 08:14:58 Dmitry Torokhov wrote:
If we
_WDGreturned object that is not buffer we were forgetting to free memory allocated for that object.Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 21 lines
---
drivers/platform/x86/wmi.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)drivers/platform/x86/wmi.c +4
-2@@ -837,8 +837,10 @@ static acpi_status parse_wdg(acpi_handle handle) obj = (union acpi_object *) out.pointer; -if (obj->type !=ACPI_TYPE_BUFFER ) -return AE_ERROR ; +if (obj->type !=ACPI_TYPE_BUFFER ) { + status =AE_ERROR ; + goto out_free_pointer; + } total = obj->buffer.length /sizeof (struct guid_block );
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 5/10 WMI: fix potential NULL pointer dereference
In reply to Dmitry Torokhov---
drivers/platform/x86/wmi.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/platform/x86/wmi.c +2 -0
@@ -836,6 +836,8 @@ static acpi_status parse_wdg(acpi_handle handle)return status; obj = (union acpi_object *) out.pointer; +if (!obj) +return AE_ERROR ;if (obj->type !=ACPI_TYPE_BUFFER ) { status =AE_ERROR ;
Re: [PATCH 05/10] WMI: fix potential NULL pointer dereference
Quoted 1 line · On Thursday 26 August 2010 08:15:03 Dmitry Torokhov wrote:
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 18 lines
---
drivers/platform/x86/wmi.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/platform/x86/wmi.c +2
-0@@ -836,6 +836,8 @@ static acpi_status parse_wdg(acpi_handle handle)return status; obj = (union acpi_object *) out.pointer; +if (!obj) +return AE_ERROR ;if (obj->type !=ACPI_TYPE_BUFFER ) { status =AE_ERROR ;
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 6/10 WMI: simplify handling of returned WMI blocks in parse_wdg()
In reply to Dmitry TorokhovThere is no reason why we allocate memory and copy data into an intermediate buffer, it is not like we are working with data coming from userspace.
---
drivers/platform/x86/wmi.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/platform/x86/wmi.c +4 -11
@@ -487,7 +487,7 @@ const struct acpi_buffer *in) }EXPORT_SYMBOL_GPL (wmi_set_block); -static void wmi_dump_wdg (struct guid_block *g) +static void wmi_dump_wdg (const struct guid_block *g) {char guid_string[37 ];
@@ -824,7 +824,7 @@ static acpi_status parse_wdg(acpi_handle handle) {struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER ,NULL };union acpi_object *obj; -struct guid_block *gblock; +const struct guid_block *gblock;struct wmi_block *wblock;char guid_string[37 ];acpi_status status;
@@ -844,14 +844,9 @@ static acpi_status parse_wdg(acpi_handle handle) goto out_free_pointer; } + gblock = (const struct guid_block *)obj->buffer.pointer; total = obj->buffer.length /sizeof (struct guid_block ); - gblock =kmemdup (obj->buffer.pointer, obj->buffer.length,GFP_KERNEL ); -if (!gblock) { - status =AE_NO_MEMORY ; - goto out_free_pointer; - } -for (i =0 ; i < total; i++) {/* Some WMI devices, like those for nVidia hooks, have a
@@ -872,7 +867,7 @@ static acpi_status parse_wdg(acpi_handle handle) wblock =kzalloc (sizeof (struct wmi_block ),GFP_KERNEL );if (!wblock) { status =AE_NO_MEMORY ; - goto out_free_gblock; + goto out_free_pointer; } wblock->gblock = gblock[i];
@@ -884,8 +879,6 @@ static acpi_status parse_wdg(acpi_handle handle)list_add_tail (&wblock->list, &wmi_blocks.list); } -out_free_gblock: -kfree (gblock); out_free_pointer:kfree (out.pointer);
Re: [PATCH 06/10] WMI: simplify handling of returned WMI blocks in parse_wdg()
Quoted 5 lines · On Thursday 26 August 2010 08:15:09 Dmitry Torokhov wrote:
There is no reason why we allocate memory and copy data into an intermediate buffer, it is not like we are working with data coming from userspace.
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 66 lines
---
drivers/platform/x86/wmi.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)drivers/platform/x86/wmi.c +4
-12@@ -487,7 +487,7 @@ const struct acpi_buffer *in) }EXPORT_SYMBOL_GPL (wmi_set_block); -static void wmi_dump_wdg (struct guid_block *g) +static void wmi_dump_wdg (const struct guid_block *g) {char guid_string[37 ];@@ -824,7 +824,7 @@ static acpi_status parse_wdg(acpi_handle handle) {struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER ,NULL };union acpi_object *obj; -struct guid_block *gblock; +const struct guid_block *gblock;struct wmi_block *wblock;char guid_string[37 ];acpi_status status;@@ -844,14 +844,9 @@ static acpi_status parse_wdg(acpi_handle handle) goto out_free_pointer; } + gblock = (const struct guid_block *)obj->buffer.pointer; total = obj->buffer.length /sizeof (struct guid_block ); - gblock =kmemdup (obj->buffer.pointer, obj->buffer.length,GFP_KERNEL ); -if (!gblock) { - status =AE_NO_MEMORY ; - goto out_free_pointer; - } -for (i =0 ; i < total; i++) {/* Some WMI devices, like those for nVidia hooks, have a @@ -872,7 +867,7 @@ static acpi_status parse_wdg(acpi_handle handle) wblock =kzalloc (sizeof (struct wmi_block ),GFP_KERNEL );if (!wblock) { status =AE_NO_MEMORY ; - goto out_free_gblock; + goto out_free_pointer; } wblock->gblock = gblock[i];@@ -884,8 +879,6 @@ static acpi_status parse_wdg(acpi_handle handle)list_add_tail (&wblock->list, &wmi_blocks.list); } -out_free_gblock: -kfree (gblock); out_free_pointer:kfree (out.pointer); --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 7/10 WMI: use separate list head for storing wmi blocks
In reply to Dmitry TorokhovDo not abuse wmi_block structure to hold the head of list of blocks, use separate list_head for that.
---
drivers/platform/x86/wmi.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-)
drivers/platform/x86/wmi.c +9 -11
@@ -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 ;
Re: [PATCH 07/10] WMI: use separate list head for storing wmi blocks
Quoted 4 lines · On Thursday 26 August 2010 08:15:14 Dmitry Torokhov wrote:
Do not abuse
wmi_blockstructure to hold the head of list of blocks, use separatelist_headfor that.Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 105 lines
---
drivers/platform/x86/wmi.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-)drivers/platform/x86/wmi.c +9
-11@@ -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 ;
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 8/10 WMI: use pr_err() and friends
In reply to Dmitry TorokhovThis makes source more concise and easier to read.
---
drivers/platform/x86/wmi.c | 64 ++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 35 deletions(-)
drivers/platform/x86/wmi.c +29 -35
@@ -27,6 +27,8 @@* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h>
@@ -44,8 +46,6 @@ MODULE_LICENSE("GPL");#define ACPI_WMI_CLASS "wmi" -#define PREFIX "ACPI: WMI: " -static DEFINE_MUTEX (wmi_data_lock);static LIST_HEAD (wmi_block_list);
@@ -492,25 +492,24 @@ static void wmi_dump_wdg(const struct guid_block *g)char guid_string[37 ];wmi_gtoa (g->guid, guid_string); - printk(KERN_INFO PREFIX "%s:\n", guid_string); - printk(KERN_INFO PREFIX "\tobject_id: %c%c\n", - g->object_id[0], g->object_id[1]); - printk(KERN_INFO PREFIX "\tnotify_id: %02X\n", g->notify_id); - printk(KERN_INFO PREFIX "\treserved: %02X\n", g->reserved); - printk(KERN_INFO PREFIX "\tinstance_count: %d\n", g->instance_count); - printk(KERN_INFO PREFIX "\tflags: %#x", g->flags); + +pr_info ("%s:\n" , guid_string); +pr_info ("\tobject_id: %c%c\n" , g->object_id[0 ], g->object_id[1 ]); +pr_info ("\tnotify_id: %02X\n" , g->notify_id); +pr_info ("\treserved: %02X\n" , g->reserved); +pr_info ("\tinstance_count: %d\n" , g->instance_count); +pr_info ("\tflags: %#x " , g->flags);if (g->flags) { -printk (" " );if (g->flags &ACPI_WMI_EXPENSIVE ) -printk ("ACPI_WMI_EXPENSIVE " ); +pr_cont ("ACPI_WMI_EXPENSIVE " );if (g->flags &ACPI_WMI_METHOD ) -printk ("ACPI_WMI_METHOD " ); +pr_cont ("ACPI_WMI_METHOD " );if (g->flags &ACPI_WMI_STRING ) -printk ("ACPI_WMI_STRING " ); +pr_cont ("ACPI_WMI_STRING " );if (g->flags &ACPI_WMI_EVENT ) -printk ("ACPI_WMI_EVENT " ); +pr_cont ("ACPI_WMI_EVENT " ); } -printk ("\n" ); +pr_cont ("\n" ); }
@@ -522,7 +521,7 @@ static void wmi_notify_debug(u32 value, void *context) status =wmi_get_event_data (value, &response);if (status !=AE_OK ) { -printk (KERN_INFO "wmi: bad event status 0x%x\n" , status); +pr_info ("bad event status 0x%x\n" , status);return ; }
@@ -531,22 +530,22 @@ static void wmi_notify_debug(u32 value, void *context)if (!obj)return ; - printk(KERN_INFO PREFIX "DEBUG Event "); +pr_info ("DEBUG Event " );switch (obj->type) {case ACPI_TYPE_BUFFER : -printk ("BUFFER_TYPE - length %d\n" , obj->buffer.length); +pr_cont ("BUFFER_TYPE - length %d\n" , obj->buffer.length);break ;case ACPI_TYPE_STRING : -printk ("STRING_TYPE - %s\n" , obj->string.pointer); +pr_cont ("STRING_TYPE - %s\n" , obj->string.pointer);break ;case ACPI_TYPE_INTEGER : -printk ("INTEGER_TYPE - %llu\n" , obj->integer.value); +pr_cont ("INTEGER_TYPE - %llu\n" , obj->integer.value);break ;case ACPI_TYPE_PACKAGE : -printk ("PACKAGE_TYPE - %d elements\n" , obj->package.count); +pr_cont ("PACKAGE_TYPE - %d elements\n" , obj->package.count);break ;default : -printk ("object type 0x%X\n" , obj->type); +pr_cont ("object type 0x%X\n" , obj->type); }kfree (obj); }
@@ -857,8 +856,7 @@ static acpi_status parse_wdg(acpi_handle handle)*/ if (guid_already_parsed (gblock[i].guid) == true) {wmi_gtoa (gblock[i].guid, guid_string); - printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n", - guid_string); +pr_info ("Skipping duplicate GUID %s\n" , guid_string);continue ; }if (debug_dump_wdg)
@@ -949,8 +947,7 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event) wblock->handler (event, wblock->handler_data);if (debug_event) {wmi_gtoa (wblock->gblock.guid, guid_string); - printk(KERN_INFO PREFIX "DEBUG Event GUID:" - " %s\n", guid_string); +pr_info ("DEBUG Event GUID: %s\n" , guid_string); } acpi_bus_generate_netlink_event(
@@ -979,7 +976,7 @@ static int acpi_wmi_add(struct acpi_device *device) &acpi_wmi_ec_space_handler, NULL, NULL);if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); +pr_err ("Error installing EC region handler\n" );return -ENODEV ; }
@@ -988,7 +985,7 @@ static int acpi_wmi_add(struct acpi_device *device)acpi_remove_address_space_handler (device->handle,ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler); - printk(KERN_ERR PREFIX "Failed to parse WDG method\n"); +pr_err ("Failed to parse WDG method\n" );return -ENODEV ; }
@@ -1003,9 +1000,8 @@ static int __init acpi_wmi_init(void)return -ENODEV ; result =acpi_bus_register_driver (&acpi_wmi_driver); -if (result <0 ) { - printk(KERN_INFO PREFIX "Error loading mapper\n"); +pr_err ("Error loading mapper\n" );return -ENODEV ; }
@@ -1015,20 +1011,18 @@ static int __init acpi_wmi_init(void)return result; } - printk(KERN_INFO PREFIX "Mapper loaded\n"); +pr_info ("Mapper loaded\n" ); -return result; +return 0 ; } static void __exit acpi_wmi_exit(void) {wmi_class_exit (); -acpi_bus_unregister_driver (&acpi_wmi_driver); -free_wmi_blocks (); - printk(KERN_INFO PREFIX "Mapper unloaded\n"); +pr_info ("Mapper unloaded\n" ); }subsys_initcall (acpi_wmi_init);
Re: [PATCH 08/10] WMI: use pr_err() and friends
Quoted 3 lines · On Thursday 26 August 2010 08:15:19 Dmitry Torokhov wrote:
This makes source more concise and easier to read.
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 183 lines
---
drivers/platform/x86/wmi.c | 64++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 35 deletions(-)
drivers/platform/x86/wmi.c +0
-0@@ -27,6 +27,8 @@* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/drivers/platform/x86/wmi.c +29
-36+#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h> @@ -44,8 +46,6 @@ MODULE_LICENSE("GPL");#define ACPI_WMI_CLASS "wmi" -#define PREFIX "ACPI: WMI: " -static DEFINE_MUTEX (wmi_data_lock);static LIST_HEAD (wmi_block_list);@@ -492,25 +492,24 @@ static void wmi_dump_wdg(const struct guid_block *g)char guid_string[37 ];wmi_gtoa (g->guid, guid_string); - printk(KERN_INFO PREFIX "%s:\n", guid_string); - printk(KERN_INFO PREFIX "\tobject_id: %c%c\n", - g->object_id[0], g->object_id[1]); - printk(KERN_INFO PREFIX "\tnotify_id: %02X\n", g->notify_id); - printk(KERN_INFO PREFIX "\treserved: %02X\n", g->reserved); - printk(KERN_INFO PREFIX "\tinstance_count: %d\n", g->instance_count); - printk(KERN_INFO PREFIX "\tflags: %#x", g->flags); + +pr_info ("%s:\n" , guid_string); +pr_info ("\tobject_id: %c%c\n" , g->object_id[0 ], g->object_id[1 ]); +pr_info ("\tnotify_id: %02X\n" , g->notify_id); +pr_info ("\treserved: %02X\n" , g->reserved); +pr_info ("\tinstance_count: %d\n" , g->instance_count); +pr_info ("\tflags: %#x " , g->flags);if (g->flags) { -printk (" " );if (g->flags &ACPI_WMI_EXPENSIVE ) -printk ("ACPI_WMI_EXPENSIVE " ); +pr_cont ("ACPI_WMI_EXPENSIVE " );if (g->flags &ACPI_WMI_METHOD ) -printk ("ACPI_WMI_METHOD " ); +pr_cont ("ACPI_WMI_METHOD " );if (g->flags &ACPI_WMI_STRING ) -printk ("ACPI_WMI_STRING " ); +pr_cont ("ACPI_WMI_STRING " );if (g->flags &ACPI_WMI_EVENT ) -printk ("ACPI_WMI_EVENT " ); +pr_cont ("ACPI_WMI_EVENT " ); } -printk ("\n" ); +pr_cont ("\n" ); }@@ -522,7 +521,7 @@ static void wmi_notify_debug(u32 value, void *context) status =wmi_get_event_data (value, &response);if (status !=AE_OK ) { -printk (KERN_INFO "wmi: bad event status 0x%x\n" , status); +pr_info ("bad event status 0x%x\n" , status);return ; }@@ -531,22 +530,22 @@ static void wmi_notify_debug(u32 value, void *context) if (!obj)return ; - printk(KERN_INFO PREFIX "DEBUG Event "); +pr_info ("DEBUG Event " );switch (obj->type) {case ACPI_TYPE_BUFFER : -printk ("BUFFER_TYPE - length %d\n" , obj->buffer.length); +pr_cont ("BUFFER_TYPE - length %d\n" , obj->buffer.length);break ;case ACPI_TYPE_STRING : -printk ("STRING_TYPE - %s\n" , obj->string.pointer); +pr_cont ("STRING_TYPE - %s\n" , obj->string.pointer);break ;case ACPI_TYPE_INTEGER : -printk ("INTEGER_TYPE - %llu\n" , obj->integer.value); +pr_cont ("INTEGER_TYPE - %llu\n" , obj->integer.value);break ;case ACPI_TYPE_PACKAGE : -printk ("PACKAGE_TYPE - %d elements\n" , obj->package.count); +pr_cont ("PACKAGE_TYPE - %d elements\n" , obj->package.count);break ;default : -printk ("object type 0x%X\n" , obj->type); +pr_cont ("object type 0x%X\n" , obj->type); }kfree (obj); }@@ -857,8 +856,7 @@ static acpi_status parse_wdg(acpi_handle handle)*/ if (guid_already_parsed (gblock[i].guid) == true) {wmi_gtoa (gblock[i].guid, guid_string); - printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n", - guid_string); +pr_info ("Skipping duplicate GUID %s\n" , guid_string);continue ; }if (debug_dump_wdg)@@ -949,8 +947,7 @@ static void acpi_wmi_notify(struct acpi_device *device, u32 event) wblock->handler(event, wblock->handler_data);if (debug_event) {wmi_gtoa (wblock->gblock.guid, guid_string); - printk(KERN_INFO PREFIX "DEBUG Event GUID:" - " %s\n", guid_string); +pr_info ("DEBUG Event GUID: %s\n" , guid_string); } acpi_bus_generate_netlink_event(@@ -979,7 +976,7 @@ static int acpi_wmi_add(struct acpi_device *device) &acpi_wmi_ec_space_handler, NULL, NULL);if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); +pr_err ("Error installing EC region handler\n" );return -ENODEV ; }@@ -988,7 +985,7 @@ static int acpi_wmi_add(struct acpi_device *device)acpi_remove_address_space_handler (device->handle,ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler); - printk(KERN_ERR PREFIX "Failed to parse WDG method\n"); +pr_err ("Failed to parse WDG method\n" );return -ENODEV ; }@@ -1003,9 +1000,8 @@ static int __init acpi_wmi_init(void)return -ENODEV ; result =acpi_bus_register_driver (&acpi_wmi_driver); -if (result <0 ) { - printk(KERN_INFO PREFIX "Error loading mapper\n"); +pr_err ("Error loading mapper\n" );return -ENODEV ; }@@ -1015,20 +1011,18 @@ static int __init acpi_wmi_init(void)return result; } - printk(KERN_INFO PREFIX "Mapper loaded\n"); +pr_info ("Mapper loaded\n" ); -return result; +return 0 ; } static void __exit acpi_wmi_exit(void) {wmi_class_exit (); -acpi_bus_unregister_driver (&acpi_wmi_driver); -free_wmi_blocks (); - printk(KERN_INFO PREFIX "Mapper unloaded\n"); +pr_info ("Mapper unloaded\n" ); }subsys_initcall (acpi_wmi_init); --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 9/10 WMI: make use of class device's attributres
In reply to Dmitry TorokhovInstead of adding modalias attribute manually set it up as class's device attribute so driver core will create and remove it for us.
---
drivers/platform/x86/wmi.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
drivers/platform/x86/wmi.c +7 -8
@@ -661,7 +661,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);/* * sysfs interface */ -static ssize_t show_modalias (struct device *dev,struct device_attribute *attr, +static ssize_t modalias_show (struct device *dev,struct device_attribute *attr,char *buf) {char guid_string[37 ];
@@ -675,7 +675,11 @@ static ssize_t show_modalias(struct device *dev, struct device_attribute *attr,return sprintf (buf,"wmi:%s\n" , guid_string); } -static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); + +static struct device_attribute wmi_dev_attrs[] = { +__ATTR_RO (modalias), + __ATTR_NULL +};static int wmi_dev_uevent (struct device *dev,struct kobj_uevent_env *env) {
@@ -708,6 +712,7 @@ static struct class wmi_class = { .name = "wmi", .dev_release = wmi_dev_free, .dev_uevent = wmi_dev_uevent, + .dev_attrs = wmi_dev_attrs, };static int wmi_create_devs (void )
@@ -740,10 +745,6 @@ static int wmi_create_devs(void) result =device_register (guid_dev);if (result)return result; - - result =device_create_file (guid_dev, &dev_attr_modalias); -if (result) -return result; }return 0 ;
@@ -763,8 +764,6 @@ static void wmi_remove_devs(void) guid_dev = wblock->dev; gblock = &wblock->gblock; -device_remove_file (guid_dev, &dev_attr_modalias); -device_unregister (guid_dev); } }
Re: [PATCH 09/10] WMI: make use of class device's attributres
Quoted 4 lines · On Thursday 26 August 2010 08:15:25 Dmitry Torokhov wrote:
Instead of adding modalias attribute manually set it up as class's device attribute so driver core will create and remove it for us.
Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 65 lines
---
drivers/platform/x86/wmi.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)drivers/platform/x86/wmi.c +5
-2@@ -661,7 +661,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);/* * sysfs interface */ -static ssize_t show_modalias (struct device *dev,struct device_attribute *attr, +static ssize_t modalias_show(struct device *dev, structdevice_attribute *attr,char *buf) {char guid_string[37 ];@@ -675,7 +675,11 @@ static ssize_t show_modalias(struct device *dev,struct device_attribute *attr, return sprintf(buf, "wmi:%s\n", guid_string); } -static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); + +static struct device_attribute wmi_dev_attrs[] = { +__ATTR_RO (modalias), + __ATTR_NULL +};static int wmi_dev_uevent (struct device *dev,struct kobj_uevent_env *env){
drivers/platform/x86/wmi.c +1
-7@@ -708,6 +712,7 @@ static struct class wmi_class = { .name = "wmi", .dev_release = wmi_dev_free, .dev_uevent = wmi_dev_uevent, + .dev_attrs = wmi_dev_attrs, };static int wmi_create_devs (void )@@ -740,10 +745,6 @@ static int wmi_create_devs(void) result =device_register (guid_dev);if (result)return result; - - result =device_create_file (guid_dev, &dev_attr_modalias); -if (result) -return result; }return 0 ;@@ -763,8 +764,6 @@ static void wmi_remove_devs(void) guid_dev = wblock->dev; gblock = &wblock->gblock; -device_remove_file (guid_dev, &dev_attr_modalias); -device_unregister (guid_dev); } } --To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
PATCH 10/10 WMI: embed struct device directly into wmi_block
In reply to Dmitry TorokhovInstead of creating wmi_blocks and then register corresponding devices on a separate pass do it all in one shot, since lifetime rules for both objects are the same. This also takes care of leaking devices when device_create fails for one of them.
---
drivers/platform/x86/wmi.c | 176 ++++++++++++++++---------------------------- 1 files changed, 65 insertions(+), 111 deletions(-)
drivers/platform/x86/wmi.c +65 -111
@@ -68,7 +68,7 @@ struct wmi_block {acpi_handle handle;wmi_notify_handler handler;void *handler_data; -struct device *dev; +struct device dev; };
@@ -110,7 +110,7 @@ static struct acpi_driver acpi_wmi_driver = { .add = acpi_wmi_add, .remove = acpi_wmi_remove, .notify = acpi_wmi_notify, - }, + }, };/*
@@ -705,7 +705,9 @@ static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)static void wmi_dev_free (struct device *dev) { -kfree (dev); + struct wmi_block *wmi_block = container_of(dev, struct wmi_block, dev); + +kfree (wmi_block); }static struct class wmi_class = {
@@ -715,104 +717,60 @@ static struct class wmi_class = { .dev_attrs = wmi_dev_attrs, }; -static int wmi_create_devs (void ) +static struct wmi_block *wmi_create_device (const struct guid_block *gblock, +acpi_handle handle) { -int result; -char guid_string[37 ]; -struct guid_block *gblock;struct wmi_block *wblock; -struct list_head *p; -struct device *guid_dev; +int error; +char guid_string[37 ]; -/* Create devices for all the GUIDs */ -list_for_each (p, &wmi_block_list) { - wblock = list_entry(p, struct wmi_block, list); + wblock =kzalloc (sizeof (struct wmi_block ),GFP_KERNEL ); +if (!wblock) { + error = -ENOMEM ; + goto err_out; + } - guid_dev =kzalloc (sizeof (struct device ),GFP_KERNEL ); -if (!guid_dev) -return -ENOMEM ; + wblock->handle = handle; + wblock->gblock = *gblock; - wblock->dev = guid_dev; + wblock->dev.class = &wmi_class; - guid_dev->class = &wmi_class; -dev_set_drvdata (guid_dev, wblock); +wmi_gtoa (gblock->guid, guid_string); +dev_set_name (&wblock->dev, guid_string); - gblock = &wblock->gblock; +dev_set_drvdata (&wblock->dev, wblock); -wmi_gtoa (gblock->guid, guid_string); -dev_set_name (guid_dev, guid_string); + error =device_register (&wblock->dev); +if (error) + goto err_free; - result =device_register (guid_dev); -if (result) -return result; - } +list_add_tail (&wblock->list, &wmi_block_list); +return wblock; -return 0 ; +err_free: +kfree (wblock); +err_out: +return ERR_PTR (error); } -static void wmi_remove_devs (void ) +static void wmi_free_devices (void ) { -struct guid_block *gblock; -struct wmi_block *wblock; -struct list_head *p; -struct device *guid_dev; +struct wmi_block *wblock, *next;/* Delete devices for all the GUIDs */ -list_for_each (p, &wmi_block_list) { - wblock = list_entry(p, struct wmi_block, list); - - guid_dev = wblock->dev; - gblock = &wblock->gblock; - -device_unregister (guid_dev); - } -} - -static void wmi_class_exit (void ) -{ -wmi_remove_devs (); -class_unregister (&wmi_class); -} - -static int wmi_class_init (void ) -{ -int ret; - - ret =class_register (&wmi_class); -if (ret) -return ret; - - ret =wmi_create_devs (); -if (ret) -wmi_class_exit (); - -return ret; +list_for_each_entry_safe (wblock, next, &wmi_block_list, list) +device_unregister (&wblock->dev); }static bool guid_already_parsed (const char *guid_string) { -struct guid_block *gblock;struct wmi_block *wblock; -struct list_head *p; - -list_for_each (p, &wmi_block_list) { - wblock = list_entry(p, struct wmi_block, list); - gblock = &wblock->gblock; -if (strncmp (gblock->guid, guid_string,16 ) ==0 ) +list_for_each_entry (wblock, &wmi_block_list, list) +if (strncmp (wblock->gblock.guid, guid_string,16 ) ==0 )return true; - } -return false; -} -static void free_wmi_blocks (void ) -{ -struct wmi_block *wblock, *next; - -list_for_each_entry_safe (wblock, next, &wmi_block_list, list) { -list_del (&wblock->list); -kfree (wblock); - } +return false; }/*
@@ -826,19 +784,19 @@ static acpi_status parse_wdg(acpi_handle handle)struct wmi_block *wblock;char guid_string[37 ];acpi_status status; +int retval;u32 i, total; status =acpi_evaluate_object (handle,"_WDG" ,NULL , &out); -if (ACPI_FAILURE (status)) -return status; +return -ENXIO ; obj = (union acpi_object *) out.pointer;if (!obj) -return AE_ERROR ; +return -ENXIO ;if (obj->type !=ACPI_TYPE_BUFFER ) { - status =AE_ERROR ; + retval = -ENXIO ; goto out_free_pointer; }
@@ -858,31 +816,29 @@ static acpi_status parse_wdg(acpi_handle handle)pr_info ("Skipping duplicate GUID %s\n" , guid_string);continue ; } +if (debug_dump_wdg)wmi_dump_wdg (&gblock[i]); - wblock =kzalloc (sizeof (struct wmi_block ),GFP_KERNEL ); -if (!wblock) { - status =AE_NO_MEMORY ; - goto out_free_pointer; + wblock =wmi_create_device (&gblock[i], handle); +if (IS_ERR (wblock)) { + retval =PTR_ERR (wblock); +wmi_free_devices (); +break ; } - wblock->gblock = gblock[i]; - wblock->handle = handle;if (debug_event) { wblock->handler = wmi_notify_debug;wmi_method_enable (wblock,1 ); } -list_add_tail (&wblock->list, &wmi_block_list); } + retval =0 ; + out_free_pointer:kfree (out.pointer); -if (ACPI_FAILURE (status)) -free_wmi_blocks (); - -return status; +return retval; }/*
@@ -961,6 +917,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type) {acpi_remove_address_space_handler (device->handle,ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler); +wmi_free_devices ();return 0 ; }
@@ -968,7 +925,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)static int acpi_wmi_add (struct acpi_device *device) {acpi_status status; -int result =0 ; +int error; status = acpi_install_address_space_handler(device->handle, ACPI_ADR_SPACE_EC,
@@ -979,47 +936,44 @@ static int acpi_wmi_add(struct acpi_device *device)return -ENODEV ; } - status =parse_wdg (device->handle); -if (ACPI_FAILURE (status)) { + error =parse_wdg (device->handle); +if (error) {acpi_remove_address_space_handler (device->handle,ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler);pr_err ("Failed to parse WDG method\n" ); -return -ENODEV ; +return error; } -return result; +return 0 ; }static int __init acpi_wmi_init (void ) { -int result; +int error;if (acpi_disabled)return -ENODEV ; - result =acpi_bus_register_driver (&acpi_wmi_driver); -if (result <0 ) { -pr_err ("Error loading mapper\n" ); -return -ENODEV ; - } + error =class_register (&wmi_class); +if (error) +return error; - result =wmi_class_init (); -if (result) { -acpi_bus_unregister_driver (&acpi_wmi_driver); -return result; + error =acpi_bus_register_driver (&acpi_wmi_driver); +if (error) { +pr_err ("Error loading mapper\n" ); +class_unregister (&wmi_class); +return error; }pr_info ("Mapper loaded\n" ); -return 0 ; } static void __exit acpi_wmi_exit(void) { -wmi_class_exit ();acpi_bus_unregister_driver (&acpi_wmi_driver); -free_wmi_blocks (); +class_unregister (&wmi_class);pr_info ("Mapper unloaded\n" ); }
Quoted 4 lines · Dmitry Torokhov
Driver initialization was forgetting to remove EC address space handler in cases when
parse_wdg()method failed.Signed-off-by Dmitry Torokhov <[email protected]>
*PING* for this and the other 9 in these series...
Thanks.
Quoted 30 lines
---
drivers/platform/x86/wmi.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/platform/x86/wmi.c +7
-2@@ -968,12 +968,17 @@ static int acpi_wmi_add(struct acpi_device *device)ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler, NULL, NULL); -if (ACPI_FAILURE (status)) +if (ACPI_FAILURE (status)) { + printk(KERN_ERR PREFIX "Error installing EC region handler\n");return -ENODEV ; + } status =parse_wdg (device->handle);if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); +acpi_remove_address_space_handler (device->handle, +ACPI_ADR_SPACE_EC , + &acpi_wmi_ec_space_handler); + printk(KERN_ERR PREFIX "Failed to parse WDG method\n");return -ENODEV ; }
Signature · 1 line
Dmitry
Quoted 4 lines · On Thursday 26 August 2010 08:14:42 Dmitry Torokhov wrote:
Driver initialization was forgetting to remove EC address space handler in cases when
parse_wdg()method failed.Signed-off-by Dmitry Torokhov <[email protected]>
Quoted 28 lines
---
drivers/platform/x86/wmi.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/platform/x86/wmi.c +7
-2@@ -968,12 +968,17 @@ static int acpi_wmi_add(struct acpi_device *device)ACPI_ADR_SPACE_EC , &acpi_wmi_ec_space_handler, NULL, NULL); -if (ACPI_FAILURE (status)) +if (ACPI_FAILURE (status)) { + printk(KERN_ERR PREFIX "Error installing EC region handler\n");return -ENODEV ; + } status =parse_wdg (device->handle);if (ACPI_FAILURE (status)) { - printk(KERN_ERR PREFIX "Error installing EC region handler\n"); +acpi_remove_address_space_handler (device->handle, +ACPI_ADR_SPACE_EC , + &acpi_wmi_ec_space_handler); + printk(KERN_ERR PREFIX "Failed to parse WDG method\n");return -ENODEV ; }
Signature · 3 lines
E-Mail: [email protected] Web: strangeworlds.co.uk GPG Key ID: 0x23EE722D
Quoted 8 lines · Carlos Corbacho
Quoted 4 lines · On Thursday 26 August 2010 08:14:42 Dmitry Torokhov wrote:
Driver initialization was forgetting to remove EC address space handler in cases when
parse_wdg()method failed.Signed-off-by Dmitry Torokhov <[email protected]>Acked-by Carlos Corbacho <[email protected]>
Matthew,
Do you need me to resend the series with Carlos's acks?
Thanks.
Signature · 1 line
Dmitry