Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
ACPI / PM: Do not save/restore NVS on Sony Vaio VGN-NW130D
ACPI/HEST: adjust section selection
ACPI: eliminate unused variable warning for !ACPI_SLEEP
ACPI/PNP: avoid section mismatch warning
ACPI thermal: remove two unused functions
ACPI: fix a section mismatch
ACPI, APEI, use raw spinlock in ERST
ACPI: video: fix build for CONFIG_ACPI=n
ACPI: video: fix build for VIDEO_OUTPUT_CONTROL=n
ACPI: fix allowing to add/remove multiple _OSI strings
acpi: fix _OSI string setup regression
ACPI: EC: Add another dmi match entry for MSI hardware
ACPI battery: update status upon sysfs query
ACPI ac: update AC status upon sysfs query
ACPI / PM: Do not refcount power resources that can't be turned on
ACPI / PM: Check device state before refcounting power resources

+173 -95
+29 -17
drivers/acpi/ac.c
··· 100 100 .release = single_release, 101 101 }; 102 102 #endif 103 - static int get_ac_property(struct power_supply *psy, 104 - enum power_supply_property psp, 105 - union power_supply_propval *val) 106 - { 107 - struct acpi_ac *ac = to_acpi_ac(psy); 108 - switch (psp) { 109 - case POWER_SUPPLY_PROP_ONLINE: 110 - val->intval = ac->state; 111 - break; 112 - default: 113 - return -EINVAL; 114 - } 115 - return 0; 116 - } 117 103 118 - static enum power_supply_property ac_props[] = { 119 - POWER_SUPPLY_PROP_ONLINE, 120 - }; 121 104 /* -------------------------------------------------------------------------- 122 105 AC Adapter Management 123 106 -------------------------------------------------------------------------- */ ··· 122 139 123 140 return 0; 124 141 } 142 + 143 + /* -------------------------------------------------------------------------- 144 + sysfs I/F 145 + -------------------------------------------------------------------------- */ 146 + static int get_ac_property(struct power_supply *psy, 147 + enum power_supply_property psp, 148 + union power_supply_propval *val) 149 + { 150 + struct acpi_ac *ac = to_acpi_ac(psy); 151 + 152 + if (!ac) 153 + return -ENODEV; 154 + 155 + if (acpi_ac_get_state(ac)) 156 + return -ENODEV; 157 + 158 + switch (psp) { 159 + case POWER_SUPPLY_PROP_ONLINE: 160 + val->intval = ac->state; 161 + break; 162 + default: 163 + return -EINVAL; 164 + } 165 + return 0; 166 + } 167 + 168 + static enum power_supply_property ac_props[] = { 169 + POWER_SUPPLY_PROP_ONLINE, 170 + }; 125 171 126 172 #ifdef CONFIG_ACPI_PROCFS_POWER 127 173 /* --------------------------------------------------------------------------
+17 -17
drivers/acpi/apei/erst.c
··· 86 86 * It is used to provide exclusive accessing for ERST Error Log 87 87 * Address Range too. 88 88 */ 89 - static DEFINE_SPINLOCK(erst_lock); 89 + static DEFINE_RAW_SPINLOCK(erst_lock); 90 90 91 91 static inline int erst_errno(int command_status) 92 92 { ··· 421 421 if (erst_disable) 422 422 return -ENODEV; 423 423 424 - spin_lock_irqsave(&erst_lock, flags); 424 + raw_spin_lock_irqsave(&erst_lock, flags); 425 425 count = __erst_get_record_count(); 426 - spin_unlock_irqrestore(&erst_lock, flags); 426 + raw_spin_unlock_irqrestore(&erst_lock, flags); 427 427 428 428 return count; 429 429 } ··· 456 456 if (erst_disable) 457 457 return -ENODEV; 458 458 459 - spin_lock_irqsave(&erst_lock, flags); 459 + raw_spin_lock_irqsave(&erst_lock, flags); 460 460 rc = __erst_get_next_record_id(record_id); 461 - spin_unlock_irqrestore(&erst_lock, flags); 461 + raw_spin_unlock_irqrestore(&erst_lock, flags); 462 462 463 463 return rc; 464 464 } ··· 624 624 return -EINVAL; 625 625 626 626 if (erst_erange.attr & ERST_RANGE_NVRAM) { 627 - if (!spin_trylock_irqsave(&erst_lock, flags)) 627 + if (!raw_spin_trylock_irqsave(&erst_lock, flags)) 628 628 return -EBUSY; 629 629 rc = __erst_write_to_nvram(record); 630 - spin_unlock_irqrestore(&erst_lock, flags); 630 + raw_spin_unlock_irqrestore(&erst_lock, flags); 631 631 return rc; 632 632 } 633 633 634 634 if (record->record_length > erst_erange.size) 635 635 return -EINVAL; 636 636 637 - if (!spin_trylock_irqsave(&erst_lock, flags)) 637 + if (!raw_spin_trylock_irqsave(&erst_lock, flags)) 638 638 return -EBUSY; 639 639 memcpy(erst_erange.vaddr, record, record->record_length); 640 640 rcd_erange = erst_erange.vaddr; ··· 642 642 memcpy(&rcd_erange->persistence_information, "ER", 2); 643 643 644 644 rc = __erst_write_to_storage(0); 645 - spin_unlock_irqrestore(&erst_lock, flags); 645 + raw_spin_unlock_irqrestore(&erst_lock, flags); 646 646 647 647 return rc; 648 648 } ··· 696 696 if (erst_disable) 697 697 return -ENODEV; 698 698 699 - spin_lock_irqsave(&erst_lock, flags); 699 + raw_spin_lock_irqsave(&erst_lock, flags); 700 700 len = __erst_read(record_id, record, buflen); 701 - spin_unlock_irqrestore(&erst_lock, flags); 701 + raw_spin_unlock_irqrestore(&erst_lock, flags); 702 702 return len; 703 703 } 704 704 EXPORT_SYMBOL_GPL(erst_read); ··· 719 719 if (erst_disable) 720 720 return -ENODEV; 721 721 722 - spin_lock_irqsave(&erst_lock, flags); 722 + raw_spin_lock_irqsave(&erst_lock, flags); 723 723 rc = __erst_get_next_record_id(&record_id); 724 724 if (rc) { 725 - spin_unlock_irqrestore(&erst_lock, flags); 725 + raw_spin_unlock_irqrestore(&erst_lock, flags); 726 726 return rc; 727 727 } 728 728 /* no more record */ 729 729 if (record_id == APEI_ERST_INVALID_RECORD_ID) { 730 - spin_unlock_irqrestore(&erst_lock, flags); 730 + raw_spin_unlock_irqrestore(&erst_lock, flags); 731 731 return 0; 732 732 } 733 733 734 734 len = __erst_read(record_id, record, buflen); 735 - spin_unlock_irqrestore(&erst_lock, flags); 735 + raw_spin_unlock_irqrestore(&erst_lock, flags); 736 736 737 737 return len; 738 738 } ··· 746 746 if (erst_disable) 747 747 return -ENODEV; 748 748 749 - spin_lock_irqsave(&erst_lock, flags); 749 + raw_spin_lock_irqsave(&erst_lock, flags); 750 750 if (erst_erange.attr & ERST_RANGE_NVRAM) 751 751 rc = __erst_clear_from_nvram(record_id); 752 752 else 753 753 rc = __erst_clear_from_storage(record_id); 754 - spin_unlock_irqrestore(&erst_lock, flags); 754 + raw_spin_unlock_irqrestore(&erst_lock, flags); 755 755 756 756 return rc; 757 757 }
+5 -5
drivers/acpi/apei/hest.c
··· 46 46 47 47 /* HEST table parsing */ 48 48 49 - static struct acpi_table_hest *hest_tab; 49 + static struct acpi_table_hest *__read_mostly hest_tab; 50 50 51 - static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { 51 + static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { 52 52 [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */ 53 53 [ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1, 54 54 [ACPI_HEST_TYPE_IA32_NMI] = sizeof(struct acpi_hest_ia_nmi), ··· 126 126 unsigned int count; 127 127 }; 128 128 129 - static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) 129 + static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) 130 130 { 131 131 int *count = data; 132 132 ··· 135 135 return 0; 136 136 } 137 137 138 - static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) 138 + static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) 139 139 { 140 140 struct platform_device *ghes_dev; 141 141 struct ghes_arr *ghes_arr = data; ··· 165 165 return rc; 166 166 } 167 167 168 - static int hest_ghes_dev_register(unsigned int ghes_count) 168 + static int __init hest_ghes_dev_register(unsigned int ghes_count) 169 169 { 170 170 int rc, i; 171 171 struct ghes_arr ghes_arr;
+5
drivers/acpi/battery.c
··· 130 130 unsigned long flags; 131 131 }; 132 132 133 + static int acpi_battery_update(struct acpi_battery *battery); 134 + 133 135 #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 134 136 135 137 inline int acpi_battery_present(struct acpi_battery *battery) ··· 185 183 { 186 184 int ret = 0; 187 185 struct acpi_battery *battery = to_acpi_battery(psy); 186 + 187 + if (acpi_battery_update(battery)) 188 + return -ENODEV; 188 189 189 190 if (acpi_battery_present(battery)) { 190 191 /* run battery update only if it is present */
+3
drivers/acpi/ec.c
··· 934 934 ec_flag_msi, "MSI hardware", { 935 935 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, 936 936 { 937 + ec_flag_msi, "MSI hardware", { 938 + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, 939 + { 937 940 ec_validate_ecdt, "ASUS hardware", { 938 941 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 939 942 {},
+77 -36
drivers/acpi/osl.c
··· 110 110 static LIST_HEAD(acpi_ioremaps); 111 111 static DEFINE_SPINLOCK(acpi_ioremap_lock); 112 112 113 - #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 114 - static char osi_setup_string[OSI_STRING_LENGTH_MAX]; 115 - 116 113 static void __init acpi_osi_setup_late(void); 117 114 118 115 /* ··· 149 152 unsigned int enable:1; 150 153 unsigned int dmi:1; 151 154 unsigned int cmdline:1; 152 - unsigned int known:1; 153 - } osi_linux = { 0, 0, 0, 0}; 155 + } osi_linux = {0, 0, 0}; 154 156 155 157 static u32 acpi_osi_handler(acpi_string interface, u32 supported) 156 158 { ··· 1051 1055 1052 1056 __setup("acpi_os_name=", acpi_os_name_setup); 1053 1057 1058 + #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 1059 + #define OSI_STRING_ENTRIES_MAX 16 /* arbitrary */ 1060 + 1061 + struct osi_setup_entry { 1062 + char string[OSI_STRING_LENGTH_MAX]; 1063 + bool enable; 1064 + }; 1065 + 1066 + static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX]; 1067 + 1068 + void __init acpi_osi_setup(char *str) 1069 + { 1070 + struct osi_setup_entry *osi; 1071 + bool enable = true; 1072 + int i; 1073 + 1074 + if (!acpi_gbl_create_osi_method) 1075 + return; 1076 + 1077 + if (str == NULL || *str == '\0') { 1078 + printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1079 + acpi_gbl_create_osi_method = FALSE; 1080 + return; 1081 + } 1082 + 1083 + if (*str == '!') { 1084 + str++; 1085 + enable = false; 1086 + } 1087 + 1088 + for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { 1089 + osi = &osi_setup_entries[i]; 1090 + if (!strcmp(osi->string, str)) { 1091 + osi->enable = enable; 1092 + break; 1093 + } else if (osi->string[0] == '\0') { 1094 + osi->enable = enable; 1095 + strncpy(osi->string, str, OSI_STRING_LENGTH_MAX); 1096 + break; 1097 + } 1098 + } 1099 + } 1100 + 1054 1101 static void __init set_osi_linux(unsigned int enable) 1055 1102 { 1056 - if (osi_linux.enable != enable) { 1103 + if (osi_linux.enable != enable) 1057 1104 osi_linux.enable = enable; 1058 - printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", 1059 - enable ? "Add": "Delet"); 1060 - } 1061 1105 1062 1106 if (osi_linux.enable) 1063 1107 acpi_osi_setup("Linux"); ··· 1109 1073 1110 1074 static void __init acpi_cmdline_osi_linux(unsigned int enable) 1111 1075 { 1112 - osi_linux.cmdline = 1; /* cmdline set the default */ 1076 + osi_linux.cmdline = 1; /* cmdline set the default and override DMI */ 1077 + osi_linux.dmi = 0; 1113 1078 set_osi_linux(enable); 1114 1079 1115 1080 return; ··· 1118 1081 1119 1082 void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) 1120 1083 { 1121 - osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ 1122 - 1123 1084 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); 1124 1085 1125 1086 if (enable == -1) 1126 1087 return; 1127 1088 1128 - osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */ 1129 - 1089 + osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ 1130 1090 set_osi_linux(enable); 1131 1091 1132 1092 return; ··· 1138 1104 */ 1139 1105 static void __init acpi_osi_setup_late(void) 1140 1106 { 1141 - char *str = osi_setup_string; 1107 + struct osi_setup_entry *osi; 1108 + char *str; 1109 + int i; 1110 + acpi_status status; 1142 1111 1143 - if (*str == '\0') 1144 - return; 1112 + for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { 1113 + osi = &osi_setup_entries[i]; 1114 + str = osi->string; 1145 1115 1146 - if (!strcmp("!Linux", str)) { 1147 - acpi_cmdline_osi_linux(0); /* !enable */ 1148 - } else if (*str == '!') { 1149 - if (acpi_remove_interface(++str) == AE_OK) 1150 - printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); 1151 - } else if (!strcmp("Linux", str)) { 1152 - acpi_cmdline_osi_linux(1); /* enable */ 1153 - } else { 1154 - if (acpi_install_interface(str) == AE_OK) 1155 - printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); 1116 + if (*str == '\0') 1117 + break; 1118 + if (osi->enable) { 1119 + status = acpi_install_interface(str); 1120 + 1121 + if (ACPI_SUCCESS(status)) 1122 + printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); 1123 + } else { 1124 + status = acpi_remove_interface(str); 1125 + 1126 + if (ACPI_SUCCESS(status)) 1127 + printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); 1128 + } 1156 1129 } 1157 1130 } 1158 1131 1159 - int __init acpi_osi_setup(char *str) 1132 + static int __init osi_setup(char *str) 1160 1133 { 1161 - if (str == NULL || *str == '\0') { 1162 - printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1163 - acpi_gbl_create_osi_method = FALSE; 1164 - } else { 1165 - strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); 1166 - } 1134 + if (str && !strcmp("Linux", str)) 1135 + acpi_cmdline_osi_linux(1); 1136 + else if (str && !strcmp("!Linux", str)) 1137 + acpi_cmdline_osi_linux(0); 1138 + else 1139 + acpi_osi_setup(str); 1167 1140 1168 1141 return 1; 1169 1142 } 1170 1143 1171 - __setup("acpi_osi=", acpi_osi_setup); 1144 + __setup("acpi_osi=", osi_setup); 1172 1145 1173 1146 /* enable serialization to combat AE_ALREADY_EXISTS errors */ 1174 1147 static int __init acpi_serialize_setup(char *str) ··· 1571 1530 return AE_OK; 1572 1531 } 1573 1532 1574 - acpi_status acpi_os_initialize1(void) 1533 + acpi_status __init acpi_os_initialize1(void) 1575 1534 { 1576 1535 kacpid_wq = create_workqueue("kacpid"); 1577 1536 kacpi_notify_wq = create_workqueue("kacpi_notify");
+6 -6
drivers/acpi/power.c
··· 213 213 resource->name)); 214 214 } else { 215 215 result = __acpi_power_on(resource); 216 + if (result) 217 + resource->ref_count--; 216 218 } 217 219 218 220 mutex_unlock(&resource->resource_lock); 219 221 220 - return 0; 222 + return result; 221 223 } 222 224 223 225 static int acpi_power_off_device(acpi_handle handle) ··· 467 465 struct acpi_handle_list *tl = NULL; /* Target Resources */ 468 466 int i = 0; 469 467 470 - 471 468 if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) 472 469 return -EINVAL; 470 + 471 + if (device->power.state == state) 472 + return 0; 473 473 474 474 if ((device->power.state < ACPI_STATE_D0) 475 475 || (device->power.state > ACPI_STATE_D3)) ··· 490 486 result = acpi_power_on(tl->handles[i]); 491 487 if (result) 492 488 goto end; 493 - } 494 - 495 - if (device->power.state == state) { 496 - goto end; 497 489 } 498 490 499 491 /*
-9
drivers/acpi/processor_thermal.c
··· 156 156 return 0; 157 157 } 158 158 159 - static int acpi_thermal_cpufreq_increase(unsigned int cpu) 160 - { 161 - return -ENODEV; 162 - } 163 - static int acpi_thermal_cpufreq_decrease(unsigned int cpu) 164 - { 165 - return -ENODEV; 166 - } 167 - 168 159 #endif 169 160 170 161 int acpi_processor_get_limit_info(struct acpi_processor *pr)
+10 -2
drivers/acpi/sleep.c
··· 27 27 28 28 static u8 sleep_states[ACPI_S_STATE_COUNT]; 29 29 30 - static u32 acpi_target_sleep_state = ACPI_STATE_S0; 31 - 32 30 static void acpi_sleep_tts_switch(u32 acpi_state) 33 31 { 34 32 union acpi_object in_arg = { ACPI_TYPE_INTEGER }; ··· 79 81 } 80 82 81 83 #ifdef CONFIG_ACPI_SLEEP 84 + static u32 acpi_target_sleep_state = ACPI_STATE_S0; 85 + 82 86 /* 83 87 * The ACPI specification wants us to save NVS memory regions during hibernation 84 88 * and to restore them during the subsequent resume. Windows does that also for ··· 425 425 .matches = { 426 426 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 427 427 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), 428 + }, 429 + }, 430 + { 431 + .callback = init_nvs_nosave, 432 + .ident = "Sony Vaio VGN-NW130D", 433 + .matches = { 434 + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 435 + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"), 428 436 }, 429 437 }, 430 438 {},
+1 -1
drivers/pnp/pnpacpi/core.c
··· 180 180 }; 181 181 EXPORT_SYMBOL(pnpacpi_protocol); 182 182 183 - static char *pnpacpi_get_id(struct acpi_device *device) 183 + static char *__init pnpacpi_get_id(struct acpi_device *device) 184 184 { 185 185 struct acpi_hardware_id *id; 186 186
+4 -1
include/acpi/video.h
··· 1 1 #ifndef __ACPI_VIDEO_H 2 2 #define __ACPI_VIDEO_H 3 3 4 + #include <linux/errno.h> /* for ENODEV */ 5 + 6 + struct acpi_device; 7 + 4 8 #define ACPI_VIDEO_DISPLAY_CRT 1 5 9 #define ACPI_VIDEO_DISPLAY_TV 2 6 10 #define ACPI_VIDEO_DISPLAY_DVI 3 ··· 30 26 #endif 31 27 32 28 #endif 33 -
+1 -1
include/linux/acpi.h
··· 219 219 220 220 extern int acpi_blacklisted(void); 221 221 extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 222 - extern int acpi_osi_setup(char *str); 222 + extern void acpi_osi_setup(char *str); 223 223 224 224 #ifdef CONFIG_ACPI_NUMA 225 225 int acpi_get_pxm(acpi_handle handle);
+15
include/linux/video_output.h
··· 23 23 #ifndef _LINUX_VIDEO_OUTPUT_H 24 24 #define _LINUX_VIDEO_OUTPUT_H 25 25 #include <linux/device.h> 26 + #include <linux/err.h> 26 27 struct output_device; 27 28 struct output_properties { 28 29 int (*set_state)(struct output_device *); ··· 35 34 struct device dev; 36 35 }; 37 36 #define to_output_device(obj) container_of(obj, struct output_device, dev) 37 + #if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE) 38 38 struct output_device *video_output_register(const char *name, 39 39 struct device *dev, 40 40 void *devdata, 41 41 struct output_properties *op); 42 42 void video_output_unregister(struct output_device *dev); 43 + #else 44 + static struct output_device *video_output_register(const char *name, 45 + struct device *dev, 46 + void *devdata, 47 + struct output_properties *op) 48 + { 49 + return ERR_PTR(-ENODEV); 50 + } 51 + static void video_output_unregister(struct output_device *dev) 52 + { 53 + return; 54 + } 55 + #endif 43 56 #endif