aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hotkey.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/hotkey.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/hotkey.c')
-rw-r--r--drivers/acpi/hotkey.c233
1 files changed, 122 insertions, 111 deletions
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c
index 1f76a40badec..2e2e4051dfa7 100644
--- a/drivers/acpi/hotkey.c
+++ b/drivers/acpi/hotkey.c
@@ -62,7 +62,7 @@
62#define _COMPONENT ACPI_HOTKEY_COMPONENT 62#define _COMPONENT ACPI_HOTKEY_COMPONENT
63ACPI_MODULE_NAME("acpi_hotkey") 63ACPI_MODULE_NAME("acpi_hotkey")
64 64
65MODULE_AUTHOR("luming.yu@intel.com"); 65 MODULE_AUTHOR("luming.yu@intel.com");
66MODULE_DESCRIPTION(ACPI_HOTK_NAME); 66MODULE_DESCRIPTION(ACPI_HOTK_NAME);
67MODULE_LICENSE("GPL"); 67MODULE_LICENSE("GPL");
68 68
@@ -180,8 +180,8 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset);
180static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset); 180static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
181static int hotkey_polling_open_fs(struct inode *inode, struct file *file); 181static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
182static union acpi_hotkey *get_hotkey_by_event(struct 182static union acpi_hotkey *get_hotkey_by_event(struct
183 acpi_hotkey_list 183 acpi_hotkey_list
184 *hotkey_list, int event); 184 *hotkey_list, int event);
185 185
186/* event based config */ 186/* event based config */
187static struct file_operations hotkey_config_fops = { 187static struct file_operations hotkey_config_fops = {
@@ -246,7 +246,7 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file)
246static char *format_result(union acpi_object *object) 246static char *format_result(union acpi_object *object)
247{ 247{
248 char *buf = NULL; 248 char *buf = NULL;
249 249
250 buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL); 250 buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL);
251 if (buf) 251 if (buf)
252 memset(buf, 0, RESULT_STR_LEN); 252 memset(buf, 0, RESULT_STR_LEN);
@@ -256,7 +256,7 @@ static char *format_result(union acpi_object *object)
256 /* Now, just support integer type */ 256 /* Now, just support integer type */
257 if (object->type == ACPI_TYPE_INTEGER) 257 if (object->type == ACPI_TYPE_INTEGER)
258 sprintf(buf, "%d\n", (u32) object->integer.value); 258 sprintf(buf, "%d\n", (u32) object->integer.value);
259do_fail: 259 do_fail:
260 return (buf); 260 return (buf);
261} 261}
262 262
@@ -268,9 +268,9 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
268 268
269 ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); 269 ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
270 270
271 if (poll_hotkey->poll_result){ 271 if (poll_hotkey->poll_result) {
272 buf = format_result(poll_hotkey->poll_result); 272 buf = format_result(poll_hotkey->poll_result);
273 if(buf) 273 if (buf)
274 seq_printf(seq, "%s", buf); 274 seq_printf(seq, "%s", buf);
275 kfree(buf); 275 kfree(buf);
276 } 276 }
@@ -299,7 +299,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
299 union acpi_hotkey *key = 299 union acpi_hotkey *key =
300 container_of(entries, union acpi_hotkey, entries); 300 container_of(entries, union acpi_hotkey, entries);
301 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT 301 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
302 && key->event_hotkey.external_hotkey_num == event){ 302 && key->event_hotkey.external_hotkey_num == event) {
303 val = key->link.hotkey_standard_num; 303 val = key->link.hotkey_standard_num;
304 break; 304 break;
305 } 305 }
@@ -343,7 +343,7 @@ static int auto_hotkey_remove(struct acpi_device *device, int type)
343static int create_polling_proc(union acpi_hotkey *device) 343static int create_polling_proc(union acpi_hotkey *device)
344{ 344{
345 struct proc_dir_entry *proc; 345 struct proc_dir_entry *proc;
346 char proc_name[80]; 346 char proc_name[80];
347 mode_t mode; 347 mode_t mode;
348 348
349 ACPI_FUNCTION_TRACE("create_polling_proc"); 349 ACPI_FUNCTION_TRACE("create_polling_proc");
@@ -351,8 +351,8 @@ static int create_polling_proc(union acpi_hotkey *device)
351 351
352 sprintf(proc_name, "%d", device->link.hotkey_standard_num); 352 sprintf(proc_name, "%d", device->link.hotkey_standard_num);
353 /* 353 /*
354 strcat(proc_name, device->poll_hotkey.poll_method); 354 strcat(proc_name, device->poll_hotkey.poll_method);
355 */ 355 */
356 proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); 356 proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
357 357
358 if (!proc) { 358 if (!proc) {
@@ -415,50 +415,50 @@ static int hotkey_remove(union acpi_hotkey *device)
415 return_VALUE(0); 415 return_VALUE(0);
416} 416}
417 417
418static int hotkey_update(union acpi_hotkey *key) 418static int hotkey_update(union acpi_hotkey *key)
419{ 419{
420 struct list_head *entries; 420 struct list_head *entries;
421 421
422 ACPI_FUNCTION_TRACE("hotkey_update"); 422 ACPI_FUNCTION_TRACE("hotkey_update");
423 423
424 list_for_each(entries, global_hotkey_list.entries) { 424 list_for_each(entries, global_hotkey_list.entries) {
425 union acpi_hotkey *tmp= 425 union acpi_hotkey *tmp =
426 container_of(entries, union acpi_hotkey, entries); 426 container_of(entries, union acpi_hotkey, entries);
427 if (tmp->link.hotkey_standard_num == 427 if (tmp->link.hotkey_standard_num ==
428 key->link.hotkey_standard_num) { 428 key->link.hotkey_standard_num) {
429 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { 429 if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
430 free_hotkey_buffer(tmp); 430 free_hotkey_buffer(tmp);
431 tmp->event_hotkey.bus_handle = 431 tmp->event_hotkey.bus_handle =
432 key->event_hotkey.bus_handle; 432 key->event_hotkey.bus_handle;
433 tmp->event_hotkey.external_hotkey_num = 433 tmp->event_hotkey.external_hotkey_num =
434 key->event_hotkey.external_hotkey_num; 434 key->event_hotkey.external_hotkey_num;
435 tmp->event_hotkey.action_handle = 435 tmp->event_hotkey.action_handle =
436 key->event_hotkey.action_handle; 436 key->event_hotkey.action_handle;
437 tmp->event_hotkey.action_method = 437 tmp->event_hotkey.action_method =
438 key->event_hotkey.action_method; 438 key->event_hotkey.action_method;
439 kfree(key); 439 kfree(key);
440 } else { 440 } else {
441 /* 441 /*
442 char proc_name[80]; 442 char proc_name[80];
443 443
444 sprintf(proc_name, "%d", tmp->link.hotkey_standard_num); 444 sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
445 strcat(proc_name, tmp->poll_hotkey.poll_method); 445 strcat(proc_name, tmp->poll_hotkey.poll_method);
446 remove_proc_entry(proc_name,hotkey_proc_dir); 446 remove_proc_entry(proc_name,hotkey_proc_dir);
447 */ 447 */
448 free_poll_hotkey_buffer(tmp); 448 free_poll_hotkey_buffer(tmp);
449 tmp->poll_hotkey.poll_handle = 449 tmp->poll_hotkey.poll_handle =
450 key->poll_hotkey.poll_handle; 450 key->poll_hotkey.poll_handle;
451 tmp->poll_hotkey.poll_method = 451 tmp->poll_hotkey.poll_method =
452 key->poll_hotkey.poll_method; 452 key->poll_hotkey.poll_method;
453 tmp->poll_hotkey.action_handle = 453 tmp->poll_hotkey.action_handle =
454 key->poll_hotkey.action_handle; 454 key->poll_hotkey.action_handle;
455 tmp->poll_hotkey.action_method = 455 tmp->poll_hotkey.action_method =
456 key->poll_hotkey.action_method; 456 key->poll_hotkey.action_method;
457 tmp->poll_hotkey.poll_result = 457 tmp->poll_hotkey.poll_result =
458 key->poll_hotkey.poll_result; 458 key->poll_hotkey.poll_result;
459 /* 459 /*
460 create_polling_proc(tmp); 460 create_polling_proc(tmp);
461 */ 461 */
462 kfree(key); 462 kfree(key);
463 } 463 }
464 return_VALUE(0); 464 return_VALUE(0);
@@ -483,27 +483,25 @@ static void free_hotkey_device(union acpi_hotkey *key)
483 acpi_hotkey_notify_handler); 483 acpi_hotkey_notify_handler);
484 free_hotkey_buffer(key); 484 free_hotkey_buffer(key);
485 } else { 485 } else {
486 char proc_name[80]; 486 char proc_name[80];
487 487
488 sprintf(proc_name, "%d", key->link.hotkey_standard_num); 488 sprintf(proc_name, "%d", key->link.hotkey_standard_num);
489 /* 489 /*
490 strcat(proc_name, key->poll_hotkey.poll_method); 490 strcat(proc_name, key->poll_hotkey.poll_method);
491 */ 491 */
492 remove_proc_entry(proc_name,hotkey_proc_dir); 492 remove_proc_entry(proc_name, hotkey_proc_dir);
493 free_poll_hotkey_buffer(key); 493 free_poll_hotkey_buffer(key);
494 } 494 }
495 kfree(key); 495 kfree(key);
496 return_VOID; 496 return_VOID;
497} 497}
498 498
499static void 499static void free_hotkey_buffer(union acpi_hotkey *key)
500free_hotkey_buffer(union acpi_hotkey *key)
501{ 500{
502 kfree(key->event_hotkey.action_method); 501 kfree(key->event_hotkey.action_method);
503} 502}
504 503
505static void 504static void free_poll_hotkey_buffer(union acpi_hotkey *key)
506free_poll_hotkey_buffer(union acpi_hotkey *key)
507{ 505{
508 kfree(key->poll_hotkey.action_method); 506 kfree(key->poll_hotkey.action_method);
509 kfree(key->poll_hotkey.poll_method); 507 kfree(key->poll_hotkey.poll_method);
@@ -513,15 +511,15 @@ static int
513init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, 511init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
514 char *method, int std_num, int external_num) 512 char *method, int std_num, int external_num)
515{ 513{
516 acpi_handle tmp_handle; 514 acpi_handle tmp_handle;
517 acpi_status status = AE_OK; 515 acpi_status status = AE_OK;
518 516
519 ACPI_FUNCTION_TRACE("init_hotkey_device"); 517 ACPI_FUNCTION_TRACE("init_hotkey_device");
520 518
521 if(std_num < 0 || IS_POLL(std_num) || !key ) 519 if (std_num < 0 || IS_POLL(std_num) || !key)
522 goto do_fail; 520 goto do_fail;
523 521
524 if(!bus_str || !action_str || !method) 522 if (!bus_str || !action_str || !method)
525 goto do_fail; 523 goto do_fail;
526 524
527 key->link.hotkey_type = ACPI_HOTKEY_EVENT; 525 key->link.hotkey_type = ACPI_HOTKEY_EVENT;
@@ -529,19 +527,22 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
529 key->event_hotkey.flag = 0; 527 key->event_hotkey.flag = 0;
530 key->event_hotkey.action_method = method; 528 key->event_hotkey.action_method = method;
531 529
532 status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle)); 530 status =
533 if(ACPI_FAILURE(status)) 531 acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle));
532 if (ACPI_FAILURE(status))
534 goto do_fail; 533 goto do_fail;
535 key->event_hotkey.external_hotkey_num = external_num; 534 key->event_hotkey.external_hotkey_num = external_num;
536 status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle)); 535 status =
537 if(ACPI_FAILURE(status)) 536 acpi_get_handle(NULL, action_str,
537 &(key->event_hotkey.action_handle));
538 if (ACPI_FAILURE(status))
538 goto do_fail; 539 goto do_fail;
539 status = acpi_get_handle(key->event_hotkey.action_handle, 540 status = acpi_get_handle(key->event_hotkey.action_handle,
540 method, &tmp_handle); 541 method, &tmp_handle);
541 if (ACPI_FAILURE(status)) 542 if (ACPI_FAILURE(status))
542 goto do_fail; 543 goto do_fail;
543 return_VALUE(AE_OK); 544 return_VALUE(AE_OK);
544do_fail: 545 do_fail:
545 return_VALUE(-ENODEV); 546 return_VALUE(-ENODEV);
546} 547}
547 548
@@ -552,14 +553,14 @@ init_poll_hotkey_device(union acpi_hotkey *key,
552 char *action_str, char *action_method, int std_num) 553 char *action_str, char *action_method, int std_num)
553{ 554{
554 acpi_status status = AE_OK; 555 acpi_status status = AE_OK;
555 acpi_handle tmp_handle; 556 acpi_handle tmp_handle;
556 557
557 ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); 558 ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
558 559
559 if(std_num < 0 || IS_EVENT(std_num) || !key) 560 if (std_num < 0 || IS_EVENT(std_num) || !key)
560 goto do_fail; 561 goto do_fail;
561 562
562 if(!poll_str || !poll_method || !action_str || !action_method) 563 if (!poll_str || !poll_method || !action_str || !action_method)
563 goto do_fail; 564 goto do_fail;
564 565
565 key->link.hotkey_type = ACPI_HOTKEY_POLLING; 566 key->link.hotkey_type = ACPI_HOTKEY_POLLING;
@@ -568,30 +569,32 @@ init_poll_hotkey_device(union acpi_hotkey *key,
568 key->poll_hotkey.poll_method = poll_method; 569 key->poll_hotkey.poll_method = poll_method;
569 key->poll_hotkey.action_method = action_method; 570 key->poll_hotkey.action_method = action_method;
570 571
571 status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle)); 572 status =
572 if(ACPI_FAILURE(status)) 573 acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle));
574 if (ACPI_FAILURE(status))
573 goto do_fail; 575 goto do_fail;
574 status = acpi_get_handle(key->poll_hotkey.poll_handle, 576 status = acpi_get_handle(key->poll_hotkey.poll_handle,
575 poll_method, &tmp_handle); 577 poll_method, &tmp_handle);
576 if (ACPI_FAILURE(status)) 578 if (ACPI_FAILURE(status))
577 goto do_fail; 579 goto do_fail;
578 status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle)); 580 status =
581 acpi_get_handle(NULL, action_str,
582 &(key->poll_hotkey.action_handle));
579 if (ACPI_FAILURE(status)) 583 if (ACPI_FAILURE(status))
580 goto do_fail; 584 goto do_fail;
581 status = acpi_get_handle(key->poll_hotkey.action_handle, 585 status = acpi_get_handle(key->poll_hotkey.action_handle,
582 action_method, &tmp_handle); 586 action_method, &tmp_handle);
583 if (ACPI_FAILURE(status)) 587 if (ACPI_FAILURE(status))
584 goto do_fail; 588 goto do_fail;
585 key->poll_hotkey.poll_result = 589 key->poll_hotkey.poll_result =
586 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); 590 (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
587 if(!key->poll_hotkey.poll_result) 591 if (!key->poll_hotkey.poll_result)
588 goto do_fail; 592 goto do_fail;
589 return_VALUE(AE_OK); 593 return_VALUE(AE_OK);
590do_fail: 594 do_fail:
591 return_VALUE(-ENODEV); 595 return_VALUE(-ENODEV);
592} 596}
593 597
594
595static int hotkey_open_config(struct inode *inode, struct file *file) 598static int hotkey_open_config(struct inode *inode, struct file *file)
596{ 599{
597 ACPI_FUNCTION_TRACE("hotkey_open_config"); 600 ACPI_FUNCTION_TRACE("hotkey_open_config");
@@ -679,8 +682,9 @@ get_parms(char *config_record,
679 682
680 sscanf(config_record, "%d", cmd); 683 sscanf(config_record, "%d", cmd);
681 684
682 if(*cmd == 1){ 685 if (*cmd == 1) {
683 if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2) 686 if (sscanf(config_record, "%d:%d", cmd, internal_event_num) !=
687 2)
684 goto do_fail; 688 goto do_fail;
685 else 689 else
686 return (6); 690 return (6);
@@ -694,8 +698,8 @@ get_parms(char *config_record,
694 goto do_fail; 698 goto do_fail;
695 699
696 count = tmp1 - tmp; 700 count = tmp1 - tmp;
697 *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL); 701 *bus_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
698 if(!*bus_handle) 702 if (!*bus_handle)
699 goto do_fail; 703 goto do_fail;
700 strncpy(*bus_handle, tmp, count); 704 strncpy(*bus_handle, tmp, count);
701 *(*bus_handle + count) = 0; 705 *(*bus_handle + count) = 0;
@@ -706,8 +710,8 @@ get_parms(char *config_record,
706 if (!tmp1) 710 if (!tmp1)
707 goto do_fail; 711 goto do_fail;
708 count = tmp1 - tmp; 712 count = tmp1 - tmp;
709 *bus_method = (char *) kmalloc(count+1, GFP_KERNEL); 713 *bus_method = (char *)kmalloc(count + 1, GFP_KERNEL);
710 if(!*bus_method) 714 if (!*bus_method)
711 goto do_fail; 715 goto do_fail;
712 strncpy(*bus_method, tmp, count); 716 strncpy(*bus_method, tmp, count);
713 *(*bus_method + count) = 0; 717 *(*bus_method + count) = 0;
@@ -718,7 +722,7 @@ get_parms(char *config_record,
718 if (!tmp1) 722 if (!tmp1)
719 goto do_fail; 723 goto do_fail;
720 count = tmp1 - tmp; 724 count = tmp1 - tmp;
721 *action_handle = (char *) kmalloc(count+1, GFP_KERNEL); 725 *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
722 strncpy(*action_handle, tmp, count); 726 strncpy(*action_handle, tmp, count);
723 *(*action_handle + count) = 0; 727 *(*action_handle + count) = 0;
724 728
@@ -728,17 +732,18 @@ get_parms(char *config_record,
728 if (!tmp1) 732 if (!tmp1)
729 goto do_fail; 733 goto do_fail;
730 count = tmp1 - tmp; 734 count = tmp1 - tmp;
731 *method = (char *) kmalloc(count+1, GFP_KERNEL); 735 *method = (char *)kmalloc(count + 1, GFP_KERNEL);
732 if(!*method) 736 if (!*method)
733 goto do_fail; 737 goto do_fail;
734 strncpy(*method, tmp, count); 738 strncpy(*method, tmp, count);
735 *(*method + count) = 0; 739 *(*method + count) = 0;
736 740
737 if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0) 741 if (sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num) <=
742 0)
738 goto do_fail; 743 goto do_fail;
739 744
740 return_VALUE(6); 745 return_VALUE(6);
741do_fail: 746 do_fail:
742 return_VALUE(-1); 747 return_VALUE(-1);
743} 748}
744 749
@@ -758,8 +763,8 @@ static ssize_t hotkey_write_config(struct file *file,
758 763
759 ACPI_FUNCTION_TRACE(("hotkey_write_config")); 764 ACPI_FUNCTION_TRACE(("hotkey_write_config"));
760 765
761 config_record = (char *) kmalloc(count+1, GFP_KERNEL); 766 config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
762 if(!config_record) 767 if (!config_record)
763 return_VALUE(-ENOMEM); 768 return_VALUE(-ENOMEM);
764 769
765 if (copy_from_user(config_record, buffer, count)) { 770 if (copy_from_user(config_record, buffer, count)) {
@@ -777,10 +782,10 @@ static ssize_t hotkey_write_config(struct file *file,
777 &method, &internal_event_num, &external_event_num); 782 &method, &internal_event_num, &external_event_num);
778 783
779 kfree(config_record); 784 kfree(config_record);
780 if(IS_OTHERS(internal_event_num)) 785 if (IS_OTHERS(internal_event_num))
781 goto do_fail; 786 goto do_fail;
782 if (ret != 6) { 787 if (ret != 6) {
783do_fail: 788 do_fail:
784 kfree(bus_handle); 789 kfree(bus_handle);
785 kfree(bus_method); 790 kfree(bus_method);
786 kfree(action_handle); 791 kfree(action_handle);
@@ -791,14 +796,14 @@ do_fail:
791 } 796 }
792 797
793 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); 798 key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
794 if(!key) 799 if (!key)
795 goto do_fail; 800 goto do_fail;
796 memset(key, 0, sizeof(union acpi_hotkey)); 801 memset(key, 0, sizeof(union acpi_hotkey));
797 if(cmd == 1) { 802 if (cmd == 1) {
798 union acpi_hotkey *tmp = NULL; 803 union acpi_hotkey *tmp = NULL;
799 tmp = get_hotkey_by_event(&global_hotkey_list, 804 tmp = get_hotkey_by_event(&global_hotkey_list,
800 internal_event_num); 805 internal_event_num);
801 if(!tmp) 806 if (!tmp)
802 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); 807 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
803 else 808 else
804 memcpy(key, tmp, sizeof(union acpi_hotkey)); 809 memcpy(key, tmp, sizeof(union acpi_hotkey));
@@ -807,15 +812,16 @@ do_fail:
807 if (IS_EVENT(internal_event_num)) { 812 if (IS_EVENT(internal_event_num)) {
808 kfree(bus_method); 813 kfree(bus_method);
809 ret = init_hotkey_device(key, bus_handle, action_handle, method, 814 ret = init_hotkey_device(key, bus_handle, action_handle, method,
810 internal_event_num, external_event_num); 815 internal_event_num,
816 external_event_num);
811 } else 817 } else
812 ret = init_poll_hotkey_device(key, bus_handle, bus_method, 818 ret = init_poll_hotkey_device(key, bus_handle, bus_method,
813 action_handle, method, 819 action_handle, method,
814 internal_event_num); 820 internal_event_num);
815 if (ret) { 821 if (ret) {
816 kfree(bus_handle); 822 kfree(bus_handle);
817 kfree(action_handle); 823 kfree(action_handle);
818 if(IS_EVENT(internal_event_num)) 824 if (IS_EVENT(internal_event_num))
819 free_hotkey_buffer(key); 825 free_hotkey_buffer(key);
820 else 826 else
821 free_poll_hotkey_buffer(key); 827 free_poll_hotkey_buffer(key);
@@ -824,13 +830,14 @@ do_fail:
824 return_VALUE(-EINVAL); 830 return_VALUE(-EINVAL);
825 } 831 }
826 832
827cont_cmd: 833 cont_cmd:
828 kfree(bus_handle); 834 kfree(bus_handle);
829 kfree(action_handle); 835 kfree(action_handle);
830 836
831 switch (cmd) { 837 switch (cmd) {
832 case 0: 838 case 0:
833 if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num)) 839 if (get_hotkey_by_event
840 (&global_hotkey_list, key->link.hotkey_standard_num))
834 goto fail_out; 841 goto fail_out;
835 else 842 else
836 hotkey_add(key); 843 hotkey_add(key);
@@ -839,7 +846,7 @@ cont_cmd:
839 hotkey_remove(key); 846 hotkey_remove(key);
840 break; 847 break;
841 case 2: 848 case 2:
842 if(hotkey_update(key)) 849 if (hotkey_update(key))
843 goto fail_out; 850 goto fail_out;
844 break; 851 break;
845 default: 852 default:
@@ -847,8 +854,8 @@ cont_cmd:
847 break; 854 break;
848 } 855 }
849 return_VALUE(count); 856 return_VALUE(count);
850fail_out: 857 fail_out:
851 if(IS_EVENT(internal_event_num)) 858 if (IS_EVENT(internal_event_num))
852 free_hotkey_buffer(key); 859 free_hotkey_buffer(key);
853 else 860 else
854 free_poll_hotkey_buffer(key); 861 free_poll_hotkey_buffer(key);
@@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
882 return_VALUE(status == AE_OK); 889 return_VALUE(status == AE_OK);
883} 890}
884 891
885static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val) 892static int read_acpi_int(acpi_handle handle, const char *method,
893 union acpi_object *val)
886{ 894{
887 struct acpi_buffer output; 895 struct acpi_buffer output;
888 union acpi_object out_obj; 896 union acpi_object out_obj;
@@ -893,7 +901,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
893 output.pointer = &out_obj; 901 output.pointer = &out_obj;
894 902
895 status = acpi_evaluate_object(handle, (char *)method, NULL, &output); 903 status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
896 if(val){ 904 if (val) {
897 val->integer.value = out_obj.integer.value; 905 val->integer.value = out_obj.integer.value;
898 val->type = out_obj.type; 906 val->type = out_obj.type;
899 } else 907 } else
@@ -903,8 +911,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
903} 911}
904 912
905static union acpi_hotkey *get_hotkey_by_event(struct 913static union acpi_hotkey *get_hotkey_by_event(struct
906 acpi_hotkey_list 914 acpi_hotkey_list
907 *hotkey_list, int event) 915 *hotkey_list, int event)
908{ 916{
909 struct list_head *entries; 917 struct list_head *entries;
910 918
@@ -912,10 +920,10 @@ static union acpi_hotkey *get_hotkey_by_event(struct
912 union acpi_hotkey *key = 920 union acpi_hotkey *key =
913 container_of(entries, union acpi_hotkey, entries); 921 container_of(entries, union acpi_hotkey, entries);
914 if (key->link.hotkey_standard_num == event) { 922 if (key->link.hotkey_standard_num == event) {
915 return(key); 923 return (key);
916 } 924 }
917 } 925 }
918 return(NULL); 926 return (NULL);
919} 927}
920 928
921/* 929/*
@@ -932,15 +940,15 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
932{ 940{
933 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; 941 struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
934 char *arg; 942 char *arg;
935 int event,method_type,type, value; 943 int event, method_type, type, value;
936 union acpi_hotkey *key; 944 union acpi_hotkey *key;
937 945
938 ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); 946 ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
939 947
940 arg = (char *) kmalloc(count+1, GFP_KERNEL); 948 arg = (char *)kmalloc(count + 1, GFP_KERNEL);
941 if(!arg) 949 if (!arg)
942 return_VALUE(-ENOMEM); 950 return_VALUE(-ENOMEM);
943 arg[count]=0; 951 arg[count] = 0;
944 952
945 if (copy_from_user(arg, buffer, count)) { 953 if (copy_from_user(arg, buffer, count)) {
946 kfree(arg); 954 kfree(arg);
@@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
948 return_VALUE(-EINVAL); 956 return_VALUE(-EINVAL);
949 } 957 }
950 958
951 if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { 959 if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
960 4) {
952 kfree(arg); 961 kfree(arg);
953 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); 962 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
954 return_VALUE(-EINVAL); 963 return_VALUE(-EINVAL);
@@ -956,19 +965,21 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
956 kfree(arg); 965 kfree(arg);
957 if (type == ACPI_TYPE_INTEGER) { 966 if (type == ACPI_TYPE_INTEGER) {
958 key = get_hotkey_by_event(hotkey_list, event); 967 key = get_hotkey_by_event(hotkey_list, event);
959 if(!key) 968 if (!key)
960 goto do_fail; 969 goto do_fail;
961 if (IS_EVENT(event)) 970 if (IS_EVENT(event))
962 write_acpi_int(key->event_hotkey.action_handle, 971 write_acpi_int(key->event_hotkey.action_handle,
963 key->event_hotkey.action_method, value, NULL); 972 key->event_hotkey.action_method, value,
973 NULL);
964 else if (IS_POLL(event)) { 974 else if (IS_POLL(event)) {
965 if ( method_type == POLL_METHOD ) 975 if (method_type == POLL_METHOD)
966 read_acpi_int(key->poll_hotkey.poll_handle, 976 read_acpi_int(key->poll_hotkey.poll_handle,
967 key->poll_hotkey.poll_method, 977 key->poll_hotkey.poll_method,
968 key->poll_hotkey.poll_result); 978 key->poll_hotkey.poll_result);
969 else if ( method_type == ACTION_METHOD ) 979 else if (method_type == ACTION_METHOD)
970 write_acpi_int(key->poll_hotkey.action_handle, 980 write_acpi_int(key->poll_hotkey.action_handle,
971 key->poll_hotkey.action_method, value, NULL); 981 key->poll_hotkey.action_method,
982 value, NULL);
972 else 983 else
973 goto do_fail; 984 goto do_fail;
974 985
@@ -978,7 +989,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
978 return_VALUE(-EINVAL); 989 return_VALUE(-EINVAL);
979 } 990 }
980 return_VALUE(count); 991 return_VALUE(count);
981do_fail: 992 do_fail:
982 return_VALUE(-EINVAL); 993 return_VALUE(-EINVAL);
983 994
984} 995}
@@ -1074,15 +1085,15 @@ static int __init hotkey_init(void)
1074 1085
1075 return (0); 1086 return (0);
1076 1087
1077do_fail5: 1088 do_fail5:
1078 remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); 1089 remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
1079do_fail4: 1090 do_fail4:
1080 remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); 1091 remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
1081do_fail3: 1092 do_fail3:
1082 remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); 1093 remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
1083do_fail2: 1094 do_fail2:
1084 remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); 1095 remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
1085do_fail1: 1096 do_fail1:
1086 remove_proc_entry(HOTKEY_PROC, acpi_root_dir); 1097 remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
1087 return (-ENODEV); 1098 return (-ENODEV);
1088} 1099}