diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-12-21 19:20:01 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-24 00:14:51 -0500 |
commit | ff93be5dea548f16dcfe7b73ce5df7666efba92d (patch) | |
tree | eef8c5647c7b92363b4dde813b124f3a95de7765 /drivers | |
parent | 2370b5ed03030d554adb345778d5edecab7a510c (diff) |
asus_acpi: convert to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/asus_acpi.c | 321 |
1 files changed, 194 insertions, 127 deletions
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index 0c9c53111a22..c1d2aeeea948 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/proc_fs.h> | 37 | #include <linux/proc_fs.h> |
38 | #include <linux/seq_file.h> | ||
38 | #include <linux/backlight.h> | 39 | #include <linux/backlight.h> |
39 | #include <acpi/acpi_drivers.h> | 40 | #include <acpi/acpi_drivers.h> |
40 | #include <acpi/acpi_bus.h> | 41 | #include <acpi/acpi_bus.h> |
@@ -513,26 +514,12 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) | |||
513 | return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); | 514 | return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); |
514 | } | 515 | } |
515 | 516 | ||
516 | /* | 517 | static int asus_info_proc_show(struct seq_file *m, void *v) |
517 | * We write our info in page, we begin at offset off and cannot write more | ||
518 | * than count bytes. We set eof to 1 if we handle those 2 values. We return the | ||
519 | * number of bytes written in page | ||
520 | */ | ||
521 | static int | ||
522 | proc_read_info(char *page, char **start, off_t off, int count, int *eof, | ||
523 | void *data) | ||
524 | { | 518 | { |
525 | int len = 0; | ||
526 | int temp; | 519 | int temp; |
527 | char buf[16]; /* enough for all info */ | ||
528 | /* | ||
529 | * We use the easy way, we don't care of off and count, | ||
530 | * so we don't set eof to 1 | ||
531 | */ | ||
532 | 520 | ||
533 | len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); | 521 | seq_printf(m, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); |
534 | len += sprintf(page + len, "Model reference : %s\n", | 522 | seq_printf(m, "Model reference : %s\n", hotk->methods->name); |
535 | hotk->methods->name); | ||
536 | /* | 523 | /* |
537 | * The SFUN method probably allows the original driver to get the list | 524 | * The SFUN method probably allows the original driver to get the list |
538 | * of features supported by a given model. For now, 0x0100 or 0x0800 | 525 | * of features supported by a given model. For now, 0x0100 or 0x0800 |
@@ -540,8 +527,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
540 | * The significance of others is yet to be found. | 527 | * The significance of others is yet to be found. |
541 | */ | 528 | */ |
542 | if (read_acpi_int(hotk->handle, "SFUN", &temp)) | 529 | if (read_acpi_int(hotk->handle, "SFUN", &temp)) |
543 | len += | 530 | seq_printf(m, "SFUN value : 0x%04x\n", temp); |
544 | sprintf(page + len, "SFUN value : 0x%04x\n", temp); | ||
545 | /* | 531 | /* |
546 | * Another value for userspace: the ASYM method returns 0x02 for | 532 | * Another value for userspace: the ASYM method returns 0x02 for |
547 | * battery low and 0x04 for battery critical, its readings tend to be | 533 | * battery low and 0x04 for battery critical, its readings tend to be |
@@ -550,30 +536,34 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof, | |||
550 | * silently ignored. | 536 | * silently ignored. |
551 | */ | 537 | */ |
552 | if (read_acpi_int(hotk->handle, "ASYM", &temp)) | 538 | if (read_acpi_int(hotk->handle, "ASYM", &temp)) |
553 | len += | 539 | seq_printf(m, "ASYM value : 0x%04x\n", temp); |
554 | sprintf(page + len, "ASYM value : 0x%04x\n", temp); | ||
555 | if (asus_info) { | 540 | if (asus_info) { |
556 | snprintf(buf, 16, "%d", asus_info->length); | 541 | seq_printf(m, "DSDT length : %d\n", asus_info->length); |
557 | len += sprintf(page + len, "DSDT length : %s\n", buf); | 542 | seq_printf(m, "DSDT checksum : %d\n", asus_info->checksum); |
558 | snprintf(buf, 16, "%d", asus_info->checksum); | 543 | seq_printf(m, "DSDT revision : %d\n", asus_info->revision); |
559 | len += sprintf(page + len, "DSDT checksum : %s\n", buf); | 544 | seq_printf(m, "OEM id : %.*s\n", ACPI_OEM_ID_SIZE, asus_info->oem_id); |
560 | snprintf(buf, 16, "%d", asus_info->revision); | 545 | seq_printf(m, "OEM table id : %.*s\n", ACPI_OEM_TABLE_ID_SIZE, asus_info->oem_table_id); |
561 | len += sprintf(page + len, "DSDT revision : %s\n", buf); | 546 | seq_printf(m, "OEM revision : 0x%x\n", asus_info->oem_revision); |
562 | snprintf(buf, 7, "%s", asus_info->oem_id); | 547 | seq_printf(m, "ASL comp vendor id : %.*s\n", ACPI_NAME_SIZE, asus_info->asl_compiler_id); |
563 | len += sprintf(page + len, "OEM id : %s\n", buf); | 548 | seq_printf(m, "ASL comp revision : 0x%x\n", asus_info->asl_compiler_revision); |
564 | snprintf(buf, 9, "%s", asus_info->oem_table_id); | ||
565 | len += sprintf(page + len, "OEM table id : %s\n", buf); | ||
566 | snprintf(buf, 16, "%x", asus_info->oem_revision); | ||
567 | len += sprintf(page + len, "OEM revision : 0x%s\n", buf); | ||
568 | snprintf(buf, 5, "%s", asus_info->asl_compiler_id); | ||
569 | len += sprintf(page + len, "ASL comp vendor id : %s\n", buf); | ||
570 | snprintf(buf, 16, "%x", asus_info->asl_compiler_revision); | ||
571 | len += sprintf(page + len, "ASL comp revision : 0x%s\n", buf); | ||
572 | } | 549 | } |
573 | 550 | ||
574 | return len; | 551 | return 0; |
552 | } | ||
553 | |||
554 | static int asus_info_proc_open(struct inode *inode, struct file *file) | ||
555 | { | ||
556 | return single_open(file, asus_info_proc_show, NULL); | ||
575 | } | 557 | } |
576 | 558 | ||
559 | static const struct file_operations asus_info_proc_fops = { | ||
560 | .owner = THIS_MODULE, | ||
561 | .open = asus_info_proc_open, | ||
562 | .read = seq_read, | ||
563 | .llseek = seq_lseek, | ||
564 | .release = single_release, | ||
565 | }; | ||
566 | |||
577 | /* | 567 | /* |
578 | * /proc handlers | 568 | * /proc handlers |
579 | * We write our info in page, we begin at offset off and cannot write more | 569 | * We write our info in page, we begin at offset off and cannot write more |
@@ -639,34 +629,48 @@ write_led(const char __user *buffer, unsigned long count, | |||
639 | /* | 629 | /* |
640 | * Proc handlers for MLED | 630 | * Proc handlers for MLED |
641 | */ | 631 | */ |
642 | static int | 632 | static int mled_proc_show(struct seq_file *m, void *v) |
643 | proc_read_mled(char *page, char **start, off_t off, int count, int *eof, | ||
644 | void *data) | ||
645 | { | 633 | { |
646 | return sprintf(page, "%d\n", | 634 | seq_printf(m, "%d\n", read_led(hotk->methods->mled_status, MLED_ON)); |
647 | read_led(hotk->methods->mled_status, MLED_ON)); | 635 | return 0; |
648 | } | 636 | } |
649 | 637 | ||
650 | static int | 638 | static int mled_proc_open(struct inode *inode, struct file *file) |
651 | proc_write_mled(struct file *file, const char __user *buffer, | 639 | { |
652 | unsigned long count, void *data) | 640 | return single_open(file, mled_proc_show, NULL); |
641 | } | ||
642 | |||
643 | static ssize_t mled_proc_write(struct file *file, const char __user *buffer, | ||
644 | size_t count, loff_t *pos) | ||
653 | { | 645 | { |
654 | return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); | 646 | return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); |
655 | } | 647 | } |
656 | 648 | ||
649 | static const struct file_operations mled_proc_fops = { | ||
650 | .owner = THIS_MODULE, | ||
651 | .open = mled_proc_open, | ||
652 | .read = seq_read, | ||
653 | .llseek = seq_lseek, | ||
654 | .release = single_release, | ||
655 | .write = mled_proc_write, | ||
656 | }; | ||
657 | |||
657 | /* | 658 | /* |
658 | * Proc handlers for LED display | 659 | * Proc handlers for LED display |
659 | */ | 660 | */ |
660 | static int | 661 | static int ledd_proc_show(struct seq_file *m, void *v) |
661 | proc_read_ledd(char *page, char **start, off_t off, int count, int *eof, | ||
662 | void *data) | ||
663 | { | 662 | { |
664 | return sprintf(page, "0x%08x\n", hotk->ledd_status); | 663 | seq_printf(m, "0x%08x\n", hotk->ledd_status); |
664 | return 0; | ||
665 | } | 665 | } |
666 | 666 | ||
667 | static int | 667 | static int ledd_proc_open(struct inode *inode, struct file *file) |
668 | proc_write_ledd(struct file *file, const char __user *buffer, | 668 | { |
669 | unsigned long count, void *data) | 669 | return single_open(file, ledd_proc_show, NULL); |
670 | } | ||
671 | |||
672 | static ssize_t ledd_proc_write(struct file *file, const char __user *buffer, | ||
673 | size_t count, loff_t *pos) | ||
670 | { | 674 | { |
671 | int rv, value; | 675 | int rv, value; |
672 | 676 | ||
@@ -682,61 +686,104 @@ proc_write_ledd(struct file *file, const char __user *buffer, | |||
682 | return rv; | 686 | return rv; |
683 | } | 687 | } |
684 | 688 | ||
689 | static const struct file_operations ledd_proc_fops = { | ||
690 | .owner = THIS_MODULE, | ||
691 | .open = ledd_proc_open, | ||
692 | .read = seq_read, | ||
693 | .llseek = seq_lseek, | ||
694 | .release = single_release, | ||
695 | .write = ledd_proc_write, | ||
696 | }; | ||
697 | |||
685 | /* | 698 | /* |
686 | * Proc handlers for WLED | 699 | * Proc handlers for WLED |
687 | */ | 700 | */ |
688 | static int | 701 | static int wled_proc_show(struct seq_file *m, void *v) |
689 | proc_read_wled(char *page, char **start, off_t off, int count, int *eof, | ||
690 | void *data) | ||
691 | { | 702 | { |
692 | return sprintf(page, "%d\n", | 703 | seq_printf(m, "%d\n", read_led(hotk->methods->wled_status, WLED_ON)); |
693 | read_led(hotk->methods->wled_status, WLED_ON)); | 704 | return 0; |
694 | } | 705 | } |
695 | 706 | ||
696 | static int | 707 | static int wled_proc_open(struct inode *inode, struct file *file) |
697 | proc_write_wled(struct file *file, const char __user *buffer, | 708 | { |
698 | unsigned long count, void *data) | 709 | return single_open(file, wled_proc_show, NULL); |
710 | } | ||
711 | |||
712 | static ssize_t wled_proc_write(struct file *file, const char __user *buffer, | ||
713 | size_t count, loff_t *pos) | ||
699 | { | 714 | { |
700 | return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); | 715 | return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); |
701 | } | 716 | } |
702 | 717 | ||
718 | static const struct file_operations wled_proc_fops = { | ||
719 | .owner = THIS_MODULE, | ||
720 | .open = wled_proc_open, | ||
721 | .read = seq_read, | ||
722 | .llseek = seq_lseek, | ||
723 | .release = single_release, | ||
724 | .write = wled_proc_write, | ||
725 | }; | ||
726 | |||
703 | /* | 727 | /* |
704 | * Proc handlers for Bluetooth | 728 | * Proc handlers for Bluetooth |
705 | */ | 729 | */ |
706 | static int | 730 | static int bluetooth_proc_show(struct seq_file *m, void *v) |
707 | proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof, | ||
708 | void *data) | ||
709 | { | 731 | { |
710 | return sprintf(page, "%d\n", read_led(hotk->methods->bt_status, BT_ON)); | 732 | seq_printf(m, "%d\n", read_led(hotk->methods->bt_status, BT_ON)); |
733 | return 0; | ||
711 | } | 734 | } |
712 | 735 | ||
713 | static int | 736 | static int bluetooth_proc_open(struct inode *inode, struct file *file) |
714 | proc_write_bluetooth(struct file *file, const char __user *buffer, | 737 | { |
715 | unsigned long count, void *data) | 738 | return single_open(file, bluetooth_proc_show, NULL); |
739 | } | ||
740 | |||
741 | static ssize_t bluetooth_proc_write(struct file *file, | ||
742 | const char __user *buffer, size_t count, loff_t *pos) | ||
716 | { | 743 | { |
717 | /* Note: mt_bt_switch controls both internal Bluetooth adapter's | 744 | /* Note: mt_bt_switch controls both internal Bluetooth adapter's |
718 | presence and its LED */ | 745 | presence and its LED */ |
719 | return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0); | 746 | return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0); |
720 | } | 747 | } |
721 | 748 | ||
749 | static const struct file_operations bluetooth_proc_fops = { | ||
750 | .owner = THIS_MODULE, | ||
751 | .open = bluetooth_proc_open, | ||
752 | .read = seq_read, | ||
753 | .llseek = seq_lseek, | ||
754 | .release = single_release, | ||
755 | .write = bluetooth_proc_write, | ||
756 | }; | ||
757 | |||
722 | /* | 758 | /* |
723 | * Proc handlers for TLED | 759 | * Proc handlers for TLED |
724 | */ | 760 | */ |
725 | static int | 761 | static int tled_proc_show(struct seq_file *m, void *v) |
726 | proc_read_tled(char *page, char **start, off_t off, int count, int *eof, | ||
727 | void *data) | ||
728 | { | 762 | { |
729 | return sprintf(page, "%d\n", | 763 | seq_printf(m, "%d\n", read_led(hotk->methods->tled_status, TLED_ON)); |
730 | read_led(hotk->methods->tled_status, TLED_ON)); | 764 | return 0; |
731 | } | 765 | } |
732 | 766 | ||
733 | static int | 767 | static int tled_proc_open(struct inode *inode, struct file *file) |
734 | proc_write_tled(struct file *file, const char __user *buffer, | 768 | { |
735 | unsigned long count, void *data) | 769 | return single_open(file, tled_proc_show, NULL); |
770 | } | ||
771 | |||
772 | static ssize_t tled_proc_write(struct file *file, const char __user *buffer, | ||
773 | size_t count, loff_t *pos) | ||
736 | { | 774 | { |
737 | return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); | 775 | return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); |
738 | } | 776 | } |
739 | 777 | ||
778 | static const struct file_operations tled_proc_fops = { | ||
779 | .owner = THIS_MODULE, | ||
780 | .open = tled_proc_open, | ||
781 | .read = seq_read, | ||
782 | .llseek = seq_lseek, | ||
783 | .release = single_release, | ||
784 | .write = tled_proc_write, | ||
785 | }; | ||
786 | |||
740 | static int get_lcd_state(void) | 787 | static int get_lcd_state(void) |
741 | { | 788 | { |
742 | int lcd = 0; | 789 | int lcd = 0; |
@@ -829,16 +876,19 @@ static int set_lcd_state(int value) | |||
829 | 876 | ||
830 | } | 877 | } |
831 | 878 | ||
832 | static int | 879 | static int lcd_proc_show(struct seq_file *m, void *v) |
833 | proc_read_lcd(char *page, char **start, off_t off, int count, int *eof, | ||
834 | void *data) | ||
835 | { | 880 | { |
836 | return sprintf(page, "%d\n", get_lcd_state()); | 881 | seq_printf(m, "%d\n", get_lcd_state()); |
882 | return 0; | ||
837 | } | 883 | } |
838 | 884 | ||
839 | static int | 885 | static int lcd_proc_open(struct inode *inode, struct file *file) |
840 | proc_write_lcd(struct file *file, const char __user *buffer, | 886 | { |
841 | unsigned long count, void *data) | 887 | return single_open(file, lcd_proc_show, NULL); |
888 | } | ||
889 | |||
890 | static ssize_t lcd_proc_write(struct file *file, const char __user *buffer, | ||
891 | size_t count, loff_t *pos) | ||
842 | { | 892 | { |
843 | int rv, value; | 893 | int rv, value; |
844 | 894 | ||
@@ -848,6 +898,15 @@ proc_write_lcd(struct file *file, const char __user *buffer, | |||
848 | return rv; | 898 | return rv; |
849 | } | 899 | } |
850 | 900 | ||
901 | static const struct file_operations lcd_proc_fops = { | ||
902 | .owner = THIS_MODULE, | ||
903 | .open = lcd_proc_open, | ||
904 | .read = seq_read, | ||
905 | .llseek = seq_lseek, | ||
906 | .release = single_release, | ||
907 | .write = lcd_proc_write, | ||
908 | }; | ||
909 | |||
851 | static int read_brightness(struct backlight_device *bd) | 910 | static int read_brightness(struct backlight_device *bd) |
852 | { | 911 | { |
853 | int value; | 912 | int value; |
@@ -907,16 +966,19 @@ static int set_brightness_status(struct backlight_device *bd) | |||
907 | return set_brightness(bd->props.brightness); | 966 | return set_brightness(bd->props.brightness); |
908 | } | 967 | } |
909 | 968 | ||
910 | static int | 969 | static int brn_proc_show(struct seq_file *m, void *v) |
911 | proc_read_brn(char *page, char **start, off_t off, int count, int *eof, | ||
912 | void *data) | ||
913 | { | 970 | { |
914 | return sprintf(page, "%d\n", read_brightness(NULL)); | 971 | seq_printf(m, "%d\n", read_brightness(NULL)); |
972 | return 0; | ||
915 | } | 973 | } |
916 | 974 | ||
917 | static int | 975 | static int brn_proc_open(struct inode *inode, struct file *file) |
918 | proc_write_brn(struct file *file, const char __user *buffer, | 976 | { |
919 | unsigned long count, void *data) | 977 | return single_open(file, brn_proc_show, NULL); |
978 | } | ||
979 | |||
980 | static ssize_t brn_proc_write(struct file *file, const char __user *buffer, | ||
981 | size_t count, loff_t *pos) | ||
920 | { | 982 | { |
921 | int rv, value; | 983 | int rv, value; |
922 | 984 | ||
@@ -929,6 +991,15 @@ proc_write_brn(struct file *file, const char __user *buffer, | |||
929 | return rv; | 991 | return rv; |
930 | } | 992 | } |
931 | 993 | ||
994 | static const struct file_operations brn_proc_fops = { | ||
995 | .owner = THIS_MODULE, | ||
996 | .open = brn_proc_open, | ||
997 | .read = seq_read, | ||
998 | .llseek = seq_lseek, | ||
999 | .release = single_release, | ||
1000 | .write = brn_proc_write, | ||
1001 | }; | ||
1002 | |||
932 | static void set_display(int value) | 1003 | static void set_display(int value) |
933 | { | 1004 | { |
934 | /* no sanity check needed for now */ | 1005 | /* no sanity check needed for now */ |
@@ -942,9 +1013,7 @@ static void set_display(int value) | |||
942 | * Now, *this* one could be more user-friendly, but so far, no-one has | 1013 | * Now, *this* one could be more user-friendly, but so far, no-one has |
943 | * complained. The significance of bits is the same as in proc_write_disp() | 1014 | * complained. The significance of bits is the same as in proc_write_disp() |
944 | */ | 1015 | */ |
945 | static int | 1016 | static int disp_proc_show(struct seq_file *m, void *v) |
946 | proc_read_disp(char *page, char **start, off_t off, int count, int *eof, | ||
947 | void *data) | ||
948 | { | 1017 | { |
949 | int value = 0; | 1018 | int value = 0; |
950 | 1019 | ||
@@ -952,7 +1021,13 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, | |||
952 | printk(KERN_WARNING | 1021 | printk(KERN_WARNING |
953 | "Asus ACPI: Error reading display status\n"); | 1022 | "Asus ACPI: Error reading display status\n"); |
954 | value &= 0x07; /* needed for some models, shouldn't hurt others */ | 1023 | value &= 0x07; /* needed for some models, shouldn't hurt others */ |
955 | return sprintf(page, "%d\n", value); | 1024 | seq_printf(m, "%d\n", value); |
1025 | return 0; | ||
1026 | } | ||
1027 | |||
1028 | static int disp_proc_open(struct inode *inode, struct file *file) | ||
1029 | { | ||
1030 | return single_open(file, disp_proc_show, NULL); | ||
956 | } | 1031 | } |
957 | 1032 | ||
958 | /* | 1033 | /* |
@@ -961,9 +1036,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof, | |||
961 | * (bitwise) of these will suffice. I never actually tested 3 displays hooked | 1036 | * (bitwise) of these will suffice. I never actually tested 3 displays hooked |
962 | * up simultaneously, so be warned. See the acpi4asus README for more info. | 1037 | * up simultaneously, so be warned. See the acpi4asus README for more info. |
963 | */ | 1038 | */ |
964 | static int | 1039 | static ssize_t disp_proc_write(struct file *file, const char __user *buffer, |
965 | proc_write_disp(struct file *file, const char __user *buffer, | 1040 | size_t count, loff_t *pos) |
966 | unsigned long count, void *data) | ||
967 | { | 1041 | { |
968 | int rv, value; | 1042 | int rv, value; |
969 | 1043 | ||
@@ -973,25 +1047,27 @@ proc_write_disp(struct file *file, const char __user *buffer, | |||
973 | return rv; | 1047 | return rv; |
974 | } | 1048 | } |
975 | 1049 | ||
976 | typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, | 1050 | static const struct file_operations disp_proc_fops = { |
977 | int *eof, void *data); | 1051 | .owner = THIS_MODULE, |
978 | typedef int (proc_writefunc) (struct file *file, const char __user *buffer, | 1052 | .open = disp_proc_open, |
979 | unsigned long count, void *data); | 1053 | .read = seq_read, |
1054 | .llseek = seq_lseek, | ||
1055 | .release = single_release, | ||
1056 | .write = disp_proc_write, | ||
1057 | }; | ||
980 | 1058 | ||
981 | static int | 1059 | static int |
982 | asus_proc_add(char *name, proc_writefunc *writefunc, | 1060 | asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode, |
983 | proc_readfunc *readfunc, mode_t mode, | ||
984 | struct acpi_device *device) | 1061 | struct acpi_device *device) |
985 | { | 1062 | { |
986 | struct proc_dir_entry *proc = | 1063 | struct proc_dir_entry *proc; |
987 | create_proc_entry(name, mode, acpi_device_dir(device)); | 1064 | |
1065 | proc = proc_create_data(name, mode, acpi_device_dir(device), | ||
1066 | proc_fops, acpi_driver_data(device)); | ||
988 | if (!proc) { | 1067 | if (!proc) { |
989 | printk(KERN_WARNING " Unable to create %s fs entry\n", name); | 1068 | printk(KERN_WARNING " Unable to create %s fs entry\n", name); |
990 | return -1; | 1069 | return -1; |
991 | } | 1070 | } |
992 | proc->write_proc = writefunc; | ||
993 | proc->read_proc = readfunc; | ||
994 | proc->data = acpi_driver_data(device); | ||
995 | proc->uid = asus_uid; | 1071 | proc->uid = asus_uid; |
996 | proc->gid = asus_gid; | 1072 | proc->gid = asus_gid; |
997 | return 0; | 1073 | return 0; |
@@ -1020,10 +1096,9 @@ static int asus_hotk_add_fs(struct acpi_device *device) | |||
1020 | if (!acpi_device_dir(device)) | 1096 | if (!acpi_device_dir(device)) |
1021 | return -ENODEV; | 1097 | return -ENODEV; |
1022 | 1098 | ||
1023 | proc = create_proc_entry(PROC_INFO, mode, acpi_device_dir(device)); | 1099 | proc = proc_create(PROC_INFO, mode, acpi_device_dir(device), |
1100 | &asus_info_proc_fops); | ||
1024 | if (proc) { | 1101 | if (proc) { |
1025 | proc->read_proc = proc_read_info; | ||
1026 | proc->data = acpi_driver_data(device); | ||
1027 | proc->uid = asus_uid; | 1102 | proc->uid = asus_uid; |
1028 | proc->gid = asus_gid; | 1103 | proc->gid = asus_gid; |
1029 | } else { | 1104 | } else { |
@@ -1032,28 +1107,23 @@ static int asus_hotk_add_fs(struct acpi_device *device) | |||
1032 | } | 1107 | } |
1033 | 1108 | ||
1034 | if (hotk->methods->mt_wled) { | 1109 | if (hotk->methods->mt_wled) { |
1035 | asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, | 1110 | asus_proc_add(PROC_WLED, &wled_proc_fops, mode, device); |
1036 | mode, device); | ||
1037 | } | 1111 | } |
1038 | 1112 | ||
1039 | if (hotk->methods->mt_ledd) { | 1113 | if (hotk->methods->mt_ledd) { |
1040 | asus_proc_add(PROC_LEDD, &proc_write_ledd, &proc_read_ledd, | 1114 | asus_proc_add(PROC_LEDD, &ledd_proc_fops, mode, device); |
1041 | mode, device); | ||
1042 | } | 1115 | } |
1043 | 1116 | ||
1044 | if (hotk->methods->mt_mled) { | 1117 | if (hotk->methods->mt_mled) { |
1045 | asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, | 1118 | asus_proc_add(PROC_MLED, &mled_proc_fops, mode, device); |
1046 | mode, device); | ||
1047 | } | 1119 | } |
1048 | 1120 | ||
1049 | if (hotk->methods->mt_tled) { | 1121 | if (hotk->methods->mt_tled) { |
1050 | asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, | 1122 | asus_proc_add(PROC_TLED, &tled_proc_fops, mode, device); |
1051 | mode, device); | ||
1052 | } | 1123 | } |
1053 | 1124 | ||
1054 | if (hotk->methods->mt_bt_switch) { | 1125 | if (hotk->methods->mt_bt_switch) { |
1055 | asus_proc_add(PROC_BT, &proc_write_bluetooth, | 1126 | asus_proc_add(PROC_BT, &bluetooth_proc_fops, mode, device); |
1056 | &proc_read_bluetooth, mode, device); | ||
1057 | } | 1127 | } |
1058 | 1128 | ||
1059 | /* | 1129 | /* |
@@ -1061,19 +1131,16 @@ static int asus_hotk_add_fs(struct acpi_device *device) | |||
1061 | * accessible from the keyboard | 1131 | * accessible from the keyboard |
1062 | */ | 1132 | */ |
1063 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { | 1133 | if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { |
1064 | asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, | 1134 | asus_proc_add(PROC_LCD, &lcd_proc_fops, mode, device); |
1065 | device); | ||
1066 | } | 1135 | } |
1067 | 1136 | ||
1068 | if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || | 1137 | if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || |
1069 | (hotk->methods->brightness_get && hotk->methods->brightness_set)) { | 1138 | (hotk->methods->brightness_get && hotk->methods->brightness_set)) { |
1070 | asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, | 1139 | asus_proc_add(PROC_BRN, &brn_proc_fops, mode, device); |
1071 | device); | ||
1072 | } | 1140 | } |
1073 | 1141 | ||
1074 | if (hotk->methods->display_set) { | 1142 | if (hotk->methods->display_set) { |
1075 | asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, | 1143 | asus_proc_add(PROC_DISP, &disp_proc_fops, mode, device); |
1076 | mode, device); | ||
1077 | } | 1144 | } |
1078 | 1145 | ||
1079 | return 0; | 1146 | return 0; |