diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
| commit | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (patch) | |
| tree | 2624a44924c625c367f3cebf937853b9da2de282 /drivers/acpi/button.c | |
| parent | 9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (diff) | |
| parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'drivers/acpi/button.c')
| -rw-r--r-- | drivers/acpi/button.c | 72 |
1 files changed, 26 insertions, 46 deletions
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 4b6d9f0096a1..02594639c4d9 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | |||
| 112 | { | 112 | { |
| 113 | struct acpi_button *button = (struct acpi_button *)seq->private; | 113 | struct acpi_button *button = (struct acpi_button *)seq->private; |
| 114 | 114 | ||
| 115 | ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); | ||
| 116 | 115 | ||
| 117 | if (!button || !button->device) | 116 | if (!button || !button->device) |
| 118 | return_VALUE(0); | 117 | return 0; |
| 119 | 118 | ||
| 120 | seq_printf(seq, "type: %s\n", | 119 | seq_printf(seq, "type: %s\n", |
| 121 | acpi_device_name(button->device)); | 120 | acpi_device_name(button->device)); |
| 122 | 121 | ||
| 123 | return_VALUE(0); | 122 | return 0; |
| 124 | } | 123 | } |
| 125 | 124 | ||
| 126 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | 125 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) |
| @@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | |||
| 134 | acpi_status status; | 133 | acpi_status status; |
| 135 | unsigned long state; | 134 | unsigned long state; |
| 136 | 135 | ||
| 137 | ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); | ||
| 138 | 136 | ||
| 139 | if (!button || !button->device) | 137 | if (!button || !button->device) |
| 140 | return_VALUE(0); | 138 | return 0; |
| 141 | 139 | ||
| 142 | status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); | 140 | status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); |
| 143 | if (ACPI_FAILURE(status)) { | 141 | if (ACPI_FAILURE(status)) { |
| @@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | |||
| 147 | (state ? "open" : "closed")); | 145 | (state ? "open" : "closed")); |
| 148 | } | 146 | } |
| 149 | 147 | ||
| 150 | return_VALUE(0); | 148 | return 0; |
| 151 | } | 149 | } |
| 152 | 150 | ||
| 153 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | 151 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) |
| @@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
| 164 | struct proc_dir_entry *entry = NULL; | 162 | struct proc_dir_entry *entry = NULL; |
| 165 | struct acpi_button *button = NULL; | 163 | struct acpi_button *button = NULL; |
| 166 | 164 | ||
| 167 | ACPI_FUNCTION_TRACE("acpi_button_add_fs"); | ||
| 168 | 165 | ||
| 169 | if (!device || !acpi_driver_data(device)) | 166 | if (!device || !acpi_driver_data(device)) |
| 170 | return_VALUE(-EINVAL); | 167 | return -EINVAL; |
| 171 | 168 | ||
| 172 | button = acpi_driver_data(device); | 169 | button = acpi_driver_data(device); |
| 173 | 170 | ||
| @@ -195,21 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
| 195 | } | 192 | } |
| 196 | 193 | ||
| 197 | if (!entry) | 194 | if (!entry) |
| 198 | return_VALUE(-ENODEV); | 195 | return -ENODEV; |
| 199 | entry->owner = THIS_MODULE; | 196 | entry->owner = THIS_MODULE; |
| 200 | 197 | ||
| 201 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); | 198 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); |
| 202 | if (!acpi_device_dir(device)) | 199 | if (!acpi_device_dir(device)) |
| 203 | return_VALUE(-ENODEV); | 200 | return -ENODEV; |
| 204 | acpi_device_dir(device)->owner = THIS_MODULE; | 201 | acpi_device_dir(device)->owner = THIS_MODULE; |
| 205 | 202 | ||
| 206 | /* 'info' [R] */ | 203 | /* 'info' [R] */ |
| 207 | entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, | 204 | entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, |
| 208 | S_IRUGO, acpi_device_dir(device)); | 205 | S_IRUGO, acpi_device_dir(device)); |
| 209 | if (!entry) | 206 | if (!entry) |
| 210 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 207 | return -ENODEV; |
| 211 | "Unable to create '%s' fs entry\n", | ||
| 212 | ACPI_BUTTON_FILE_INFO)); | ||
| 213 | else { | 208 | else { |
| 214 | entry->proc_fops = &acpi_button_info_fops; | 209 | entry->proc_fops = &acpi_button_info_fops; |
| 215 | entry->data = acpi_driver_data(device); | 210 | entry->data = acpi_driver_data(device); |
| @@ -221,9 +216,7 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
| 221 | entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, | 216 | entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, |
| 222 | S_IRUGO, acpi_device_dir(device)); | 217 | S_IRUGO, acpi_device_dir(device)); |
| 223 | if (!entry) | 218 | if (!entry) |
| 224 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 219 | return -ENODEV; |
| 225 | "Unable to create '%s' fs entry\n", | ||
| 226 | ACPI_BUTTON_FILE_INFO)); | ||
| 227 | else { | 220 | else { |
| 228 | entry->proc_fops = &acpi_button_state_fops; | 221 | entry->proc_fops = &acpi_button_state_fops; |
| 229 | entry->data = acpi_driver_data(device); | 222 | entry->data = acpi_driver_data(device); |
| @@ -231,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
| 231 | } | 224 | } |
| 232 | } | 225 | } |
| 233 | 226 | ||
| 234 | return_VALUE(0); | 227 | return 0; |
| 235 | } | 228 | } |
| 236 | 229 | ||
| 237 | static int acpi_button_remove_fs(struct acpi_device *device) | 230 | static int acpi_button_remove_fs(struct acpi_device *device) |
| 238 | { | 231 | { |
| 239 | struct acpi_button *button = NULL; | 232 | struct acpi_button *button = NULL; |
| 240 | 233 | ||
| 241 | ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); | ||
| 242 | 234 | ||
| 243 | button = acpi_driver_data(device); | 235 | button = acpi_driver_data(device); |
| 244 | if (acpi_device_dir(device)) { | 236 | if (acpi_device_dir(device)) { |
| @@ -253,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) | |||
| 253 | acpi_device_dir(device) = NULL; | 245 | acpi_device_dir(device) = NULL; |
| 254 | } | 246 | } |
| 255 | 247 | ||
| 256 | return_VALUE(0); | 248 | return 0; |
| 257 | } | 249 | } |
| 258 | 250 | ||
| 259 | /* -------------------------------------------------------------------------- | 251 | /* -------------------------------------------------------------------------- |
| @@ -264,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | |||
| 264 | { | 256 | { |
| 265 | struct acpi_button *button = (struct acpi_button *)data; | 257 | struct acpi_button *button = (struct acpi_button *)data; |
| 266 | 258 | ||
| 267 | ACPI_FUNCTION_TRACE("acpi_button_notify"); | ||
| 268 | 259 | ||
| 269 | if (!button || !button->device) | 260 | if (!button || !button->device) |
| 270 | return_VOID; | 261 | return; |
| 271 | 262 | ||
| 272 | switch (event) { | 263 | switch (event) { |
| 273 | case ACPI_BUTTON_NOTIFY_STATUS: | 264 | case ACPI_BUTTON_NOTIFY_STATUS: |
| @@ -280,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | |||
| 280 | break; | 271 | break; |
| 281 | } | 272 | } |
| 282 | 273 | ||
| 283 | return_VOID; | 274 | return; |
| 284 | } | 275 | } |
| 285 | 276 | ||
| 286 | static acpi_status acpi_button_notify_fixed(void *data) | 277 | static acpi_status acpi_button_notify_fixed(void *data) |
| 287 | { | 278 | { |
| 288 | struct acpi_button *button = (struct acpi_button *)data; | 279 | struct acpi_button *button = (struct acpi_button *)data; |
| 289 | 280 | ||
| 290 | ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); | ||
| 291 | 281 | ||
| 292 | if (!button) | 282 | if (!button) |
| 293 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 283 | return AE_BAD_PARAMETER; |
| 294 | 284 | ||
| 295 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); | 285 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); |
| 296 | 286 | ||
| 297 | return_ACPI_STATUS(AE_OK); | 287 | return AE_OK; |
| 298 | } | 288 | } |
| 299 | 289 | ||
| 300 | static int acpi_button_add(struct acpi_device *device) | 290 | static int acpi_button_add(struct acpi_device *device) |
| @@ -303,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 303 | acpi_status status = AE_OK; | 293 | acpi_status status = AE_OK; |
| 304 | struct acpi_button *button = NULL; | 294 | struct acpi_button *button = NULL; |
| 305 | 295 | ||
| 306 | ACPI_FUNCTION_TRACE("acpi_button_add"); | ||
| 307 | 296 | ||
| 308 | if (!device) | 297 | if (!device) |
| 309 | return_VALUE(-EINVAL); | 298 | return -EINVAL; |
| 310 | 299 | ||
| 311 | button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); | 300 | button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); |
| 312 | if (!button) | 301 | if (!button) |
| 313 | return_VALUE(-ENOMEM); | 302 | return -ENOMEM; |
| 314 | memset(button, 0, sizeof(struct acpi_button)); | 303 | memset(button, 0, sizeof(struct acpi_button)); |
| 315 | 304 | ||
| 316 | button->device = device; | 305 | button->device = device; |
| @@ -349,8 +338,8 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 349 | sprintf(acpi_device_class(device), "%s/%s", | 338 | sprintf(acpi_device_class(device), "%s/%s", |
| 350 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); | 339 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
| 351 | } else { | 340 | } else { |
| 352 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", | 341 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", |
| 353 | acpi_device_hid(device))); | 342 | acpi_device_hid(device)); |
| 354 | result = -ENODEV; | 343 | result = -ENODEV; |
| 355 | goto end; | 344 | goto end; |
| 356 | } | 345 | } |
| @@ -381,8 +370,6 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 381 | } | 370 | } |
| 382 | 371 | ||
| 383 | if (ACPI_FAILURE(status)) { | 372 | if (ACPI_FAILURE(status)) { |
| 384 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
| 385 | "Error installing notify handler\n")); | ||
| 386 | result = -ENODEV; | 373 | result = -ENODEV; |
| 387 | goto end; | 374 | goto end; |
| 388 | } | 375 | } |
| @@ -406,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
| 406 | kfree(button); | 393 | kfree(button); |
| 407 | } | 394 | } |
| 408 | 395 | ||
| 409 | return_VALUE(result); | 396 | return result; |
| 410 | } | 397 | } |
| 411 | 398 | ||
| 412 | static int acpi_button_remove(struct acpi_device *device, int type) | 399 | static int acpi_button_remove(struct acpi_device *device, int type) |
| @@ -414,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
| 414 | acpi_status status = 0; | 401 | acpi_status status = 0; |
| 415 | struct acpi_button *button = NULL; | 402 | struct acpi_button *button = NULL; |
| 416 | 403 | ||
| 417 | ACPI_FUNCTION_TRACE("acpi_button_remove"); | ||
| 418 | 404 | ||
| 419 | if (!device || !acpi_driver_data(device)) | 405 | if (!device || !acpi_driver_data(device)) |
| 420 | return_VALUE(-EINVAL); | 406 | return -EINVAL; |
| 421 | 407 | ||
| 422 | button = acpi_driver_data(device); | 408 | button = acpi_driver_data(device); |
| 423 | 409 | ||
| @@ -440,39 +426,33 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
| 440 | break; | 426 | break; |
| 441 | } | 427 | } |
| 442 | 428 | ||
| 443 | if (ACPI_FAILURE(status)) | ||
| 444 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
| 445 | "Error removing notify handler\n")); | ||
| 446 | |||
| 447 | acpi_button_remove_fs(device); | 429 | acpi_button_remove_fs(device); |
| 448 | 430 | ||
| 449 | kfree(button); | 431 | kfree(button); |
| 450 | 432 | ||
| 451 | return_VALUE(0); | 433 | return 0; |
| 452 | } | 434 | } |
| 453 | 435 | ||
| 454 | static int __init acpi_button_init(void) | 436 | static int __init acpi_button_init(void) |
| 455 | { | 437 | { |
| 456 | int result = 0; | 438 | int result = 0; |
| 457 | 439 | ||
| 458 | ACPI_FUNCTION_TRACE("acpi_button_init"); | ||
| 459 | 440 | ||
| 460 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | 441 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); |
| 461 | if (!acpi_button_dir) | 442 | if (!acpi_button_dir) |
| 462 | return_VALUE(-ENODEV); | 443 | return -ENODEV; |
| 463 | acpi_button_dir->owner = THIS_MODULE; | 444 | acpi_button_dir->owner = THIS_MODULE; |
| 464 | result = acpi_bus_register_driver(&acpi_button_driver); | 445 | result = acpi_bus_register_driver(&acpi_button_driver); |
| 465 | if (result < 0) { | 446 | if (result < 0) { |
| 466 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 447 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
| 467 | return_VALUE(-ENODEV); | 448 | return -ENODEV; |
| 468 | } | 449 | } |
| 469 | 450 | ||
| 470 | return_VALUE(0); | 451 | return 0; |
| 471 | } | 452 | } |
| 472 | 453 | ||
| 473 | static void __exit acpi_button_exit(void) | 454 | static void __exit acpi_button_exit(void) |
| 474 | { | 455 | { |
| 475 | ACPI_FUNCTION_TRACE("acpi_button_exit"); | ||
| 476 | 456 | ||
| 477 | acpi_bus_unregister_driver(&acpi_button_driver); | 457 | acpi_bus_unregister_driver(&acpi_button_driver); |
| 478 | 458 | ||
| @@ -484,7 +464,7 @@ static void __exit acpi_button_exit(void) | |||
| 484 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); | 464 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); |
| 485 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 465 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
| 486 | 466 | ||
| 487 | return_VOID; | 467 | return; |
| 488 | } | 468 | } |
| 489 | 469 | ||
| 490 | module_init(acpi_button_init); | 470 | module_init(acpi_button_init); |
