diff options
| author | Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | 2006-12-07 10:42:17 -0500 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2006-12-08 02:56:09 -0500 |
| commit | 6ccedb10e39c34a4cb68f6c8dae67ecdd3e0b138 (patch) | |
| tree | 803f7366f7235125e89d9d4537e4d943cb097e7a | |
| parent | 3261ff4db3a33ac7e1b9ed98e905663845cadbc6 (diff) | |
ACPI: ec: Lindent once again
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | drivers/acpi/ec.c | 171 |
1 files changed, 76 insertions, 95 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index e05bb148754c..d713f769b72d 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -45,36 +45,33 @@ ACPI_MODULE_NAME("acpi_ec") | |||
| 45 | #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" | 45 | #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" |
| 46 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" | 46 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" |
| 47 | #define ACPI_EC_FILE_INFO "info" | 47 | #define ACPI_EC_FILE_INFO "info" |
| 48 | |||
| 49 | #undef PREFIX | 48 | #undef PREFIX |
| 50 | #define PREFIX "ACPI: EC: " | 49 | #define PREFIX "ACPI: EC: " |
| 51 | |||
| 52 | /* EC status register */ | 50 | /* EC status register */ |
| 53 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 51 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
| 54 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 52 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
| 55 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | 53 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ |
| 56 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 54 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
| 57 | |||
| 58 | /* EC commands */ | 55 | /* EC commands */ |
| 59 | enum ec_command { | 56 | enum ec_command { |
| 60 | ACPI_EC_COMMAND_READ = 0x80, | 57 | ACPI_EC_COMMAND_READ = 0x80, |
| 61 | ACPI_EC_COMMAND_WRITE = 0x81, | 58 | ACPI_EC_COMMAND_WRITE = 0x81, |
| 62 | ACPI_EC_BURST_ENABLE = 0x82, | 59 | ACPI_EC_BURST_ENABLE = 0x82, |
| 63 | ACPI_EC_BURST_DISABLE = 0x83, | 60 | ACPI_EC_BURST_DISABLE = 0x83, |
| 64 | ACPI_EC_COMMAND_QUERY = 0x84, | 61 | ACPI_EC_COMMAND_QUERY = 0x84, |
| 65 | }; | 62 | }; |
| 66 | /* EC events */ | 63 | /* EC events */ |
| 67 | enum ec_event { | 64 | enum ec_event { |
| 68 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ | 65 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ |
| 69 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ | 66 | ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ |
| 70 | }; | 67 | }; |
| 71 | 68 | ||
| 72 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 69 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
| 73 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 70 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
| 74 | 71 | ||
| 75 | static enum ec_mode { | 72 | static enum ec_mode { |
| 76 | EC_INTR = 1, /* Output buffer full */ | 73 | EC_INTR = 1, /* Output buffer full */ |
| 77 | EC_POLL, /* Input buffer empty */ | 74 | EC_POLL, /* Input buffer empty */ |
| 78 | } acpi_ec_mode = EC_INTR; | 75 | } acpi_ec_mode = EC_INTR; |
| 79 | 76 | ||
| 80 | static int acpi_ec_remove(struct acpi_device *device, int type); | 77 | 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 | } else { | 164 | } else { |
| 168 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 165 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," |
| 169 | " status = %d, expect_event = %d\n", | 166 | " status = %d, expect_event = %d\n", |
| 170 | acpi_ec_read_status(ec), event); | 167 | acpi_ec_read_status(ec), event); |
| 171 | } | 168 | } |
| 172 | } | 169 | } |
| 173 | 170 | ||
| @@ -184,7 +181,6 @@ int acpi_ec_enter_burst_mode(struct acpi_ec *ec) | |||
| 184 | u8 tmp = 0; | 181 | u8 tmp = 0; |
| 185 | u8 status = 0; | 182 | u8 status = 0; |
| 186 | 183 | ||
| 187 | |||
| 188 | status = acpi_ec_read_status(ec); | 184 | status = acpi_ec_read_status(ec); |
| 189 | if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { | 185 | if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { |
| 190 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 186 | 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 | 196 | ||
| 201 | atomic_set(&ec->leaving_burst, 0); | 197 | atomic_set(&ec->leaving_burst, 0); |
| 202 | return 0; | 198 | return 0; |
| 203 | end: | 199 | end: |
| 204 | ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode")); | 200 | ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode")); |
| 205 | return -1; | 201 | return -1; |
| 206 | } | 202 | } |
| @@ -209,26 +205,25 @@ int acpi_ec_leave_burst_mode(struct acpi_ec *ec) | |||
| 209 | { | 205 | { |
| 210 | u8 status = 0; | 206 | u8 status = 0; |
| 211 | 207 | ||
| 212 | |||
| 213 | status = acpi_ec_read_status(ec); | 208 | status = acpi_ec_read_status(ec); |
| 214 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ | 209 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) { |
| 215 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 210 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); |
| 216 | if(status) | 211 | if (status) |
| 217 | goto end; | 212 | goto end; |
| 218 | acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE); | 213 | acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE); |
| 219 | acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 214 | acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); |
| 220 | } | 215 | } |
| 221 | atomic_set(&ec->leaving_burst, 1); | 216 | atomic_set(&ec->leaving_burst, 1); |
| 222 | return 0; | 217 | return 0; |
| 223 | end: | 218 | end: |
| 224 | ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode")); | 219 | ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode")); |
| 225 | return -1; | 220 | return -1; |
| 226 | } | 221 | } |
| 227 | #endif /* ACPI_FUTURE_USAGE */ | 222 | #endif /* ACPI_FUTURE_USAGE */ |
| 228 | 223 | ||
| 229 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 224 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
| 230 | const u8 *wdata, unsigned wdata_len, | 225 | const u8 * wdata, unsigned wdata_len, |
| 231 | u8 *rdata, unsigned rdata_len) | 226 | u8 * rdata, unsigned rdata_len) |
| 232 | { | 227 | { |
| 233 | int result = 0; | 228 | int result = 0; |
| 234 | 229 | ||
| @@ -237,8 +232,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 237 | for (; wdata_len > 0; --wdata_len) { | 232 | for (; wdata_len > 0; --wdata_len) { |
| 238 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 233 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); |
| 239 | if (result) { | 234 | if (result) { |
| 240 | printk(KERN_ERR PREFIX "write_cmd timeout, command = %d\n", | 235 | printk(KERN_ERR PREFIX |
| 241 | command); | 236 | "write_cmd timeout, command = %d\n", command); |
| 242 | goto end; | 237 | goto end; |
| 243 | } | 238 | } |
| 244 | acpi_ec_write_data(ec, *(wdata++)); | 239 | acpi_ec_write_data(ec, *(wdata++)); |
| @@ -247,8 +242,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 247 | if (!rdata_len) { | 242 | if (!rdata_len) { |
| 248 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 243 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); |
| 249 | if (result) { | 244 | if (result) { |
| 250 | printk(KERN_ERR PREFIX "finish-write timeout, command = %d\n", | 245 | printk(KERN_ERR PREFIX |
| 251 | command); | 246 | "finish-write timeout, command = %d\n", command); |
| 252 | goto end; | 247 | goto end; |
| 253 | } | 248 | } |
| 254 | } else if (command == ACPI_EC_COMMAND_QUERY) { | 249 | } else if (command == ACPI_EC_COMMAND_QUERY) { |
| @@ -259,7 +254,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 259 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); | 254 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); |
| 260 | if (result) { | 255 | if (result) { |
| 261 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 256 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
| 262 | command); | 257 | command); |
| 263 | goto end; | 258 | goto end; |
| 264 | } | 259 | } |
| 265 | 260 | ||
| @@ -270,8 +265,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 270 | } | 265 | } |
| 271 | 266 | ||
| 272 | static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | 267 | static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, |
| 273 | const u8 *wdata, unsigned wdata_len, | 268 | const u8 * wdata, unsigned wdata_len, |
| 274 | u8 *rdata, unsigned rdata_len) | 269 | u8 * rdata, unsigned rdata_len) |
| 275 | { | 270 | { |
| 276 | int status; | 271 | int status; |
| 277 | u32 glk; | 272 | u32 glk; |
| @@ -279,8 +274,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
| 279 | if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata)) | 274 | if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata)) |
| 280 | return -EINVAL; | 275 | return -EINVAL; |
| 281 | 276 | ||
| 282 | if (rdata) | 277 | if (rdata) |
| 283 | memset(rdata, 0, rdata_len); | 278 | memset(rdata, 0, rdata_len); |
| 284 | 279 | ||
| 285 | mutex_lock(&ec->lock); | 280 | mutex_lock(&ec->lock); |
| 286 | if (ec->global_lock) { | 281 | if (ec->global_lock) { |
| @@ -294,15 +289,16 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
| 294 | 289 | ||
| 295 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 290 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); |
| 296 | if (status) { | 291 | if (status) { |
| 297 | printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); | 292 | printk(KERN_DEBUG PREFIX |
| 293 | |||
