Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223661
b: refs/heads/master
c: ff5dd32
h: refs/heads/master
i:
  223659: 8da6b4f
v: v3
  • Loading branch information
Jeff Garzik authored and Jeff Garzik committed Dec 27, 2010
1 parent b716ce7 commit 7fe2b95
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 64 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: bbbcde9d9614683fbeb41f00728cfbfb7f75a7ad
refs/heads/master: ff5dd32b997a5a5ce3f4256257991133d694da0b
3 changes: 0 additions & 3 deletions trunk/drivers/acpi/acpica/evgpeinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,6 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
return_ACPI_STATUS(AE_OK);
}

/* Disable the GPE in case it's been enabled already. */
(void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);

/*
* Add the GPE information from above to the gpe_event_info block for
* use during dispatch of this GPE.
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ struct acpi_battery {
unsigned long flags;
};

static int acpi_battery_update(struct acpi_battery *battery);

#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);

inline int acpi_battery_present(struct acpi_battery *battery)
Expand Down Expand Up @@ -184,6 +186,9 @@ static int acpi_battery_get_property(struct power_supply *psy,
int ret = 0;
struct acpi_battery *battery = to_acpi_battery(psy);

if (acpi_battery_update(battery))
return -ENODEV;

if (acpi_battery_present(battery)) {
/* run battery update only if it is present */
acpi_battery_get_state(battery);
Expand Down
97 changes: 37 additions & 60 deletions trunk/drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,85 +705,54 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device)
}

static acpi_status
acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
struct acpi_device_wakeup *wakeup)
acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device,
union acpi_object *package)
{
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *package = NULL;
union acpi_object *element = NULL;
acpi_status status;
int i = 0;
union acpi_object *element = NULL;

if (!wakeup)
if (!device || !package || (package->package.count < 2))
return AE_BAD_PARAMETER;

/* _PRW */
status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW"));
return status;
}

package = (union acpi_object *)buffer.pointer;

if (!package || (package->package.count < 2)) {
status = AE_BAD_DATA;
goto out;
}

element = &(package->package.elements[0]);
if (!element) {
status = AE_BAD_DATA;
goto out;
}
if (!element)
return AE_BAD_PARAMETER;
if (element->type == ACPI_TYPE_PACKAGE) {
if ((element->package.count < 2) ||
(element->package.elements[0].type !=
ACPI_TYPE_LOCAL_REFERENCE)
|| (element->package.elements[1].type != ACPI_TYPE_INTEGER)) {
status = AE_BAD_DATA;
goto out;
}
wakeup->gpe_device =
|| (element->package.elements[1].type != ACPI_TYPE_INTEGER))
return AE_BAD_DATA;
device->wakeup.gpe_device =
element->package.elements[0].reference.handle;
wakeup->gpe_number =
device->wakeup.gpe_number =
(u32) element->package.elements[1].integer.value;
} else if (element->type == ACPI_TYPE_INTEGER) {
wakeup->gpe_device = NULL;
wakeup->gpe_number = element->integer.value;
} else {
status = AE_BAD_DATA;
goto out;
}
device->wakeup.gpe_number = element->integer.value;
} else
return AE_BAD_DATA;

element = &(package->package.elements[1]);
if (element->type != ACPI_TYPE_INTEGER) {
status = AE_BAD_DATA;
goto out;
return AE_BAD_DATA;
}
wakeup->sleep_state = element->integer.value;
device->wakeup.sleep_state = element->integer.value;

if ((package->package.count - 2) > ACPI_MAX_HANDLES) {
status = AE_NO_MEMORY;
goto out;
return AE_NO_MEMORY;
}
wakeup->resources.count = package->package.count - 2;
for (i = 0; i < wakeup->resources.count; i++) {
device->wakeup.resources.count = package->package.count - 2;
for (i = 0; i < device->wakeup.resources.count; i++) {
element = &(package->package.elements[i + 2]);
if (element->type != ACPI_TYPE_LOCAL_REFERENCE) {
status = AE_BAD_DATA;
goto out;
}
if (element->type != ACPI_TYPE_LOCAL_REFERENCE)
return AE_BAD_DATA;

wakeup->resources.handles[i] = element->reference.handle;
device->wakeup.resources.handles[i] = element->reference.handle;
}

acpi_gpe_can_wake(wakeup->gpe_device, wakeup->gpe_number);
acpi_gpe_can_wake(device->wakeup.gpe_device, device->wakeup.gpe_number);

out:
kfree(buffer.pointer);

return status;
return AE_OK;
}

static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
Expand Down Expand Up @@ -818,15 +787,26 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device)
static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
{
acpi_status status = 0;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *package = NULL;
int psw_error;

status = acpi_bus_extract_wakeup_device_power_package(device->handle,
&device->wakeup);
/* _PRW */
status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW"));
goto end;
}

package = (union acpi_object *)buffer.pointer;
status = acpi_bus_extract_wakeup_device_power_package(device, package);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package"));
goto end;
}

kfree(buffer.pointer);

device->wakeup.flags.valid = 1;
device->wakeup.prepare_count = 0;
acpi_bus_set_run_wake_flags(device);
Expand Down Expand Up @@ -1371,7 +1351,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
struct acpi_bus_ops *ops = context;
int type;
unsigned long long sta;
struct acpi_device_wakeup wakeup;
struct acpi_device *device;
acpi_status status;
int result;
Expand All @@ -1381,10 +1360,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl,
return AE_OK;

if (!(sta & ACPI_STA_DEVICE_PRESENT) &&
!(sta & ACPI_STA_DEVICE_FUNCTIONING)) {
acpi_bus_extract_wakeup_device_power_package(handle, &wakeup);
!(sta & ACPI_STA_DEVICE_FUNCTIONING))
return AE_CTRL_DEPTH;
}

/*
* We may already have an acpi_device from a previous enumeration. If
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/ata/pata_cs5536.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ static int use_msr;
module_param_named(msr, use_msr, int, 0644);
MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)");
#else
#undef rdmsr /* avoid accidental MSR usage on, e.g. x86-64 */
#undef wrmsr
#define rdmsr(x, y, z) do { } while (0)
#define wrmsr(x, y, z) do { } while (0)
#define use_msr 0
Expand Down

0 comments on commit 7fe2b95

Please sign in to comment.