Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165260
b: refs/heads/master
c: 5efc547
h: refs/heads/master
v: v3
  • Loading branch information
Bjorn Helgaas authored and Len Brown committed Jun 25, 2009
1 parent 48b452a commit 8abaac0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 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: 80f20fef6a2381402e59b169eb51b989cc175ab7
refs/heads/master: 5efc5476184173996dfcce780c2bb5e727df674e
112 changes: 56 additions & 56 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,42 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
return AE_CTRL_TERMINATE;
}

static int ec_install_handlers(struct acpi_ec *ec)
{
acpi_status status;
if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
return 0;
status = acpi_install_gpe_handler(NULL, ec->gpe,
ACPI_GPE_EDGE_TRIGGERED,
&acpi_ec_gpe_handler, ec);
if (ACPI_FAILURE(status))
return -ENODEV;
acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
acpi_enable_gpe(NULL, ec->gpe);
status = acpi_install_address_space_handler(ec->handle,
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler,
NULL, ec);
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND) {
/*
* Maybe OS fails in evaluating the _REG object.
* The AE_NOT_FOUND error will be ignored and OS
* continue to initialize EC.
*/
printk(KERN_ERR "Fail in evaluating the _REG object"
" of EC device. Broken bios is suspected.\n");
} else {
acpi_remove_gpe_handler(NULL, ec->gpe,
&acpi_ec_gpe_handler);
return -ENODEV;
}
}

set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
return 0;
}

static void ec_remove_handlers(struct acpi_ec *ec)
{
if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
Expand Down Expand Up @@ -842,6 +878,26 @@ static int acpi_ec_add(struct acpi_device *device)
return 0;
}

static int acpi_ec_start(struct acpi_device *device)
{
struct acpi_ec *ec;
int ret = 0;

if (!device)
return -EINVAL;

ec = acpi_driver_data(device);

if (!ec)
return -EINVAL;

ret = ec_install_handlers(ec);

/* EC is fully operational, allow queries */
clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
return ret;
}

static int acpi_ec_remove(struct acpi_device *device, int type)
{
struct acpi_ec *ec;
Expand Down Expand Up @@ -888,62 +944,6 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
return AE_OK;
}

static int ec_install_handlers(struct acpi_ec *ec)
{
acpi_status status;
if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
return 0;
status = acpi_install_gpe_handler(NULL, ec->gpe,
ACPI_GPE_EDGE_TRIGGERED,
&acpi_ec_gpe_handler, ec);
if (ACPI_FAILURE(status))
return -ENODEV;
acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
acpi_enable_gpe(NULL, ec->gpe);
status = acpi_install_address_space_handler(ec->handle,
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler,
NULL, ec);
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND) {
/*
* Maybe OS fails in evaluating the _REG object.
* The AE_NOT_FOUND error will be ignored and OS
* continue to initialize EC.
*/
printk(KERN_ERR "Fail in evaluating the _REG object"
" of EC device. Broken bios is suspected.\n");
} else {
acpi_remove_gpe_handler(NULL, ec->gpe,
&acpi_ec_gpe_handler);
return -ENODEV;
}
}

set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
return 0;
}

static int acpi_ec_start(struct acpi_device *device)
{
struct acpi_ec *ec;
int ret = 0;

if (!device)
return -EINVAL;

ec = acpi_driver_data(device);

if (!ec)
return -EINVAL;

ret = ec_install_handlers(ec);

/* EC is fully operational, allow queries */
clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
return ret;
}

static int acpi_ec_stop(struct acpi_device *device, int type)
{
struct acpi_ec *ec;
Expand Down

0 comments on commit 8abaac0

Please sign in to comment.