Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm+acpi-3.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes from Rafael Wysocki:

- intel_pstate fix for misbehavior after system resume if sysfs
attributes are set in a specific way before the corresponding suspend
from Dirk Brandewie.

- A recent intel_pstate fix has no effect if unsigned long is 32-bit,
so fix it up to cover that case as well.

- The s3c64xx cpufreq driver was not updated when the index field of
struct cpufreq_frequency_table was replaced with driver_data, so
update it now. From Charles Keepax.

- The Kconfig help text for ACPI_BUTTON still refers to
/proc/acpi/event that has been dropped recently, so modify it to
remove that reference. From Krzysztof Mazur.

- A Lan Tianyu's change adds a missing mutex unlock to an error code
path in acpi_resume_power_resources().

- Some code related to ACPI power resources, whose very purpose is
questionable to put it lightly, turns out to cause problems to happen
during testing on real systems, so remove it completely (we may
revisit that in the future if there's a compelling enough reason).
From Rafael J Wysocki and Aaron Lu.

* tag 'pm+acpi-3.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / PM: Drop two functions that are not used any more
ATA / ACPI: remove power dependent device handling
cpufreq: s3c64xx: Rename index to driver_data
ACPI / power: Drop automaitc resume of power resource dependent devices
intel_pstate: Fix type mismatch warning
cpufreq / intel_pstate: Fix max_perf_pct on resume
ACPI: remove /proc/acpi/event from ACPI_BUTTON help
ACPI / power: Release resource_lock after acpi_power_get_state() return error

+15 -196
+3 -3
drivers/acpi/Kconfig
··· 123 123 default y 124 124 help 125 125 This driver handles events on the power, sleep, and lid buttons. 126 - A daemon reads /proc/acpi/event and perform user-defined actions 127 - such as shutting down the system. This is necessary for 128 - software-controlled poweroff. 126 + A daemon reads events from input devices or via netlink and 127 + performs user-defined actions such as shutting down the system. 128 + This is necessary for software-controlled poweroff. 129 129 130 130 To compile this driver as a module, choose M here: 131 131 the module will be called button.
-56
drivers/acpi/device_pm.c
··· 1025 1025 } 1026 1026 } 1027 1027 EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); 1028 - 1029 - /** 1030 - * acpi_dev_pm_add_dependent - Add physical device depending for PM. 1031 - * @handle: Handle of ACPI device node. 1032 - * @depdev: Device depending on that node for PM. 1033 - */ 1034 - void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev) 1035 - { 1036 - struct acpi_device_physical_node *dep; 1037 - struct acpi_device *adev; 1038 - 1039 - if (!depdev || acpi_bus_get_device(handle, &adev)) 1040 - return; 1041 - 1042 - mutex_lock(&adev->physical_node_lock); 1043 - 1044 - list_for_each_entry(dep, &adev->power_dependent, node) 1045 - if (dep->dev == depdev) 1046 - goto out; 1047 - 1048 - dep = kzalloc(sizeof(*dep), GFP_KERNEL); 1049 - if (dep) { 1050 - dep->dev = depdev; 1051 - list_add_tail(&dep->node, &adev->power_dependent); 1052 - } 1053 - 1054 - out: 1055 - mutex_unlock(&adev->physical_node_lock); 1056 - } 1057 - EXPORT_SYMBOL_GPL(acpi_dev_pm_add_dependent); 1058 - 1059 - /** 1060 - * acpi_dev_pm_remove_dependent - Remove physical device depending for PM. 1061 - * @handle: Handle of ACPI device node. 1062 - * @depdev: Device depending on that node for PM. 1063 - */ 1064 - void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev) 1065 - { 1066 - struct acpi_device_physical_node *dep; 1067 - struct acpi_device *adev; 1068 - 1069 - if (!depdev || acpi_bus_get_device(handle, &adev)) 1070 - return; 1071 - 1072 - mutex_lock(&adev->physical_node_lock); 1073 - 1074 - list_for_each_entry(dep, &adev->power_dependent, node) 1075 - if (dep->dev == depdev) { 1076 - list_del(&dep->node); 1077 - kfree(dep); 1078 - break; 1079 - } 1080 - 1081 - mutex_unlock(&adev->physical_node_lock); 1082 - } 1083 - EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); 1084 1028 #endif /* CONFIG_PM */
+4 -100
drivers/acpi/power.c
··· 59 59 #define ACPI_POWER_RESOURCE_STATE_ON 0x01 60 60 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF 61 61 62 - struct acpi_power_dependent_device { 63 - struct list_head node; 64 - struct acpi_device *adev; 65 - struct work_struct work; 66 - }; 67 - 68 62 struct acpi_power_resource { 69 63 struct acpi_device device; 70 64 struct list_head list_node; 71 - struct list_head dependent; 72 65 char *name; 73 66 u32 system_level; 74 67 u32 order; ··· 226 233 return 0; 227 234 } 228 235 229 - static void acpi_power_resume_dependent(struct work_struct *work) 230 - { 231 - struct acpi_power_dependent_device *dep; 232 - struct acpi_device_physical_node *pn; 233 - struct acpi_device *adev; 234 - int state; 235 - 236 - dep = container_of(work, struct acpi_power_dependent_device, work); 237 - adev = dep->adev; 238 - if (acpi_power_get_inferred_state(adev, &state)) 239 - return; 240 - 241 - if (state > ACPI_STATE_D0) 242 - return; 243 - 244 - mutex_lock(&adev->physical_node_lock); 245 - 246 - list_for_each_entry(pn, &adev->physical_node_list, node) 247 - pm_request_resume(pn->dev); 248 - 249 - list_for_each_entry(pn, &adev->power_dependent, node) 250 - pm_request_resume(pn->dev); 251 - 252 - mutex_unlock(&adev->physical_node_lock); 253 - } 254 - 255 236 static int __acpi_power_on(struct acpi_power_resource *resource) 256 237 { 257 238 acpi_status status = AE_OK; ··· 250 283 resource->name)); 251 284 } else { 252 285 result = __acpi_power_on(resource); 253 - if (result) { 286 + if (result) 254 287 resource->ref_count--; 255 - } else { 256 - struct acpi_power_dependent_device *dep; 257 - 258 - list_for_each_entry(dep, &resource->dependent, node) 259 - schedule_work(&dep->work); 260 - } 261 288 } 262 289 return result; 263 290 } ··· 351 390 return result; 352 391 } 353 392 354 - static void acpi_power_add_dependent(struct acpi_power_resource *resource, 355 - struct acpi_device *adev) 356 - { 357 - struct acpi_power_dependent_device *dep; 358 - 359 - mutex_lock(&resource->resource_lock); 360 - 361 - list_for_each_entry(dep, &resource->dependent, node) 362 - if (dep->adev == adev) 363 - goto out; 364 - 365 - dep = kzalloc(sizeof(*dep), GFP_KERNEL); 366 - if (!dep) 367 - goto out; 368 - 369 - dep->adev = adev; 370 - INIT_WORK(&dep->work, acpi_power_resume_dependent); 371 - list_add_tail(&dep->node, &resource->dependent); 372 - 373 - out: 374 - mutex_unlock(&resource->resource_lock); 375 - } 376 - 377 - static void acpi_power_remove_dependent(struct acpi_power_resource *resource, 378 - struct acpi_device *adev) 379 - { 380 - struct acpi_power_dependent_device *dep; 381 - struct work_struct *work = NULL; 382 - 383 - mutex_lock(&resource->resource_lock); 384 - 385 - list_for_each_entry(dep, &resource->dependent, node) 386 - if (dep->adev == adev) { 387 - list_del(&dep->node); 388 - work = &dep->work; 389 - break; 390 - } 391 - 392 - mutex_unlock(&resource->resource_lock); 393 - 394 - if (work) { 395 - cancel_work_sync(work); 396 - kfree(dep); 397 - } 398 - } 399 - 400 393 static struct attribute *attrs[] = { 401 394 NULL, 402 395 }; ··· 439 524 440 525 void acpi_power_add_remove_device(struct acpi_device *adev, bool add) 441 526 { 442 - struct acpi_device_power_state *ps; 443 - struct acpi_power_resource_entry *entry; 444 527 int state; 445 528 446 529 if (adev->wakeup.flags.valid) ··· 447 534 448 535 if (!adev->power.flags.power_resources) 449 536 return; 450 - 451 - ps = &adev->power.states[ACPI_STATE_D0]; 452 - list_for_each_entry(entry, &ps->resources, node) { 453 - struct acpi_power_resource *resource = entry->resource; 454 - 455 - if (add) 456 - acpi_power_add_dependent(resource, adev); 457 - else 458 - acpi_power_remove_dependent(resource, adev); 459 - } 460 537 461 538 for (state = ACPI_STATE_D0; state <= ACPI_STATE_D3_HOT; state++) 462 539 acpi_power_expose_hide(adev, ··· 785 882 acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER, 786 883 ACPI_STA_DEFAULT); 787 884 mutex_init(&resource->resource_lock); 788 - INIT_LIST_HEAD(&resource->dependent); 789 885 INIT_LIST_HEAD(&resource->list_node); 790 886 resource->name = device->pnp.bus_id; 791 887 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); ··· 838 936 mutex_lock(&resource->resource_lock); 839 937 840 938 result = acpi_power_get_state(resource->device.handle, &state); 841 - if (result) 939 + if (result) { 940 + mutex_unlock(&resource->resource_lock); 842 941 continue; 942 + } 843 943 844 944 if (state == ACPI_POWER_RESOURCE_STATE_OFF 845 945 && resource->ref_count) {
-1
drivers/acpi/scan.c
··· 999 999 INIT_LIST_HEAD(&device->wakeup_list); 1000 1000 INIT_LIST_HEAD(&device->physical_node_list); 1001 1001 mutex_init(&device->physical_node_lock); 1002 - INIT_LIST_HEAD(&device->power_dependent); 1003 1002 1004 1003 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); 1005 1004 if (!new_bus_id) {
-14
drivers/ata/libata-acpi.c
··· 1035 1035 { 1036 1036 ata_acpi_clear_gtf(dev); 1037 1037 } 1038 - 1039 - void ata_scsi_acpi_bind(struct ata_device *dev) 1040 - { 1041 - acpi_handle handle = ata_dev_acpi_handle(dev); 1042 - if (handle) 1043 - acpi_dev_pm_add_dependent(handle, &dev->sdev->sdev_gendev); 1044 - } 1045 - 1046 - void ata_scsi_acpi_unbind(struct ata_device *dev) 1047 - { 1048 - acpi_handle handle = ata_dev_acpi_handle(dev); 1049 - if (handle) 1050 - acpi_dev_pm_remove_dependent(handle, &dev->sdev->sdev_gendev); 1051 - }
-3
drivers/ata/libata-scsi.c
··· 3679 3679 if (!IS_ERR(sdev)) { 3680 3680 dev->sdev = sdev; 3681 3681 scsi_device_put(sdev); 3682 - ata_scsi_acpi_bind(dev); 3683 3682 } else { 3684 3683 dev->sdev = NULL; 3685 3684 } ··· 3765 3766 struct ata_port *ap = dev->link->ap; 3766 3767 struct scsi_device *sdev; 3767 3768 unsigned long flags; 3768 - 3769 - ata_scsi_acpi_unbind(dev); 3770 3769 3771 3770 /* Alas, we need to grab scan_mutex to ensure SCSI device 3772 3771 * state doesn't change underneath us and thus
-4
drivers/ata/libata.h
··· 121 121 extern void ata_acpi_bind_port(struct ata_port *ap); 122 122 extern void ata_acpi_bind_dev(struct ata_device *dev); 123 123 extern acpi_handle ata_dev_acpi_handle(struct ata_device *dev); 124 - extern void ata_scsi_acpi_bind(struct ata_device *dev); 125 - extern void ata_scsi_acpi_unbind(struct ata_device *dev); 126 124 #else 127 125 static inline void ata_acpi_dissociate(struct ata_host *host) { } 128 126 static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } ··· 131 133 pm_message_t state) { } 132 134 static inline void ata_acpi_bind_port(struct ata_port *ap) {} 133 135 static inline void ata_acpi_bind_dev(struct ata_device *dev) {} 134 - static inline void ata_scsi_acpi_bind(struct ata_device *dev) {} 135 - static inline void ata_scsi_acpi_unbind(struct ata_device *dev) {} 136 136 #endif 137 137 138 138 /* libata-scsi.c */
+7 -7
drivers/cpufreq/intel_pstate.c
··· 383 383 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) 384 384 { 385 385 int max_perf, min_perf; 386 + u64 val; 386 387 387 388 intel_pstate_get_min_max(cpu, &min_perf, &max_perf); 388 389 ··· 395 394 trace_cpu_frequency(pstate * 100000, cpu->cpu); 396 395 397 396 cpu->pstate.current_pstate = pstate; 397 + val = pstate << 8; 398 398 if (limits.no_turbo) 399 - wrmsrl(MSR_IA32_PERF_CTL, BIT(32) | (pstate << 8)); 400 - else 401 - wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); 399 + val |= (u64)1 << 32; 402 400 401 + wrmsrl(MSR_IA32_PERF_CTL, val); 403 402 } 404 403 405 404 static inline void intel_pstate_pstate_increase(struct cpudata *cpu, int steps) ··· 638 637 639 638 static int intel_pstate_cpu_init(struct cpufreq_policy *policy) 640 639 { 641 - int rc, min_pstate, max_pstate; 642 640 struct cpudata *cpu; 641 + int rc; 643 642 644 643 rc = intel_pstate_init_cpu(policy->cpu); 645 644 if (rc) ··· 653 652 else 654 653 policy->policy = CPUFREQ_POLICY_POWERSAVE; 655 654 656 - intel_pstate_get_min_max(cpu, &min_pstate, &max_pstate); 657 - policy->min = min_pstate * 100000; 658 - policy->max = max_pstate * 100000; 655 + policy->min = cpu->pstate.min_pstate * 100000; 656 + policy->max = cpu->pstate.turbo_pstate * 100000; 659 657 660 658 /* cpuinfo and default policy values */ 661 659 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * 100000;
+1 -1
drivers/cpufreq/s3c64xx-cpufreq.c
··· 166 166 if (freq->frequency == CPUFREQ_ENTRY_INVALID) 167 167 continue; 168 168 169 - dvfs = &s3c64xx_dvfs_table[freq->index]; 169 + dvfs = &s3c64xx_dvfs_table[freq->driver_data]; 170 170 found = 0; 171 171 172 172 for (i = 0; i < count; i++) {
-7
include/acpi/acpi_bus.h
··· 311 311 unsigned int physical_node_count; 312 312 struct list_head physical_node_list; 313 313 struct mutex physical_node_lock; 314 - struct list_head power_dependent; 315 314 void (*remove)(struct acpi_device *); 316 315 }; 317 316 ··· 455 456 acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 456 457 acpi_notify_handler handler); 457 458 int acpi_pm_device_sleep_state(struct device *, int *, int); 458 - void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev); 459 - void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev); 460 459 #else 461 460 static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 462 461 acpi_notify_handler handler, ··· 475 478 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? 476 479 m : ACPI_STATE_D0; 477 480 } 478 - static inline void acpi_dev_pm_add_dependent(acpi_handle handle, 479 - struct device *depdev) {} 480 - static inline void acpi_dev_pm_remove_dependent(acpi_handle handle, 481 - struct device *depdev) {} 482 481 #endif 483 482 484 483 #ifdef CONFIG_PM_RUNTIME