Commit 6ccedb10 authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Len Brown

ACPI: ec: Lindent once again

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 3261ff4d
...@@ -45,36 +45,33 @@ ACPI_MODULE_NAME("acpi_ec") ...@@ -45,36 +45,33 @@ ACPI_MODULE_NAME("acpi_ec")
#define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver"
#define ACPI_EC_DEVICE_NAME "Embedded Controller" #define ACPI_EC_DEVICE_NAME "Embedded Controller"
#define ACPI_EC_FILE_INFO "info" #define ACPI_EC_FILE_INFO "info"
#undef PREFIX #undef PREFIX
#define PREFIX "ACPI: EC: " #define PREFIX "ACPI: EC: "
/* EC status register */ /* EC status register */
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
/* EC commands */ /* EC commands */
enum ec_command { enum ec_command {
ACPI_EC_COMMAND_READ = 0x80, ACPI_EC_COMMAND_READ = 0x80,
ACPI_EC_COMMAND_WRITE = 0x81, ACPI_EC_COMMAND_WRITE = 0x81,
ACPI_EC_BURST_ENABLE = 0x82, ACPI_EC_BURST_ENABLE = 0x82,
ACPI_EC_BURST_DISABLE = 0x83, ACPI_EC_BURST_DISABLE = 0x83,
ACPI_EC_COMMAND_QUERY = 0x84, ACPI_EC_COMMAND_QUERY = 0x84,
}; };
/* EC events */ /* EC events */
enum ec_event { enum ec_event {
ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
}; };
#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
static enum ec_mode { static enum ec_mode {
EC_INTR = 1, /* Output buffer full */ EC_INTR = 1, /* Output buffer full */
EC_POLL, /* Input buffer empty */ EC_POLL, /* Input buffer empty */
} acpi_ec_mode = EC_INTR; } acpi_ec_mode = EC_INTR;
static int acpi_ec_remove(struct acpi_device *device, int type); static int acpi_ec_remove(struct acpi_device *device, int type);
...@@ -167,7 +164,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event) ...@@ -167,7 +164,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event)
} else { } else {
printk(KERN_ERR PREFIX "acpi_ec_wait timeout," printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
" status = %d, expect_event = %d\n", " status = %d, expect_event = %d\n",
acpi_ec_read_status(ec), event); acpi_ec_read_status(ec), event);
} }
} }
...@@ -184,7 +181,6 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec) ...@@ -184,7 +181,6 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec)
u8 tmp = 0; u8 tmp = 0;
u8 status = 0; u8 status = 0;
status = acpi_ec_read_status(ec); status = acpi_ec_read_status(ec);
if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
...@@ -200,7 +196,7 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec) ...@@ -200,7 +196,7 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec)
atomic_set(&ec->leaving_burst, 0); atomic_set(&ec->leaving_burst, 0);
return 0; return 0;
end: end:
ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode")); ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode"));
return -1; return -1;
} }
...@@ -209,26 +205,25 @@ int acpi_ec_leave_burst_mode(struct acpi_ec *ec) ...@@ -209,26 +205,25 @@ int acpi_ec_leave_burst_mode(struct acpi_ec *ec)
{ {
u8 status = 0; u8 status = 0;
status = acpi_ec_read_status(ec); status = acpi_ec_read_status(ec);
if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) {
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
if(status) if (status)
goto end; goto end;
acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE); acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE);
acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
} }
atomic_set(&ec->leaving_burst, 1); atomic_set(&ec->leaving_burst, 1);
return 0; return 0;
end: end:
ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode")); ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"));
return -1; return -1;
} }
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
const u8 *wdata, unsigned wdata_len, const u8 * wdata, unsigned wdata_len,
u8 *rdata, unsigned rdata_len) u8 * rdata, unsigned rdata_len)
{ {
int result = 0; int result = 0;
...@@ -237,8 +232,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, ...@@ -237,8 +232,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
for (; wdata_len > 0; --wdata_len) { for (; wdata_len > 0; --wdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
if (result) { if (result) {
printk(KERN_ERR PREFIX "write_cmd timeout, command = %d\n", printk(KERN_ERR PREFIX
command); "write_cmd timeout, command = %d\n", command);
goto end; goto end;
} }
acpi_ec_write_data(ec, *(wdata++)); acpi_ec_write_data(ec, *(wdata++));
...@@ -247,8 +242,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, ...@@ -247,8 +242,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
if (!rdata_len) { if (!rdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
if (result) { if (result) {
printk(KERN_ERR PREFIX "finish-write timeout, command = %d\n", printk(KERN_ERR PREFIX
command); "finish-write timeout, command = %d\n", command);
goto end; goto end;
} }
} else if (command == ACPI_EC_COMMAND_QUERY) { } else if (command == ACPI_EC_COMMAND_QUERY) {
...@@ -259,7 +254,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, ...@@ -259,7 +254,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1);
if (result) { if (result) {
printk(KERN_ERR PREFIX "read timeout, command = %d\n", printk(KERN_ERR PREFIX "read timeout, command = %d\n",
command); command);
goto end; goto end;
} }
...@@ -270,8 +265,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, ...@@ -270,8 +265,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
} }
static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
const u8 *wdata, unsigned wdata_len, const u8 * wdata, unsigned wdata_len,
u8 *rdata, unsigned rdata_len) u8 * rdata, unsigned rdata_len)
{ {
int status; int status;
u32 glk; u32 glk;
...@@ -279,8 +274,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, ...@@ -279,8 +274,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata)) if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata))
return -EINVAL; return -EINVAL;
if (rdata) if (rdata)
memset(rdata, 0, rdata_len); memset(rdata, 0, rdata_len);
mutex_lock(&ec->lock); mutex_lock(&ec->lock);
if (ec->global_lock) { if (ec->global_lock) {
...@@ -294,15 +289,16 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, ...@@ -294,15 +289,16 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
if (status) { if (status) {
printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); printk(KERN_DEBUG PREFIX
"input buffer is not empty, aborting transaction\n");
goto end; goto end;
} }
status = acpi_ec_transaction_unlocked(ec, command, status = acpi_ec_transaction_unlocked(ec, command,
wdata, wdata_len, wdata, wdata_len,
rdata, rdata_len); rdata, rdata_len);
end: end:
if (ec->global_lock) if (ec->global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
...@@ -311,7 +307,7 @@ end: ...@@ -311,7 +307,7 @@ end:
return status; return status;
} }
static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 *data) static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
{ {
int result; int result;
u8 d; u8 d;
...@@ -324,15 +320,15 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 *data) ...@@ -324,15 +320,15 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 *data)
static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data)
{ {
u8 wdata[2] = { address, data }; u8 wdata[2] = { address, data };
return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE,
wdata, 2, NULL, 0); wdata, 2, NULL, 0);
} }
/* /*
* Externally callable EC access functions. For now, assume 1 EC only * Externally callable EC access functions. For now, assume 1 EC only
*/ */
int ec_read(u8 addr, u8 *val) int ec_read(u8 addr, u8 * val)
{ {
struct acpi_ec *ec; struct acpi_ec *ec;
int err; int err;
...@@ -372,8 +368,8 @@ int ec_write(u8 addr, u8 val) ...@@ -372,8 +368,8 @@ int ec_write(u8 addr, u8 val)
EXPORT_SYMBOL(ec_write); EXPORT_SYMBOL(ec_write);
extern int ec_transaction(u8 command, extern int ec_transaction(u8 command,
const u8 *wdata, unsigned wdata_len, const u8 * wdata, unsigned wdata_len,
u8 *rdata, unsigned rdata_len) u8 * rdata, unsigned rdata_len)
{ {
struct acpi_ec *ec; struct acpi_ec *ec;
...@@ -388,29 +384,29 @@ extern int ec_transaction(u8 command, ...@@ -388,29 +384,29 @@ extern int ec_transaction(u8 command,
EXPORT_SYMBOL(ec_transaction); EXPORT_SYMBOL(ec_transaction);
static int acpi_ec_query(struct acpi_ec *ec, u8 *data) static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
{ {
int result; int result;
u8 d; u8 d;
if (!ec || !data) if (!ec || !data)
return -EINVAL; return -EINVAL;
/* /*
* Query the EC to find out which _Qxx method we need to evaluate. * Query the EC to find out which _Qxx method we need to evaluate.
* Note that successful completion of the query causes the ACPI_EC_SCI * Note that successful completion of the query causes the ACPI_EC_SCI
* bit to be cleared (and thus clearing the interrupt source). * bit to be cleared (and thus clearing the interrupt source).
*/ */
result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1); result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1);
if (result) if (result)
return result; return result;
if (!d) if (!d)
return -ENODATA; return -ENODATA;
*data = d; *data = d;
return 0; return 0;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -439,7 +435,6 @@ static u32 acpi_ec_gpe_handler(void *data) ...@@ -439,7 +435,6 @@ static u32 acpi_ec_gpe_handler(void *data)
u8 value; u8 value;
struct acpi_ec *ec = (struct acpi_ec *)data; struct acpi_ec *ec = (struct acpi_ec *)data;
if (acpi_ec_mode == EC_INTR) { if (acpi_ec_mode == EC_INTR) {
wake_up(&ec->wait); wake_up(&ec->wait);
} }
...@@ -447,7 +442,9 @@ static u32 acpi_ec_gpe_handler(void *data) ...@@ -447,7 +442,9 @@ static u32 acpi_ec_gpe_handler(void *data)
value = acpi_ec_read_status(ec); value = acpi_ec_read_status(ec);
if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) {
atomic_set(&ec->query_pending, 1); atomic_set(&ec->query_pending, 1);
status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); status =
acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query,
ec);
} }
return status == AE_OK ? return status == AE_OK ?
...@@ -485,7 +482,6 @@ acpi_ec_space_handler(u32 function, ...@@ -485,7 +482,6 @@ acpi_ec_space_handler(u32 function,
acpi_integer f_v = 0; acpi_integer f_v = 0;
int i = 0; int i = 0;
if ((address > 0xFF) || !value || !handler_context) if ((address > 0xFF) || !value || !handler_context)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
...@@ -499,7 +495,7 @@ acpi_ec_space_handler(u32 function, ...@@ -499,7 +495,7 @@ acpi_ec_space_handler(u32 function,
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
temp = 0; temp = 0;
result = acpi_ec_read(ec, (u8) address, (u8 *) &temp); result = acpi_ec_read(ec, (u8) address, (u8 *) & temp);
break; break;
case ACPI_WRITE: case ACPI_WRITE:
result = acpi_ec_write(ec, (u8) address, (u8) temp); result = acpi_ec_write(ec, (u8) address, (u8) temp);
...@@ -552,15 +548,12 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) ...@@ -552,15 +548,12 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset)
{ {
struct acpi_ec *ec = (struct acpi_ec *)seq->private; struct acpi_ec *ec = (struct acpi_ec *)seq->private;
if (!ec) if (!ec)
goto end; goto end;
seq_printf(seq, "gpe: 0x%02x\n", seq_printf(seq, "gpe: 0x%02x\n", (u32) ec->gpe);
(u32) ec->gpe);
seq_printf(seq, "ports: 0x%02x, 0x%02x\n", seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
(u32) ec->command_addr, (u32) ec->command_addr, (u32) ec->data_addr);
(u32) ec->data_addr);
seq_printf(seq, "use global lock: %s\n", seq_printf(seq, "use global lock: %s\n",
ec->global_lock ? "yes" : "no"); ec->global_lock ? "yes" : "no");
acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
...@@ -586,7 +579,6 @@ static int acpi_ec_add_fs(struct acpi_device *device) ...@@ -586,7 +579,6 @@ static int acpi_ec_add_fs(struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
if (!acpi_device_dir(device)) { if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ec_dir); acpi_ec_dir);
...@@ -629,7 +621,6 @@ static int acpi_ec_add(struct acpi_device *device) ...@@ -629,7 +621,6 @@ static int acpi_ec_add(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
if (!device) if (!device)
return -EINVAL; return -EINVAL;
...@@ -651,8 +642,7 @@ static int acpi_ec_add(struct acpi_device *device) ...@@ -651,8 +642,7 @@ static int acpi_ec_add(struct acpi_device *device)
acpi_driver_data(device) = ec; acpi_driver_data(device) = ec;
/* Use the global lock for all EC transactions? */ /* Use the global lock for all EC transactions? */
acpi_evaluate_integer(ec->handle, "_GLK", NULL, acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock);
&ec->global_lock);
/* XXX we don't test uids, because on some boxes ecdt uid = 0, see: /* XXX we don't test uids, because on some boxes ecdt uid = 0, see:
http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ http://bugzilla.kernel.org/show_bug.cgi?id=6111 */
...@@ -669,11 +659,10 @@ static int acpi_ec_add(struct acpi_device *device) ...@@ -669,11 +659,10 @@ static int acpi_ec_add(struct acpi_device *device)
/* Get GPE bit assignment (EC events). */ /* Get GPE bit assignment (EC events). */
/* TODO: Add support for _GPE returning a package */ /* TODO: Add support for _GPE returning a package */
status = status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe);
acpi_evaluate_integer(ec->handle, "_GPE", NULL,
&ec->gpe);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit assignment")); ACPI_EXCEPTION((AE_INFO, status,
"Obtaining GPE bit assignment"));
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
...@@ -683,13 +672,13 @@ static int acpi_ec_add(struct acpi_device *device) ...@@ -683,13 +672,13 @@ static int acpi_ec_add(struct acpi_device *device)
goto end; goto end;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s [%s] (gpe %d) interrupt mode.", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s [%s] (gpe %d) interrupt mode.",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
(u32) ec->gpe)); (u32) ec->gpe));
if (!first_ec) if (!first_ec)
first_ec = device; first_ec = device;
end: end:
if (result) if (result)
kfree(ec); kfree(ec);
...@@ -700,7 +689,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type) ...@@ -700,7 +689,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
{ {
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
if (!device) if (!device)
return -EINVAL; return -EINVAL;
...@@ -743,7 +731,6 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -743,7 +731,6 @@ static int acpi_ec_start(struct acpi_device *device)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
if (!device) if (!device)
return -EINVAL; return -EINVAL;
...@@ -783,8 +770,7 @@ static int acpi_ec_start(struct acpi_device *device) ...@@ -783,8 +770,7 @@ static int acpi_ec_start(struct acpi_device *device)
&acpi_ec_space_handler, &acpi_ec_space_handler,
&acpi_ec_space_setup, ec); &acpi_ec_space_setup, ec);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_remove_gpe_handler(NULL, ec->gpe, acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
&acpi_ec_gpe_handler);
return -ENODEV; return -ENODEV;
} }
...@@ -796,7 +782,6 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ...@@ -796,7 +782,6 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
if (!device) if (!device)
return -EINVAL; return -EINVAL;
...@@ -808,9 +793,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ...@@ -808,9 +793,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
status = status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
acpi_remove_gpe_handler(NULL, ec->gpe,
&acpi_ec_gpe_handler);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
...@@ -835,16 +818,15 @@ acpi_fake_ecdt_callback(acpi_handle handle, ...@@ -835,16 +818,15 @@ acpi_fake_ecdt_callback(acpi_handle handle,
ec_ecdt->uid = -1; ec_ecdt->uid = -1;
acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid);
status = status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe);
acpi_evaluate_integer(handle, "_GPE", NULL,
&ec_ecdt->gpe);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
ec_ecdt->global_lock = TRUE; ec_ecdt->global_lock = TRUE;
ec_ecdt->handle = handle; ec_ecdt->handle = handle;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "GPE=0x%02lx, ports=0x%2lx, 0x%2lx", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "GPE=0x%02lx, ports=0x%2lx, 0x%2lx",
ec_ecdt->gpe, ec_ecdt->command_addr, ec_ecdt->data_addr)); ec_ecdt->gpe, ec_ecdt->command_addr,
ec_ecdt->data_addr));
return AE_CTRL_TERMINATE; return AE_CTRL_TERMINATE;
} }
...@@ -883,7 +865,7 @@ static int __init acpi_ec_fake_ecdt(void) ...@@ -883,7 +865,7 @@ static int __init acpi_ec_fake_ecdt(void)
goto error; goto error;
} }
return 0; return 0;
error: error:
return ret; return ret;
} }
...@@ -919,14 +901,13 @@ static int __init acpi_ec_get_real_ecdt(void) ...@@ -919,14 +901,13 @@ static int __init acpi_ec_get_real_ecdt(void)
ec_ecdt->global_lock = TRUE; ec_ecdt->global_lock = TRUE;
ec_ecdt->uid = ecdt_ptr->uid; ec_ecdt->uid = ecdt_ptr->uid;
status = status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto error; goto error;
} }
return 0; return 0;
error: error:
ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT"));
kfree(ec_ecdt); kfree(ec_ecdt);
ec_ecdt = NULL; ec_ecdt = NULL;
...@@ -986,7 +967,6 @@ static int __init acpi_ec_init(void) ...@@ -986,7 +967,6 @@ static int __init acpi_ec_init(void)
{ {
int result = 0; int result = 0;
if (acpi_disabled) if (acpi_disabled)
return 0; return 0;
...@@ -1039,7 +1019,8 @@ static int __init acpi_ec_set_intr_mode(char *str) ...@@ -1039,7 +1019,8 @@ static int __init acpi_ec_set_intr_mode(char *str)
acpi_ec_mode = EC_POLL; acpi_ec_mode = EC_POLL;
} }
acpi_ec_driver.ops.add = acpi_ec_add; acpi_ec_driver.ops.add = acpi_ec_add;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "EC %s mode.\n", intr ? "interrupt" : "polling")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "EC %s mode.\n",
intr ? "interrupt" : "polling"));
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment