Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202482
b: refs/heads/master
c: 7677fbd
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Matthew Garrett committed Aug 3, 2010
1 parent 7d0825e commit 2e58d83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 669048639ca6d3fdfb2e75dd77b8f49434d57625
refs/heads/master: 7677fbdff16f5b817bc3dc5d194a8b3350f8f9cb
24 changes: 16 additions & 8 deletions trunk/drivers/platform/x86/acer-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ static acpi_status AMW0_find_mailled(void)
obj->buffer.length == sizeof(struct wmab_ret)) {
ret = *((struct wmab_ret *) obj->buffer.pointer);
} else {
kfree(out.pointer);
return AE_ERROR;
}

Expand All @@ -570,7 +571,7 @@ static acpi_status AMW0_set_capabilities(void)
{
struct wmab_args args;
struct wmab_ret ret;
acpi_status status = AE_OK;
acpi_status status;
struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;

Expand All @@ -593,12 +594,13 @@ static acpi_status AMW0_set_capabilities(void)
if (ACPI_FAILURE(status))
return status;

obj = (union acpi_object *) out.pointer;
obj = out.pointer;
if (obj && obj->type == ACPI_TYPE_BUFFER &&
obj->buffer.length == sizeof(struct wmab_ret)) {
ret = *((struct wmab_ret *) obj->buffer.pointer);
} else {
return AE_ERROR;
status = AE_ERROR;
goto out;
}

if (ret.eax & 0x1)
Expand All @@ -607,23 +609,26 @@ static acpi_status AMW0_set_capabilities(void)
args.ebx = 2 << 8;
args.ebx |= ACER_AMW0_BLUETOOTH_MASK;

/*
* It's ok to use existing buffer for next wmab_execute call.
* But we need to kfree(out.pointer) if next wmab_execute fail.
*/
status = wmab_execute(&args, &out);
if (ACPI_FAILURE(status))
return status;
goto out;

obj = (union acpi_object *) out.pointer;
if (obj && obj->type == ACPI_TYPE_BUFFER
&& obj->buffer.length == sizeof(struct wmab_ret)) {
ret = *((struct wmab_ret *) obj->buffer.pointer);
} else {
return AE_ERROR;
status = AE_ERROR;
goto out;
}

if (ret.eax & 0x1)
interface->capability |= ACER_CAP_BLUETOOTH;

kfree(out.pointer);

/*
* This appears to be safe to enable, since all Wistron based laptops
* appear to use the same EC register for brightness, even if they
Expand All @@ -632,7 +637,10 @@ static acpi_status AMW0_set_capabilities(void)
if (quirks->brightness >= 0)
interface->capability |= ACER_CAP_BRIGHTNESS;

return AE_OK;
status = AE_OK;
out:
kfree(out.pointer);
return status;
}

static struct wmi_interface AMW0_interface = {
Expand Down

0 comments on commit 2e58d83

Please sign in to comment.