forked from Minki/linux
ACPI: ec: Lindent once again
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
3261ff4db3
commit
6ccedb10e3
@ -45,16 +45,13 @@ ACPI_MODULE_NAME("acpi_ec")
|
||||
#define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver"
|
||||
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
|
||||
#define ACPI_EC_FILE_INFO "info"
|
||||
|
||||
#undef PREFIX
|
||||
#define PREFIX "ACPI: EC: "
|
||||
|
||||
/* EC status register */
|
||||
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
|
||||
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
|
||||
#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
|
||||
#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
|
||||
|
||||
/* EC commands */
|
||||
enum ec_command {
|
||||
ACPI_EC_COMMAND_READ = 0x80,
|
||||
@ -184,7 +181,6 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec)
|
||||
u8 tmp = 0;
|
||||
u8 status = 0;
|
||||
|
||||
|
||||
status = acpi_ec_read_status(ec);
|
||||
if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
|
||||
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
|
||||
@ -209,7 +205,6 @@ int acpi_ec_leave_burst_mode(struct acpi_ec *ec)
|
||||
{
|
||||
u8 status = 0;
|
||||
|
||||
|
||||
status = acpi_ec_read_status(ec);
|
||||
if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) {
|
||||
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
|
||||
@ -237,8 +232,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
|
||||
for (; wdata_len > 0; --wdata_len) {
|
||||
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
|
||||
if (result) {
|
||||
printk(KERN_ERR PREFIX "write_cmd timeout, command = %d\n",
|
||||
command);
|
||||
printk(KERN_ERR PREFIX
|
||||
"write_cmd timeout, command = %d\n", command);
|
||||
goto end;
|
||||
}
|
||||
acpi_ec_write_data(ec, *(wdata++));
|
||||
@ -247,8 +242,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
|
||||
if (!rdata_len) {
|
||||
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
|
||||
if (result) {
|
||||
printk(KERN_ERR PREFIX "finish-write timeout, command = %d\n",
|
||||
command);
|
||||
printk(KERN_ERR PREFIX
|
||||
"finish-write timeout, command = %d\n", command);
|
||||
goto end;
|
||||
}
|
||||
} else if (command == ACPI_EC_COMMAND_QUERY) {
|
||||
@ -294,7 +289,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
|
||||
|
||||
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -439,7 +435,6 @@ static u32 acpi_ec_gpe_handler(void *data)
|
||||
u8 value;
|
||||
struct acpi_ec *ec = (struct acpi_ec *)data;
|
||||
|
||||
|
||||
if (acpi_ec_mode == EC_INTR) {
|
||||
wake_up(&ec->wait);
|
||||
}
|
||||
@ -447,7 +442,9 @@ static u32 acpi_ec_gpe_handler(void *data)
|
||||
value = acpi_ec_read_status(ec);
|
||||
if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) {
|
||||
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 ?
|
||||
@ -485,7 +482,6 @@ acpi_ec_space_handler(u32 function,
|
||||
acpi_integer f_v = 0;
|
||||
int i = 0;
|
||||
|
||||
|
||||
if ((address > 0xFF) || !value || !handler_context)
|
||||
return AE_BAD_PARAMETER;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
if (!ec)
|
||||
goto end;
|
||||
|
||||
seq_printf(seq, "gpe: 0x%02x\n",
|
||||
(u32) ec->gpe);
|
||||
seq_printf(seq, "gpe: 0x%02x\n", (u32) ec->gpe);
|
||||
seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
|
||||
(u32) ec->command_addr,
|
||||
(u32) ec->data_addr);
|
||||
(u32) ec->command_addr, (u32) ec->data_addr);
|
||||
seq_printf(seq, "use global lock: %s\n",
|
||||
ec->global_lock ? "yes" : "no");
|
||||
acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
|
||||
@ -586,7 +579,6 @@ static int acpi_ec_add_fs(struct acpi_device *device)
|
||||
{
|
||||
struct proc_dir_entry *entry = NULL;
|
||||
|
||||
|
||||
if (!acpi_device_dir(device)) {
|
||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||
acpi_ec_dir);
|
||||
@ -629,7 +621,6 @@ static int acpi_ec_add(struct acpi_device *device)
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ec *ec = NULL;
|
||||
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
@ -651,8 +642,7 @@ static int acpi_ec_add(struct acpi_device *device)
|
||||
acpi_driver_data(device) = ec;
|
||||
|
||||
/* Use the global lock for all EC transactions? */
|
||||
acpi_evaluate_integer(ec->handle, "_GLK", NULL,
|
||||
&ec->global_lock);
|
||||
acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock);
|
||||
|
||||
/* XXX we don't test uids, because on some boxes ecdt uid = 0, see:
|
||||
http://bugzilla.kernel.org/show_bug.cgi?id=6111 */
|
||||
@ -669,11 +659,10 @@ static int acpi_ec_add(struct acpi_device *device)
|
||||
|
||||
/* Get GPE bit assignment (EC events). */
|
||||
/* TODO: Add support for _GPE returning a package */
|
||||
status =
|
||||
acpi_evaluate_integer(ec->handle, "_GPE", NULL,
|
||||
&ec->gpe);
|
||||
status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit assignment"));
|
||||
ACPI_EXCEPTION((AE_INFO, status,
|
||||
"Obtaining GPE bit assignment"));
|
||||
result = -ENODEV;
|
||||
goto end;
|
||||
}
|
||||
@ -700,7 +689,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
|
||||
{
|
||||
struct acpi_ec *ec = NULL;
|
||||
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
@ -743,7 +731,6 @@ static int acpi_ec_start(struct acpi_device *device)
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ec *ec = NULL;
|
||||
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
@ -783,8 +770,7 @@ static int acpi_ec_start(struct acpi_device *device)
|
||||
&acpi_ec_space_handler,
|
||||
&acpi_ec_space_setup, ec);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_remove_gpe_handler(NULL, ec->gpe,
|
||||
&acpi_ec_gpe_handler);
|
||||
acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -796,7 +782,6 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_ec *ec = NULL;
|
||||
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
@ -808,9 +793,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENODEV;
|
||||
|
||||
status =
|
||||
acpi_remove_gpe_handler(NULL, ec->gpe,
|
||||
&acpi_ec_gpe_handler);
|
||||
status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENODEV;
|
||||
|
||||
@ -835,16 +818,15 @@ acpi_fake_ecdt_callback(acpi_handle handle,
|
||||
ec_ecdt->uid = -1;
|
||||
acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid);
|
||||
|
||||
status =
|
||||
acpi_evaluate_integer(handle, "_GPE", NULL,
|
||||
&ec_ecdt->gpe);
|
||||
status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe);
|
||||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
ec_ecdt->global_lock = TRUE;
|
||||
ec_ecdt->handle = handle;
|
||||
|
||||
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;
|
||||
}
|
||||
@ -919,8 +901,7 @@ static int __init acpi_ec_get_real_ecdt(void)
|
||||
ec_ecdt->global_lock = TRUE;
|
||||
ec_ecdt->uid = ecdt_ptr->uid;
|
||||
|
||||
status =
|
||||
acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
|
||||
status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto error;
|
||||
}
|
||||
@ -986,7 +967,6 @@ static int __init acpi_ec_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
||||
if (acpi_disabled)
|
||||
return 0;
|
||||
|
||||
@ -1039,7 +1019,8 @@ static int __init acpi_ec_set_intr_mode(char *str)
|
||||
acpi_ec_mode = EC_POLL;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user