diff options
| -rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index c0b203ca29fb..d14f7149cb13 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 20 | |||
| 19 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 20 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 21 | #include <linux/init.h> | 23 | #include <linux/init.h> |
| @@ -41,11 +43,6 @@ | |||
| 41 | #define EEEPC_HOTK_DEVICE_NAME "Hotkey" | 43 | #define EEEPC_HOTK_DEVICE_NAME "Hotkey" |
| 42 | #define EEEPC_HOTK_HID "ASUS010" | 44 | #define EEEPC_HOTK_HID "ASUS010" |
| 43 | 45 | ||
| 44 | #define EEEPC_LOG EEEPC_HOTK_FILE ": " | ||
| 45 | #define EEEPC_ERR KERN_ERR EEEPC_LOG | ||
| 46 | #define EEEPC_WARNING KERN_WARNING EEEPC_LOG | ||
| 47 | #define EEEPC_NOTICE KERN_NOTICE EEEPC_LOG | ||
| 48 | #define EEEPC_INFO KERN_INFO EEEPC_LOG | ||
| 49 | 46 | ||
| 50 | /* | 47 | /* |
| 51 | * Definitions for Asus EeePC | 48 | * Definitions for Asus EeePC |
| @@ -285,7 +282,7 @@ static int set_acpi(int cm, int value) | |||
| 285 | if (method == NULL) | 282 | if (method == NULL) |
| 286 | return -ENODEV; | 283 | return -ENODEV; |
| 287 | if (write_acpi_int(ehotk->handle, method, value, NULL)) | 284 | if (write_acpi_int(ehotk->handle, method, value, NULL)) |
| 288 | printk(EEEPC_WARNING "Error writing %s\n", method); | 285 | pr_warning("Error writing %s\n", method); |
| 289 | } | 286 | } |
| 290 | return 0; | 287 | return 0; |
| 291 | } | 288 | } |
| @@ -298,7 +295,7 @@ static int get_acpi(int cm) | |||
| 298 | if (method == NULL) | 295 | if (method == NULL) |
| 299 | return -ENODEV; | 296 | return -ENODEV; |
| 300 | if (read_acpi_int(ehotk->handle, method, &value)) | 297 | if (read_acpi_int(ehotk->handle, method, &value)) |
| 301 | printk(EEEPC_WARNING "Error reading %s\n", method); | 298 | pr_warning("Error reading %s\n", method); |
| 302 | } | 299 | } |
| 303 | return value; | 300 | return value; |
| 304 | } | 301 | } |
| @@ -562,26 +559,23 @@ static int eeepc_hotk_check(void) | |||
| 562 | if (ehotk->device->status.present) { | 559 | if (ehotk->device->status.present) { |
| 563 | if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag, | 560 | if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag, |
| 564 | &buffer)) { | 561 | &buffer)) { |
| 565 | printk(EEEPC_ERR "Hotkey initialization failed\n"); | 562 | pr_err("Hotkey initialization failed\n"); |
| 566 | return -ENODEV; | 563 | return -ENODEV; |
| 567 | } else { | 564 | } else { |
| 568 | printk(EEEPC_NOTICE "Hotkey init flags 0x%x\n", | 565 | pr_notice("Hotkey init flags 0x%x\n", ehotk->init_flag); |
| 569 | ehotk->init_flag); | ||
| 570 | } | 566 | } |
| 571 | /* get control methods supported */ | 567 | /* get control methods supported */ |
| 572 | if (read_acpi_int(ehotk->handle, "CMSG" | 568 | if (read_acpi_int(ehotk->handle, "CMSG" |
| 573 | , &ehotk->cm_supported)) { | 569 | , &ehotk->cm_supported)) { |
| 574 | printk(EEEPC_ERR | 570 | pr_err("Get control methods supported failed\n"); |
| 575 | "Get control methods supported failed\n"); | ||
| 576 | return -ENODEV; | 571 | return -ENODEV; |
| 577 | } else { | 572 | } else { |
| 578 | printk(EEEPC_INFO | 573 | pr_info("Get control methods supported: 0x%x\n", |
| 579 | "Get control methods supported: 0x%x\n", | 574 | ehotk->cm_supported); |
| 580 | ehotk->cm_supported); | ||
| 581 | } | 575 | } |
| 582 | ehotk->inputdev = input_allocate_device(); | 576 | ehotk->inputdev = input_allocate_device(); |
| 583 | if (!ehotk->inputdev) { | 577 | if (!ehotk->inputdev) { |
| 584 | printk(EEEPC_INFO "Unable to allocate input device\n"); | 578 | pr_info("Unable to allocate input device\n"); |
| 585 | return 0; | 579 | return 0; |
| 586 | } | 580 | } |
| 587 | ehotk->inputdev->name = "Asus EeePC extra buttons"; | 581 | ehotk->inputdev->name = "Asus EeePC extra buttons"; |
| @@ -600,12 +594,12 @@ static int eeepc_hotk_check(void) | |||
| 600 | } | 594 | } |
| 601 | result = input_register_device(ehotk->inputdev); | 595 | result = input_register_device(ehotk->inputdev); |
| 602 | if (result) { | 596 | if (result) { |
| 603 | printk(EEEPC_INFO "Unable to register input device\n"); | 597 | pr_info("Unable to register input device\n"); |
| 604 | input_free_device(ehotk->inputdev); | 598 | input_free_device(ehotk->inputdev); |
| 605 | return 0; | 599 | return 0; |
| 606 | } | 600 | } |
| 607 | } else { | 601 | } else { |
| 608 | printk(EEEPC_ERR "Hotkey device not present, aborting\n"); | 602 | pr_err("Hotkey device not present, aborting\n"); |
| 609 | return -EINVAL; | 603 | return -EINVAL; |
| 610 | } | 604 | } |
| 611 | return 0; | 605 | return 0; |
| @@ -643,7 +637,7 @@ static void eeepc_rfkill_hotplug(void) | |||
| 643 | bool blocked; | 637 | bool blocked; |
| 644 | 638 | ||
| 645 | if (!bus) { | 639 | if (!bus) { |
| 646 | printk(EEEPC_WARNING "Unable to find PCI bus 1?\n"); | 640 | pr_warning("Unable to find PCI bus 1?\n"); |
| 647 | return; | 641 | return; |
| 648 | } | 642 | } |
| 649 | 643 | ||
| @@ -659,7 +653,7 @@ static void eeepc_rfkill_hotplug(void) | |||
| 659 | if (dev) { | 653 | if (dev) { |
| 660 | pci_bus_assign_resources(bus); | 654 | pci_bus_assign_resources(bus); |
| 661 | if (pci_bus_add_device(dev)) | 655 | if (pci_bus_add_device(dev)) |
| 662 | printk(EEEPC_ERR "Unable to hotplug wifi\n"); | 656 | pr_err("Unable to hotplug wifi\n"); |
| 663 | } | 657 | } |
| 664 | } else { | 658 | } else { |
| 665 | dev = pci_get_slot(bus, 0); | 659 | dev = pci_get_slot(bus, 0); |
| @@ -742,8 +736,7 @@ static int eeepc_register_rfkill_notifier(char *node) | |||
| 742 | eeepc_rfkill_notify, | 736 | eeepc_rfkill_notify, |
| 743 | NULL); | 737 | NULL); |
| 744 | if (ACPI_FAILURE(status)) | 738 | if (ACPI_FAILURE(status)) |
| 745 | printk(EEEPC_WARNING | 739 | pr_warning("Failed to register notify on %s\n", node); |
| 746 | "Failed to register notify on %s\n", node); | ||
| 747 | } else | 740 | } else |
| 748 | return -ENODEV; | 741 | return -ENODEV; |
| 749 | 742 | ||
| @@ -762,8 +755,7 @@ static void eeepc_unregister_rfkill_notifier(char *node) | |||
| 762 | ACPI_SYSTEM_NOTIFY, | 755 | ACPI_SYSTEM_NOTIFY, |
| 763 | eeepc_rfkill_notify); | 756 | eeepc_rfkill_notify); |
| 764 | if (ACPI_FAILURE(status)) | 757 | if (ACPI_FAILURE(status)) |
| 765 | printk(EEEPC_ERR | 758 | pr_err("Error removing rfkill notify handler %s\n", |
| 766 | "Error removing rfkill notify handler %s\n", | ||
| 767 | node); | 759 | node); |
| 768 | } | 760 | } |
| 769 | } | 761 | } |
| @@ -780,7 +772,7 @@ static int eeepc_setup_pci_hotplug(void) | |||
| 780 | struct pci_bus *bus = pci_find_bus(0, 1); | 772 | struct pci_bus *bus = pci_find_bus(0, 1); |
| 781 | 773 | ||
| 782 | if (!bus) { | 774 | if (!bus) { |
| 783 | printk(EEEPC_ERR "Unable to find wifi PCI bus\n"); | 775 | pr_err("Unable to find wifi PCI bus\n"); |
| 784 | return -ENODEV; | 776 | return -ENODEV; |
| 785 | } | 777 | } |
| 786 | 778 | ||
| @@ -801,7 +793,7 @@ static int eeepc_setup_pci_hotplug(void) | |||
| 801 | 793 | ||
| 802 | ret = pci_hp_register(ehotk->hotplug_slot, bus, 0, "eeepc-wifi"); | 794 | ret = pci_hp_register(ehotk->hotplug_slot, bus, 0, "eeepc-wifi"); |
| 803 | if (ret) { | 795 | if (ret) { |
| 804 | printk(EEEPC_ERR "Unable to register hotplug slot - %d\n", ret); | 796 | pr_err("Unable to register hotplug slot - %d\n", ret); |
| 805 | goto error_register; | 797 | goto error_register; |
| 806 | } | 798 | } |
| 807 | 799 | ||
| @@ -822,7 +814,7 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
| 822 | 814 | ||
| 823 | if (!device) | 815 | if (!device) |
| 824 | return -EINVAL; | 816 | return -EINVAL; |
| 825 | printk(EEEPC_NOTICE EEEPC_HOTK_NAME "\n"); | 817 | pr_notice(EEEPC_HOTK_NAME "\n"); |
| 826 | ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); | 818 | ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); |
| 827 | if (!ehotk) | 819 | if (!ehotk) |
| 828 | return -ENOMEM; | 820 | return -ENOMEM; |
| @@ -1105,8 +1097,7 @@ static int eeepc_backlight_init(struct device *dev) | |||
| 1105 | bd = backlight_device_register(EEEPC_HOTK_FILE, dev, | 1097 | bd = backlight_device_register(EEEPC_HOTK_FILE, dev, |
| 1106 | NULL, &eeepcbl_ops); | 1098 | NULL, &eeepcbl_ops); |
| 1107 | if (IS_ERR(bd)) { | 1099 | if (IS_ERR(bd)) { |
| 1108 | printk(EEEPC_ERR | 1100 | pr_err("Could not register eeepc backlight device\n"); |
| 1109 | "Could not register eeepc backlight device\n"); | ||
| 1110 | eeepc_backlight_device = NULL; | 1101 | eeepc_backlight_device = NULL; |
| 1111 | return PTR_ERR(bd); | 1102 | return PTR_ERR(bd); |
| 1112 | } | 1103 | } |
| @@ -1125,8 +1116,7 @@ static int eeepc_hwmon_init(struct device *dev) | |||
| 1125 | 1116 | ||
| 1126 | hwmon = hwmon_device_register(dev); | 1117 | hwmon = hwmon_device_register(dev); |
| 1127 | if (IS_ERR(hwmon)) { | 1118 | if (IS_ERR(hwmon)) { |
| 1128 | printk(EEEPC_ERR | 1119 | pr_err("Could not register eeepc hwmon device\n"); |
| 1129 | "Could not register eeepc hwmon device\n"); | ||
| 1130 | eeepc_hwmon_device = NULL; | 1120 | eeepc_hwmon_device = NULL; |
| 1131 | return PTR_ERR(hwmon); | 1121 | return PTR_ERR(hwmon); |
| 1132 | } | 1122 | } |
| @@ -1159,8 +1149,7 @@ static int __init eeepc_laptop_init(void) | |||
| 1159 | if (result) | 1149 | if (result) |
| 1160 | goto fail_backlight; | 1150 | goto fail_backlight; |
| 1161 | } else | 1151 | } else |
| 1162 | printk(EEEPC_INFO "Backlight controlled by ACPI video " | 1152 | pr_info("Backlight controlled by ACPI video driver\n"); |
| 1163 | "driver\n"); | ||
| 1164 | 1153 | ||
| 1165 | result = eeepc_hwmon_init(dev); | 1154 | result = eeepc_hwmon_init(dev); |
| 1166 | if (result) | 1155 | if (result) |
