diff options
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/acer-wmi.c | 3 | ||||
-rw-r--r-- | drivers/platform/x86/acerhdf.c | 68 | ||||
-rw-r--r-- | drivers/platform/x86/asus_acpi.c | 321 | ||||
-rw-r--r-- | drivers/platform/x86/dell-wmi.c | 42 | ||||
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 8 | ||||
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 11 | ||||
-rw-r--r-- | drivers/platform/x86/msi-wmi.c | 10 | ||||
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 259 | ||||
-rw-r--r-- | drivers/platform/x86/wmi.c | 4 |
9 files changed, 423 insertions, 303 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 454970d2d701..07d14dfdf0b4 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -96,9 +96,6 @@ struct acer_quirks { | |||
96 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); | 96 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); |
97 | MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"); | 97 | MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"); |
98 | 98 | ||
99 | /* Temporary workaround until the WMI sysfs interface goes in */ | ||
100 | MODULE_ALIAS("dmi:*:*Acer*:*:"); | ||
101 | |||
102 | /* | 99 | /* |
103 | * Interface capability flags | 100 | * Interface capability flags |
104 | */ | 101 | */ |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 79b15b9d9cf0..7b2384d674d0 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -52,7 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | #undef START_IN_KERNEL_MODE | 53 | #undef START_IN_KERNEL_MODE |
54 | 54 | ||
55 | #define DRV_VER "0.5.20" | 55 | #define DRV_VER "0.5.22" |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * According to the Atom N270 datasheet, | 58 | * According to the Atom N270 datasheet, |
@@ -156,19 +156,25 @@ static const struct bios_settings_t bios_tbl[] = { | |||
156 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 156 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
157 | /* Acer 1410 */ | 157 | /* Acer 1410 */ |
158 | {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | 158 | {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, |
159 | /* special BIOS / other */ | 159 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, |
160 | /* Acer 1810xx */ | ||
161 | {"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
162 | {"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
163 | {"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
164 | {"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
165 | /* Gateway */ | ||
160 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 166 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
161 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 167 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
162 | {"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58, | 168 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
163 | {0x10, 0x0f, 0x00} }, | 169 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
164 | {"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58, | 170 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x10, 0x0f, 0x00} }, |
165 | {0x10, 0x0f, 0x00} }, | 171 | /* Packard Bell */ |
166 | {"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58, | ||
167 | {0x10, 0x0f, 0x00} }, | ||
168 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 172 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
169 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 173 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
170 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} }, | 174 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} }, |
171 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, | 175 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, |
176 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
177 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, | ||
172 | /* pewpew-terminator */ | 178 | /* pewpew-terminator */ |
173 | {"", "", "", 0, 0, {0, 0, 0} } | 179 | {"", "", "", 0, 0, {0, 0, 0} } |
174 | }; | 180 | }; |
@@ -486,13 +492,26 @@ static struct platform_driver acerhdf_driver = { | |||
486 | .remove = acerhdf_remove, | 492 | .remove = acerhdf_remove, |
487 | }; | 493 | }; |
488 | 494 | ||
495 | /* checks if str begins with start */ | ||
496 | static int str_starts_with(const char *str, const char *start) | ||
497 | { | ||
498 | unsigned long str_len = 0, start_len = 0; | ||
499 | |||
500 | str_len = strlen(str); | ||
501 | start_len = strlen(start); | ||
502 | |||
503 | if (str_len >= start_len && | ||
504 | !strncmp(str, start, start_len)) | ||
505 | return 1; | ||
506 | |||
507 | return 0; | ||
508 | } | ||
489 | 509 | ||
490 | /* check hardware */ | 510 | /* check hardware */ |
491 | static int acerhdf_check_hardware(void) | 511 | static int acerhdf_check_hardware(void) |
492 | { | 512 | { |
493 | char const *vendor, *version, *product; | 513 | char const *vendor, *version, *product; |
494 | int i; | 514 | const struct bios_settings_t *bt = NULL; |
495 | unsigned long prod_len = 0; | ||
496 | 515 | ||
497 | /* get BIOS data */ | 516 | /* get BIOS data */ |
498 | vendor = dmi_get_system_info(DMI_SYS_VENDOR); | 517 | vendor = dmi_get_system_info(DMI_SYS_VENDOR); |
@@ -514,20 +533,20 @@ static int acerhdf_check_hardware(void) | |||
514 | kernelmode = 0; | 533 | kernelmode = 0; |
515 | } | 534 | } |
516 | 535 | ||
517 | prod_len = strlen(product); | ||
518 | |||
519 | if (verbose) | 536 | if (verbose) |
520 | pr_info("BIOS info: %s %s, product: %s\n", | 537 | pr_info("BIOS info: %s %s, product: %s\n", |
521 | vendor, version, product); | 538 | vendor, version, product); |
522 | 539 | ||
523 | /* search BIOS version and vendor in BIOS settings table */ | 540 | /* search BIOS version and vendor in BIOS settings table */ |
524 | for (i = 0; bios_tbl[i].version[0]; i++) { | 541 | for (bt = bios_tbl; bt->vendor[0]; bt++) { |
525 | if (strlen(bios_tbl[i].product) >= prod_len && | 542 | /* |
526 | !strncmp(bios_tbl[i].product, product, | 543 | * check if actual hardware BIOS vendor, product and version |
527 | strlen(bios_tbl[i].product)) && | 544 | * IDs start with the strings of BIOS table entry |
528 | !strcmp(bios_tbl[i].vendor, vendor) && | 545 | */ |
529 | !strcmp(bios_tbl[i].version, version)) { | 546 | if (str_starts_with(vendor, bt->vendor) && |
530 | bios_cfg = &bios_tbl[i]; | 547 | str_starts_with(product, bt->product) && |
548 | str_starts_with(version, bt->version)) { | ||
549 | bios_cfg = bt; | ||
531 | break; | 550 | break; |
532 | } | 551 | } |
533 | } | 552 | } |
@@ -640,9 +659,14 @@ static void __exit acerhdf_exit(void) | |||
640 | MODULE_LICENSE("GPL"); | 659 | MODULE_LICENSE("GPL"); |
641 | MODULE_AUTHOR("Peter Feuerer"); | 660 | MODULE_AUTHOR("Peter Feuerer"); |
642 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 661 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
643 | MODULE_ALIAS("dmi:*:*Acer*:*:"); | 662 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
644 | MODULE_ALIAS("dmi:*:*Gateway*:*:"); | 663 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1410*:"); |
645 | MODULE_ALIAS("dmi:*:*Packard Bell*:*:"); | 664 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1810*:"); |
665 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | ||
666 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | ||
667 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:"); | ||
668 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:"); | ||
669 | MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMU*:"); | ||
646 | 670 | ||
647 | module_init(acerhdf_init); | 671 | module_init(acerhdf_init); |
648 | module_exit(acerhdf_exit); | 672 | module_exit(acerhdf_exit); |
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; |
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 67f3fe71c509..916ccb2b316c 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -238,6 +238,7 @@ static void dell_wmi_notify(u32 value, void *context) | |||
238 | input_sync(dell_wmi_input_dev); | 238 | input_sync(dell_wmi_input_dev); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | kfree(obj); | ||
241 | } | 242 | } |
242 | 243 | ||
243 | 244 | ||
@@ -324,37 +325,34 @@ static int __init dell_wmi_init(void) | |||
324 | int err; | 325 | int err; |
325 | 326 | ||
326 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 327 | if (wmi_has_guid(DELL_EVENT_GUID)) { |
328 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | ||
329 | return -ENODEV; | ||
330 | } | ||
327 | 331 | ||
328 | dmi_walk(find_hk_type, NULL); | 332 | dmi_walk(find_hk_type, NULL); |
329 | 333 | acpi_video = acpi_video_backlight_support(); | |
330 | err = dell_wmi_input_setup(); | ||
331 | |||
332 | if (err) | ||
333 | return err; | ||
334 | |||
335 | err = wmi_install_notify_handler(DELL_EVENT_GUID, | ||
336 | dell_wmi_notify, NULL); | ||
337 | if (err) { | ||
338 | input_unregister_device(dell_wmi_input_dev); | ||
339 | printk(KERN_ERR "dell-wmi: Unable to register" | ||
340 | " notify handler - %d\n", err); | ||
341 | return err; | ||
342 | } | ||
343 | 334 | ||
344 | acpi_video = acpi_video_backlight_support(); | 335 | err = dell_wmi_input_setup(); |
336 | if (err) | ||
337 | return err; | ||
345 | 338 | ||
346 | } else | 339 | err = wmi_install_notify_handler(DELL_EVENT_GUID, |
347 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | 340 | dell_wmi_notify, NULL); |
341 | if (err) { | ||
342 | input_unregister_device(dell_wmi_input_dev); | ||
343 | printk(KERN_ERR | ||
344 | "dell-wmi: Unable to register notify handler - %d\n", | ||
345 | err); | ||
346 | return err; | ||
347 | } | ||
348 | 348 | ||
349 | return 0; | 349 | return 0; |
350 | } | 350 | } |
351 | 351 | ||
352 | static void __exit dell_wmi_exit(void) | 352 | static void __exit dell_wmi_exit(void) |
353 | { | 353 | { |
354 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 354 | wmi_remove_notify_handler(DELL_EVENT_GUID); |
355 | wmi_remove_notify_handler(DELL_EVENT_GUID); | 355 | input_unregister_device(dell_wmi_input_dev); |
356 | input_unregister_device(dell_wmi_input_dev); | ||
357 | } | ||
358 | } | 356 | } |
359 | 357 | ||
360 | module_init(dell_wmi_init); | 358 | module_init(dell_wmi_init); |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index b66029bd75d0..5f3320d468f6 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -376,8 +376,8 @@ static int get_lcd_level(void) | |||
376 | 376 | ||
377 | status = | 377 | status = |
378 | acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state); | 378 | acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state); |
379 | if (status < 0) | 379 | if (ACPI_FAILURE(status)) |
380 | return status; | 380 | return 0; |
381 | 381 | ||
382 | fujitsu->brightness_level = state & 0x0fffffff; | 382 | fujitsu->brightness_level = state & 0x0fffffff; |
383 | 383 | ||
@@ -398,8 +398,8 @@ static int get_max_brightness(void) | |||
398 | 398 | ||
399 | status = | 399 | status = |
400 | acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state); | 400 | acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state); |
401 | if (status < 0) | 401 | if (ACPI_FAILURE(status)) |
402 | return status; | 402 | return -1; |
403 | 403 | ||
404 | fujitsu->max_brightness = state; | 404 | fujitsu->max_brightness = state; |
405 | 405 | ||
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 63c3e658a884..8781d8fa7a57 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -134,10 +134,15 @@ static int hp_wmi_perform_query(int query, int write, int value) | |||
134 | 134 | ||
135 | obj = output.pointer; | 135 | obj = output.pointer; |
136 | 136 | ||
137 | if (!obj || obj->type != ACPI_TYPE_BUFFER) | 137 | if (!obj) |
138 | return -EINVAL; | 138 | return -EINVAL; |
139 | else if (obj->type != ACPI_TYPE_BUFFER) { | ||
140 | kfree(obj); | ||
141 | return -EINVAL; | ||
142 | } | ||
139 | 143 | ||
140 | bios_return = *((struct bios_return *)obj->buffer.pointer); | 144 | bios_return = *((struct bios_return *)obj->buffer.pointer); |
145 | kfree(obj); | ||
141 | if (bios_return.return_code > 0) | 146 | if (bios_return.return_code > 0) |
142 | return bios_return.return_code * -1; | 147 | return bios_return.return_code * -1; |
143 | else | 148 | else |
@@ -340,10 +345,12 @@ static void hp_wmi_notify(u32 value, void *context) | |||
340 | 345 | ||
341 | if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { | 346 | if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { |
342 | printk(KERN_INFO "HP WMI: Unknown response received\n"); | 347 | printk(KERN_INFO "HP WMI: Unknown response received\n"); |
348 | kfree(obj); | ||
343 | return; | 349 | return; |
344 | } | 350 | } |
345 | 351 | ||
346 | eventcode = *((u8 *) obj->buffer.pointer); | 352 | eventcode = *((u8 *) obj->buffer.pointer); |
353 | kfree(obj); | ||
347 | if (eventcode == 0x4) | 354 | if (eventcode == 0x4) |
348 | eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0, | 355 | eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0, |
349 | 0); | 356 | 0); |
@@ -381,6 +388,8 @@ static void hp_wmi_notify(u32 value, void *context) | |||
381 | } else | 388 | } else |
382 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", | 389 | printk(KERN_INFO "HP WMI: Unknown key pressed - %x\n", |
383 | eventcode); | 390 | eventcode); |
391 | |||
392 | kfree(obj); | ||
384 | } | 393 | } |
385 | 394 | ||
386 | static int __init hp_wmi_input_setup(void) | 395 | static int __init hp_wmi_input_setup(void) |
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 0c8fe145c4af..7f77f908bb01 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -34,16 +34,6 @@ MODULE_LICENSE("GPL"); | |||
34 | MODULE_ALIAS("wmi:551A1F84-FBDD-4125-91DB-3EA8F44F1D45"); | 34 | MODULE_ALIAS("wmi:551A1F84-FBDD-4125-91DB-3EA8F44F1D45"); |
35 | MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); | 35 | MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); |
36 | 36 | ||
37 | /* Temporary workaround until the WMI sysfs interface goes in | ||
38 | { "svn", DMI_SYS_VENDOR }, | ||
39 | { "pn", DMI_PRODUCT_NAME }, | ||
40 | { "pvr", DMI_PRODUCT_VERSION }, | ||
41 | { "rvn", DMI_BOARD_VENDOR }, | ||
42 | { "rn", DMI_BOARD_NAME }, | ||
43 | */ | ||
44 | |||
45 | MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-6638:*"); | ||
46 | |||
47 | #define DRV_NAME "msi-wmi" | 37 | #define DRV_NAME "msi-wmi" |
48 | #define DRV_PFX DRV_NAME ": " | 38 | #define DRV_PFX DRV_NAME ": " |
49 | 39 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 51c0a8bee414..77bf5d8f893a 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/types.h> | 43 | #include <linux/types.h> |
44 | #include <linux/proc_fs.h> | 44 | #include <linux/proc_fs.h> |
45 | #include <linux/seq_file.h> | ||
45 | #include <linux/backlight.h> | 46 | #include <linux/backlight.h> |
46 | #include <linux/platform_device.h> | 47 | #include <linux/platform_device.h> |
47 | #include <linux/rfkill.h> | 48 | #include <linux/rfkill.h> |
@@ -357,63 +358,6 @@ static int force_fan; | |||
357 | static int last_key_event; | 358 | static int last_key_event; |
358 | static int key_event_valid; | 359 | static int key_event_valid; |
359 | 360 | ||
360 | typedef struct _ProcItem { | ||
361 | const char *name; | ||
362 | char *(*read_func) (char *); | ||
363 | unsigned long (*write_func) (const char *, unsigned long); | ||
364 | } ProcItem; | ||
365 | |||
366 | /* proc file handlers | ||
367 | */ | ||
368 | |||
369 | static int | ||
370 | dispatch_read(char *page, char **start, off_t off, int count, int *eof, | ||
371 | ProcItem * item) | ||
372 | { | ||
373 | char *p = page; | ||
374 | int len; | ||
375 | |||
376 | if (off == 0) | ||
377 | p = item->read_func(p); | ||
378 | |||
379 | /* ISSUE: I don't understand this code */ | ||
380 | len = (p - page); | ||
381 | if (len <= off + count) | ||
382 | *eof = 1; | ||
383 | *start = page + off; | ||
384 | len -= off; | ||
385 | if (len > count) | ||
386 | len = count; | ||
387 | if (len < 0) | ||
388 | len = 0; | ||
389 | return len; | ||
390 | } | ||
391 | |||
392 | static int | ||
393 | dispatch_write(struct file *file, const char __user * buffer, | ||
394 | unsigned long count, ProcItem * item) | ||
395 | { | ||
396 | int result; | ||
397 | char *tmp_buffer; | ||
398 | |||
399 | /* Arg buffer points to userspace memory, which can't be accessed | ||
400 | * directly. Since we're making a copy, zero-terminate the | ||
401 | * destination so that sscanf can be used on it safely. | ||
402 | */ | ||
403 | tmp_buffer = kmalloc(count + 1, GFP_KERNEL); | ||
404 | if (!tmp_buffer) | ||
405 | return -ENOMEM; | ||
406 | |||
407 | if (copy_from_user(tmp_buffer, buffer, count)) { | ||
408 | result = -EFAULT; | ||
409 | } else { | ||
410 | tmp_buffer[count] = 0; | ||
411 | result = item->write_func(tmp_buffer, count); | ||
412 | } | ||
413 | kfree(tmp_buffer); | ||
414 | return result; | ||
415 | } | ||
416 | |||
417 | static int get_lcd(struct backlight_device *bd) | 361 | static int get_lcd(struct backlight_device *bd) |
418 | { | 362 | { |
419 | u32 hci_result; | 363 | u32 hci_result; |
@@ -426,19 +370,24 @@ static int get_lcd(struct backlight_device *bd) | |||
426 | return -EFAULT; | 370 | return -EFAULT; |
427 | } | 371 | } |
428 | 372 | ||
429 | static char *read_lcd(char *p) | 373 | static int lcd_proc_show(struct seq_file *m, void *v) |
430 | { | 374 | { |
431 | int value = get_lcd(NULL); | 375 | int value = get_lcd(NULL); |
432 | 376 | ||
433 | if (value >= 0) { | 377 | if (value >= 0) { |
434 | p += sprintf(p, "brightness: %d\n", value); | 378 | seq_printf(m, "brightness: %d\n", value); |
435 | p += sprintf(p, "brightness_levels: %d\n", | 379 | seq_printf(m, "brightness_levels: %d\n", |
436 | HCI_LCD_BRIGHTNESS_LEVELS); | 380 | HCI_LCD_BRIGHTNESS_LEVELS); |
437 | } else { | 381 | } else { |
438 | printk(MY_ERR "Error reading LCD brightness\n"); | 382 | printk(MY_ERR "Error reading LCD brightness\n"); |
439 | } | 383 | } |
440 | 384 | ||
441 | return p; | 385 | return 0; |
386 | } | ||
387 | |||
388 | static int lcd_proc_open(struct inode *inode, struct file *file) | ||
389 | { | ||
390 | return single_open(file, lcd_proc_show, NULL); | ||
442 | } | 391 | } |
443 | 392 | ||
444 | static int set_lcd(int value) | 393 | static int set_lcd(int value) |
@@ -458,12 +407,20 @@ static int set_lcd_status(struct backlight_device *bd) | |||
458 | return set_lcd(bd->props.brightness); | 407 | return set_lcd(bd->props.brightness); |
459 | } | 408 | } |
460 | 409 | ||
461 | static unsigned long write_lcd(const char *buffer, unsigned long count) | 410 | static ssize_t lcd_proc_write(struct file *file, const char __user *buf, |
411 | size_t count, loff_t *pos) | ||
462 | { | 412 | { |
413 | char cmd[42]; | ||
414 | size_t len; | ||
463 | int value; | 415 | int value; |
464 | int ret; | 416 | int ret; |
465 | 417 | ||
466 | if (sscanf(buffer, " brightness : %i", &value) == 1 && | 418 | len = min(count, sizeof(cmd) - 1); |
419 | if (copy_from_user(cmd, buf, len)) | ||
420 | return -EFAULT; | ||
421 | cmd[len] = '\0'; | ||
422 | |||
423 | if (sscanf(cmd, " brightness : %i", &value) == 1 && | ||
467 | value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { | 424 | value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { |
468 | ret = set_lcd(value); | 425 | ret = set_lcd(value); |
469 | if (ret == 0) | 426 | if (ret == 0) |
@@ -474,7 +431,16 @@ static unsigned long write_lcd(const char *buffer, unsigned long count) | |||
474 | return ret; | 431 | return ret; |
475 | } | 432 | } |
476 | 433 | ||
477 | static char *read_video(char *p) | 434 | static const struct file_operations lcd_proc_fops = { |
435 | .owner = THIS_MODULE, | ||
436 | .open = lcd_proc_open, | ||
437 | .read = seq_read, | ||
438 | .llseek = seq_lseek, | ||
439 | .release = single_release, | ||
440 | .write = lcd_proc_write, | ||
441 | }; | ||
442 | |||
443 | static int video_proc_show(struct seq_file *m, void *v) | ||
478 | { | 444 | { |
479 | u32 hci_result; | 445 | u32 hci_result; |
480 | u32 value; | 446 | u32 value; |
@@ -484,18 +450,25 @@ static char *read_video(char *p) | |||
484 | int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; | 450 | int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; |
485 | int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; | 451 | int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; |
486 | int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; | 452 | int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; |
487 | p += sprintf(p, "lcd_out: %d\n", is_lcd); | 453 | seq_printf(m, "lcd_out: %d\n", is_lcd); |
488 | p += sprintf(p, "crt_out: %d\n", is_crt); | 454 | seq_printf(m, "crt_out: %d\n", is_crt); |
489 | p += sprintf(p, "tv_out: %d\n", is_tv); | 455 | seq_printf(m, "tv_out: %d\n", is_tv); |
490 | } else { | 456 | } else { |
491 | printk(MY_ERR "Error reading video out status\n"); | 457 | printk(MY_ERR "Error reading video out status\n"); |
492 | } | 458 | } |
493 | 459 | ||
494 | return p; | 460 | return 0; |
495 | } | 461 | } |
496 | 462 | ||
497 | static unsigned long write_video(const char *buffer, unsigned long count) | 463 | static int video_proc_open(struct inode *inode, struct file *file) |
498 | { | 464 | { |
465 | return single_open(file, video_proc_show, NULL); | ||
466 | } | ||
467 | |||
468 | static ssize_t video_proc_write(struct file *file, const char __user *buf, | ||
469 | size_t count, loff_t *pos) | ||
470 | { | ||
471 | char *cmd, *buffer; | ||
499 | int value; | 472 | int value; |
500 | int remain = count; | 473 | int remain = count; |
501 | int lcd_out = -1; | 474 | int lcd_out = -1; |
@@ -504,6 +477,17 @@ static unsigned long write_video(const char *buffer, unsigned long count) | |||
504 | u32 hci_result; | 477 | u32 hci_result; |
505 | u32 video_out; | 478 | u32 video_out; |
506 | 479 | ||
480 | cmd = kmalloc(count + 1, GFP_KERNEL); | ||
481 | if (!cmd) | ||
482 | return -ENOMEM; | ||
483 | if (copy_from_user(cmd, buf, count)) { | ||
484 | kfree(cmd); | ||
485 | return -EFAULT; | ||
486 | } | ||
487 | cmd[count] = '\0'; | ||
488 | |||
489 | buffer = cmd; | ||
490 | |||
507 | /* scan expression. Multiple expressions may be delimited with ; | 491 | /* scan expression. Multiple expressions may be delimited with ; |
508 | * | 492 | * |
509 | * NOTE: to keep scanning simple, invalid fields are ignored | 493 | * NOTE: to keep scanning simple, invalid fields are ignored |
@@ -523,6 +507,8 @@ static unsigned long write_video(const char *buffer, unsigned long count) | |||
523 | while (remain && *(buffer - 1) != ';'); | 507 | while (remain && *(buffer - 1) != ';'); |
524 | } | 508 | } |
525 | 509 | ||
510 | kfree(cmd); | ||
511 | |||
526 | hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); | 512 | hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); |
527 | if (hci_result == HCI_SUCCESS) { | 513 | if (hci_result == HCI_SUCCESS) { |
528 | unsigned int new_video_out = video_out; | 514 | unsigned int new_video_out = video_out; |
@@ -543,28 +529,50 @@ static unsigned long write_video(const char *buffer, unsigned long count) | |||
543 | return count; | 529 | return count; |
544 | } | 530 | } |
545 | 531 | ||
546 | static char *read_fan(char *p) | 532 | static const struct file_operations video_proc_fops = { |
533 | .owner = THIS_MODULE, | ||
534 | .open = video_proc_open, | ||
535 | .read = seq_read, | ||
536 | .llseek = seq_lseek, | ||
537 | .release = single_release, | ||
538 | .write = video_proc_write, | ||
539 | }; | ||
540 | |||
541 | static int fan_proc_show(struct seq_file *m, void *v) | ||
547 | { | 542 | { |
548 | u32 hci_result; | 543 | u32 hci_result; |
549 | u32 value; | 544 | u32 value; |
550 | 545 | ||
551 | hci_read1(HCI_FAN, &value, &hci_result); | 546 | hci_read1(HCI_FAN, &value, &hci_result); |
552 | if (hci_result == HCI_SUCCESS) { | 547 | if (hci_result == HCI_SUCCESS) { |
553 | p += sprintf(p, "running: %d\n", (value > 0)); | 548 | seq_printf(m, "running: %d\n", (value > 0)); |
554 | p += sprintf(p, "force_on: %d\n", force_fan); | 549 | seq_printf(m, "force_on: %d\n", force_fan); |
555 | } else { | 550 | } else { |
556 | printk(MY_ERR "Error reading fan status\n"); | 551 | printk(MY_ERR "Error reading fan status\n"); |
557 | } | 552 | } |
558 | 553 | ||
559 | return p; | 554 | return 0; |
555 | } | ||
556 | |||
557 | static int fan_proc_open(struct inode *inode, struct file *file) | ||
558 | { | ||
559 | return single_open(file, fan_proc_show, NULL); | ||
560 | } | 560 | } |
561 | 561 | ||
562 | static unsigned long write_fan(const char *buffer, unsigned long count) | 562 | static ssize_t fan_proc_write(struct file *file, const char __user *buf, |
563 | size_t count, loff_t *pos) | ||
563 | { | 564 | { |
565 | char cmd[42]; | ||
566 | size_t len; | ||
564 | int value; | 567 | int value; |
565 | u32 hci_result; | 568 | u32 hci_result; |
566 | 569 | ||
567 | if (sscanf(buffer, " force_on : %i", &value) == 1 && | 570 | len = min(count, sizeof(cmd) - 1); |
571 | if (copy_from_user(cmd, buf, len)) | ||
572 | return -EFAULT; | ||
573 | cmd[len] = '\0'; | ||
574 | |||
575 | if (sscanf(cmd, " force_on : %i", &value) == 1 && | ||
568 | value >= 0 && value <= 1) { | 576 | value >= 0 && value <= 1) { |
569 | hci_write1(HCI_FAN, value, &hci_result); | 577 | hci_write1(HCI_FAN, value, &hci_result); |
570 | if (hci_result != HCI_SUCCESS) | 578 | if (hci_result != HCI_SUCCESS) |
@@ -578,7 +586,16 @@ static unsigned long write_fan(const char *buffer, unsigned long count) | |||
578 | return count; | 586 | return count; |
579 | } | 587 | } |
580 | 588 | ||
581 | static char *read_keys(char *p) | 589 | static const struct file_operations fan_proc_fops = { |
590 | .owner = THIS_MODULE, | ||
591 | .open = fan_proc_open, | ||
592 | .read = seq_read, | ||
593 | .llseek = seq_lseek, | ||
594 | .release = single_release, | ||
595 | .write = fan_proc_write, | ||
596 | }; | ||
597 | |||
598 | static int keys_proc_show(struct seq_file *m, void *v) | ||
582 | { | 599 | { |
583 | u32 hci_result; | 600 | u32 hci_result; |
584 | u32 value; | 601 | u32 value; |
@@ -602,18 +619,30 @@ static char *read_keys(char *p) | |||
602 | } | 619 | } |
603 | } | 620 | } |
604 | 621 | ||
605 | p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); | 622 | seq_printf(m, "hotkey_ready: %d\n", key_event_valid); |
606 | p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); | 623 | seq_printf(m, "hotkey: 0x%04x\n", last_key_event); |
624 | end: | ||
625 | return 0; | ||
626 | } | ||
607 | 627 | ||
608 | end: | 628 | static int keys_proc_open(struct inode *inode, struct file *file) |
609 | return p; | 629 | { |
630 | return single_open(file, keys_proc_show, NULL); | ||
610 | } | 631 | } |
611 | 632 | ||
612 | static unsigned long write_keys(const char *buffer, unsigned long count) | 633 | static ssize_t keys_proc_write(struct file *file, const char __user *buf, |
634 | size_t count, loff_t *pos) | ||
613 | { | 635 | { |
636 | char cmd[42]; | ||
637 | size_t len; | ||
614 | int value; | 638 | int value; |
615 | 639 | ||
616 | if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) { | 640 | len = min(count, sizeof(cmd) - 1); |
641 | if (copy_from_user(cmd, buf, len)) | ||
642 | return -EFAULT; | ||
643 | cmd[len] = '\0'; | ||
644 | |||
645 | if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0) { | ||
617 | key_event_valid = 0; | 646 | key_event_valid = 0; |
618 | } else { | 647 | } else { |
619 | return -EINVAL; | 648 | return -EINVAL; |
@@ -622,52 +651,58 @@ static unsigned long write_keys(const char *buffer, unsigned long count) | |||
622 | return count; | 651 | return count; |
623 | } | 652 | } |
624 | 653 | ||
625 | static char *read_version(char *p) | 654 | static const struct file_operations keys_proc_fops = { |
655 | .owner = THIS_MODULE, | ||
656 | .open = keys_proc_open, | ||
657 | .read = seq_read, | ||
658 | .llseek = seq_lseek, | ||
659 | .release = single_release, | ||
660 | .write = keys_proc_write, | ||
661 | }; | ||
662 | |||
663 | static int version_proc_show(struct seq_file *m, void *v) | ||
626 | { | 664 | { |
627 | p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION); | 665 | seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION); |
628 | p += sprintf(p, "proc_interface: %d\n", | 666 | seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION); |
629 | PROC_INTERFACE_VERSION); | 667 | return 0; |
630 | return p; | ||
631 | } | 668 | } |
632 | 669 | ||
670 | static int version_proc_open(struct inode *inode, struct file *file) | ||
671 | { | ||
672 | return single_open(file, version_proc_show, PDE(inode)->data); | ||
673 | } | ||
674 | |||
675 | static const struct file_operations version_proc_fops = { | ||
676 | .owner = THIS_MODULE, | ||
677 | .open = version_proc_open, | ||
678 | .read = seq_read, | ||
679 | .llseek = seq_lseek, | ||
680 | .release = single_release, | ||
681 | }; | ||
682 | |||
633 | /* proc and module init | 683 | /* proc and module init |
634 | */ | 684 | */ |
635 | 685 | ||
636 | #define PROC_TOSHIBA "toshiba" | 686 | #define PROC_TOSHIBA "toshiba" |
637 | 687 | ||
638 | static ProcItem proc_items[] = { | ||
639 | {"lcd", read_lcd, write_lcd}, | ||
640 | {"video", read_video, write_video}, | ||
641 | {"fan", read_fan, write_fan}, | ||
642 | {"keys", read_keys, write_keys}, | ||
643 | {"version", read_version, NULL}, | ||
644 | {NULL} | ||
645 | }; | ||
646 | |||
647 | static acpi_status __init add_device(void) | 688 | static acpi_status __init add_device(void) |
648 | { | 689 | { |
649 | struct proc_dir_entry *proc; | 690 | proc_create("lcd", S_IRUGO | S_IWUSR, toshiba_proc_dir, &lcd_proc_fops); |
650 | ProcItem *item; | 691 | proc_create("video", S_IRUGO | S_IWUSR, toshiba_proc_dir, &video_proc_fops); |
651 | 692 | proc_create("fan", S_IRUGO | S_IWUSR, toshiba_proc_dir, &fan_proc_fops); | |
652 | for (item = proc_items; item->name; ++item) { | 693 | proc_create("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, &keys_proc_fops); |
653 | proc = create_proc_read_entry(item->name, | 694 | proc_create("version", S_IRUGO, toshiba_proc_dir, &version_proc_fops); |
654 | S_IFREG | S_IRUGO | S_IWUSR, | ||
655 | toshiba_proc_dir, | ||
656 | (read_proc_t *) dispatch_read, | ||
657 | item); | ||
658 | if (proc && item->write_func) | ||
659 | proc->write_proc = (write_proc_t *) dispatch_write; | ||
660 | } | ||
661 | 695 | ||
662 | return AE_OK; | 696 | return AE_OK; |
663 | } | 697 | } |
664 | 698 | ||
665 | static acpi_status remove_device(void) | 699 | static acpi_status remove_device(void) |
666 | { | 700 | { |
667 | ProcItem *item; | 701 | remove_proc_entry("lcd", toshiba_proc_dir); |
668 | 702 | remove_proc_entry("video", toshiba_proc_dir); | |
669 | for (item = proc_items; item->name; ++item) | 703 | remove_proc_entry("fan", toshiba_proc_dir); |
670 | remove_proc_entry(item->name, toshiba_proc_dir); | 704 | remove_proc_entry("keys", toshiba_proc_dir); |
705 | remove_proc_entry("version", toshiba_proc_dir); | ||
671 | return AE_OK; | 706 | return AE_OK; |
672 | } | 707 | } |
673 | 708 | ||
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e425a868cd3a..9f93d6c0f510 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -540,8 +540,8 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); | |||
540 | /** | 540 | /** |
541 | * wmi_get_event_data - Get WMI data associated with an event | 541 | * wmi_get_event_data - Get WMI data associated with an event |
542 | * | 542 | * |
543 | * @event - Event to find | 543 | * @event: Event to find |
544 | * &out - Buffer to hold event data | 544 | * @out: Buffer to hold event data. out->pointer should be freed with kfree() |
545 | * | 545 | * |
546 | * Returns extra data associated with an event in WMI. | 546 | * Returns extra data associated with an event in WMI. |
547 | */ | 547 | */ |