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

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

Pull ACPI and power management fixes from Rafael Wysocki:

- Revert of a recent cpuidle change that caused Nehalem machines to
hang on boot from Alex Shi.

- USB power management fix addressing a crash in the port device
object's release routine from Rafael J Wysocki.

- Device PM QoS fix for a potential deadlock related to sysfs interface
from Rafael J Wysocki.

- Fix for a cpufreq crash when the /cpus Device Tree node is missing
from Paolo Pisati.

- Fix for a build issue on ia64 related to the Boot Graphics Resource
Table (BGRT) from Tony Luck.

- Two fixes for ACPI handles being set incorrectly for device objects
that don't correspond to any ACPI namespace nodes in the I2C and SPI
subsystems from Rafael J Wysocki.

- Fix for compiler warnings related to CONFIG_PM_DEVFREQ being unset
from Rajagopal Venkat.

- Fix for a symbol definition typo in cpufreq_governor.h from Borislav
Petkov.

* tag 'pm+acpi-3.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / BGRT: Don't let users configure BGRT on non X86 systems
cpuidle / ACPI: recover percpu ACPI processor cstate
ACPI / I2C: Use parent's ACPI_HANDLE() in acpi_i2c_register_devices()
cpufreq: Correct header guards typo
ACPI / SPI: Use parent's ACPI_HANDLE() in acpi_register_spi_devices()
cpufreq: check OF node /cpus presence before dereferencing it
PM / devfreq: Fix compiler warnings for CONFIG_PM_DEVFREQ unset
PM / QoS: Avoid possible deadlock related to sysfs access
USB / PM: Don't try to hide PM QoS flags from usb_port_device_release()

+76 -38
+1 -1
drivers/acpi/Kconfig
··· 396 396 397 397 config ACPI_BGRT 398 398 bool "Boottime Graphics Resource Table support" 399 - depends on EFI 399 + depends on EFI && X86 400 400 help 401 401 This driver adds support for exposing the ACPI Boottime Graphics 402 402 Resource Table, which allows the operating system to obtain
+1 -1
drivers/acpi/acpi_i2c.c
··· 90 90 acpi_handle handle; 91 91 acpi_status status; 92 92 93 - handle = ACPI_HANDLE(&adapter->dev); 93 + handle = ACPI_HANDLE(adapter->dev.parent); 94 94 if (!handle) 95 95 return; 96 96
+7 -6
drivers/acpi/processor_idle.c
··· 66 66 67 67 static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); 68 68 69 - static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX]; 69 + static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], 70 + acpi_cstate); 70 71 71 72 static int disabled_by_idle_boot_param(void) 72 73 { ··· 723 722 struct cpuidle_driver *drv, int index) 724 723 { 725 724 struct acpi_processor *pr; 726 - struct acpi_processor_cx *cx = acpi_cstate[index]; 725 + struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); 727 726 728 727 pr = __this_cpu_read(processors); 729 728 ··· 746 745 */ 747 746 static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) 748 747 { 749 - struct acpi_processor_cx *cx = acpi_cstate[index]; 748 + struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); 750 749 751 750 ACPI_FLUSH_CPU_CACHE(); 752 751 ··· 776 775 struct cpuidle_driver *drv, int index) 777 776 { 778 777 struct acpi_processor *pr; 779 - struct acpi_processor_cx *cx = acpi_cstate[index]; 778 + struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); 780 779 781 780 pr = __this_cpu_read(processors); 782 781 ··· 834 833 struct cpuidle_driver *drv, int index) 835 834 { 836 835 struct acpi_processor *pr; 837 - struct acpi_processor_cx *cx = acpi_cstate[index]; 836 + struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); 838 837 839 838 pr = __this_cpu_read(processors); 840 839 ··· 961 960 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 962 961 continue; 963 962 #endif 964 - acpi_cstate[count] = cx; 963 + per_cpu(acpi_cstate[count], dev->cpu) = cx; 965 964 966 965 count++; 967 966 if (count == CPUIDLE_STATE_MAX)
+47 -13
drivers/base/power/qos.c
··· 46 46 #include "power.h" 47 47 48 48 static DEFINE_MUTEX(dev_pm_qos_mtx); 49 + static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx); 49 50 50 51 static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); 51 52 ··· 217 216 struct pm_qos_constraints *c; 218 217 struct pm_qos_flags *f; 219 218 220 - mutex_lock(&dev_pm_qos_mtx); 219 + mutex_lock(&dev_pm_qos_sysfs_mtx); 221 220 222 221 /* 223 222 * If the device's PM QoS resume latency limit or PM QoS flags have been 224 223 * exposed to user space, they have to be hidden at this point. 225 224 */ 225 + pm_qos_sysfs_remove_latency(dev); 226 + pm_qos_sysfs_remove_flags(dev); 227 + 228 + mutex_lock(&dev_pm_qos_mtx); 229 + 226 230 __dev_pm_qos_hide_latency_limit(dev); 227 231 __dev_pm_qos_hide_flags(dev); 228 232 ··· 260 254 261 255 out: 262 256 mutex_unlock(&dev_pm_qos_mtx); 257 + 258 + mutex_unlock(&dev_pm_qos_sysfs_mtx); 263 259 } 264 260 265 261 /** ··· 566 558 kfree(req); 567 559 } 568 560 561 + static void dev_pm_qos_drop_user_request(struct device *dev, 562 + enum dev_pm_qos_req_type type) 563 + { 564 + mutex_lock(&dev_pm_qos_mtx); 565 + __dev_pm_qos_drop_user_request(dev, type); 566 + mutex_unlock(&dev_pm_qos_mtx); 567 + } 568 + 569 569 /** 570 570 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. 571 571 * @dev: Device whose PM QoS latency limit is to be exposed to user space. ··· 597 581 return ret; 598 582 } 599 583 584 + mutex_lock(&dev_pm_qos_sysfs_mtx); 585 + 600 586 mutex_lock(&dev_pm_qos_mtx); 601 587 602 588 if (IS_ERR_OR_NULL(dev->power.qos)) ··· 609 591 if (ret < 0) { 610 592 __dev_pm_qos_remove_request(req); 611 593 kfree(req); 594 + mutex_unlock(&dev_pm_qos_mtx); 612 595 goto out; 613 596 } 614 - 615 597 dev->power.qos->latency_req = req; 598 + 599 + mutex_unlock(&dev_pm_qos_mtx); 600 + 616 601 ret = pm_qos_sysfs_add_latency(dev); 617 602 if (ret) 618 - __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 603 + dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 619 604 620 605 out: 621 - mutex_unlock(&dev_pm_qos_mtx); 606 + mutex_unlock(&dev_pm_qos_sysfs_mtx); 622 607 return ret; 623 608 } 624 609 EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); 625 610 626 611 static void __dev_pm_qos_hide_latency_limit(struct device *dev) 627 612 { 628 - if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { 629 - pm_qos_sysfs_remove_latency(dev); 613 + if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) 630 614 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 631 - } 632 615 } 633 616 634 617 /** ··· 638 619 */ 639 620 void dev_pm_qos_hide_latency_limit(struct device *dev) 640 621 { 622 + mutex_lock(&dev_pm_qos_sysfs_mtx); 623 + 624 + pm_qos_sysfs_remove_latency(dev); 625 + 641 626 mutex_lock(&dev_pm_qos_mtx); 642 627 __dev_pm_qos_hide_latency_limit(dev); 643 628 mutex_unlock(&dev_pm_qos_mtx); 629 + 630 + mutex_unlock(&dev_pm_qos_sysfs_mtx); 644 631 } 645 632 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); 646 633 ··· 674 649 } 675 650 676 651 pm_runtime_get_sync(dev); 652 + mutex_lock(&dev_pm_qos_sysfs_mtx); 653 + 677 654 mutex_lock(&dev_pm_qos_mtx); 678 655 679 656 if (IS_ERR_OR_NULL(dev->power.qos)) ··· 686 659 if (ret < 0) { 687 660 __dev_pm_qos_remove_request(req); 688 661 kfree(req); 662 + mutex_unlock(&dev_pm_qos_mtx); 689 663 goto out; 690 664 } 691 - 692 665 dev->power.qos->flags_req = req; 666 + 667 + mutex_unlock(&dev_pm_qos_mtx); 668 + 693 669 ret = pm_qos_sysfs_add_flags(dev); 694 670 if (ret) 695 - __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 671 + dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 696 672 697 673 out: 698 - mutex_unlock(&dev_pm_qos_mtx); 674 + mutex_unlock(&dev_pm_qos_sysfs_mtx); 699 675 pm_runtime_put(dev); 700 676 return ret; 701 677 } ··· 706 676 707 677 static void __dev_pm_qos_hide_flags(struct device *dev) 708 678 { 709 - if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { 710 - pm_qos_sysfs_remove_flags(dev); 679 + if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) 711 680 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 712 - } 713 681 } 714 682 715 683 /** ··· 717 689 void dev_pm_qos_hide_flags(struct device *dev) 718 690 { 719 691 pm_runtime_get_sync(dev); 692 + mutex_lock(&dev_pm_qos_sysfs_mtx); 693 + 694 + pm_qos_sysfs_remove_flags(dev); 695 + 720 696 mutex_lock(&dev_pm_qos_mtx); 721 697 __dev_pm_qos_hide_flags(dev); 722 698 mutex_unlock(&dev_pm_qos_mtx); 699 + 700 + mutex_unlock(&dev_pm_qos_sysfs_mtx); 723 701 pm_runtime_put(dev); 724 702 } 725 703 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);
+8 -2
drivers/cpufreq/cpufreq-cpu0.c
··· 178 178 179 179 static int cpu0_cpufreq_probe(struct platform_device *pdev) 180 180 { 181 - struct device_node *np; 181 + struct device_node *np, *parent; 182 182 int ret; 183 183 184 - for_each_child_of_node(of_find_node_by_path("/cpus"), np) { 184 + parent = of_find_node_by_path("/cpus"); 185 + if (!parent) { 186 + pr_err("failed to find OF /cpus\n"); 187 + return -ENOENT; 188 + } 189 + 190 + for_each_child_of_node(parent, np) { 185 191 if (of_get_property(np, "operating-points", NULL)) 186 192 break; 187 193 }
+3 -3
drivers/cpufreq/cpufreq_governor.h
··· 14 14 * published by the Free Software Foundation. 15 15 */ 16 16 17 - #ifndef _CPUFREQ_GOVERNER_H 18 - #define _CPUFREQ_GOVERNER_H 17 + #ifndef _CPUFREQ_GOVERNOR_H 18 + #define _CPUFREQ_GOVERNOR_H 19 19 20 20 #include <linux/cpufreq.h> 21 21 #include <linux/kobject.h> ··· 175 175 unsigned int sampling_rate); 176 176 int cpufreq_governor_dbs(struct dbs_data *dbs_data, 177 177 struct cpufreq_policy *policy, unsigned int event); 178 - #endif /* _CPUFREQ_GOVERNER_H */ 178 + #endif /* _CPUFREQ_GOVERNOR_H */
-1
drivers/i2c/busses/i2c-designware-platdrv.c
··· 182 182 adap->algo = &i2c_dw_algo; 183 183 adap->dev.parent = &pdev->dev; 184 184 adap->dev.of_node = pdev->dev.of_node; 185 - ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev)); 186 185 187 186 r = i2c_add_numbered_adapter(adap); 188 187 if (r) {
-1
drivers/spi/spi-pxa2xx.c
··· 1168 1168 1169 1169 master->dev.parent = &pdev->dev; 1170 1170 master->dev.of_node = pdev->dev.of_node; 1171 - ACPI_HANDLE_SET(&master->dev, ACPI_HANDLE(&pdev->dev)); 1172 1171 /* the spi->mode bits understood by this driver: */ 1173 1172 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; 1174 1173
+1 -1
drivers/spi/spi.c
··· 984 984 acpi_status status; 985 985 acpi_handle handle; 986 986 987 - handle = ACPI_HANDLE(&master->dev); 987 + handle = ACPI_HANDLE(master->dev.parent); 988 988 if (!handle) 989 989 return; 990 990
-1
drivers/usb/core/port.c
··· 67 67 { 68 68 struct usb_port *port_dev = to_usb_port(dev); 69 69 70 - dev_pm_qos_hide_flags(dev); 71 70 kfree(port_dev); 72 71 } 73 72
+8 -8
include/linux/devfreq.h
··· 213 213 #endif 214 214 215 215 #else /* !CONFIG_PM_DEVFREQ */ 216 - static struct devfreq *devfreq_add_device(struct device *dev, 216 + static inline struct devfreq *devfreq_add_device(struct device *dev, 217 217 struct devfreq_dev_profile *profile, 218 218 const char *governor_name, 219 219 void *data) ··· 221 221 return NULL; 222 222 } 223 223 224 - static int devfreq_remove_device(struct devfreq *devfreq) 224 + static inline int devfreq_remove_device(struct devfreq *devfreq) 225 225 { 226 226 return 0; 227 227 } 228 228 229 - static int devfreq_suspend_device(struct devfreq *devfreq) 229 + static inline int devfreq_suspend_device(struct devfreq *devfreq) 230 230 { 231 231 return 0; 232 232 } 233 233 234 - static int devfreq_resume_device(struct devfreq *devfreq) 234 + static inline int devfreq_resume_device(struct devfreq *devfreq) 235 235 { 236 236 return 0; 237 237 } 238 238 239 - static struct opp *devfreq_recommended_opp(struct device *dev, 239 + static inline struct opp *devfreq_recommended_opp(struct device *dev, 240 240 unsigned long *freq, u32 flags) 241 241 { 242 - return -EINVAL; 242 + return ERR_PTR(-EINVAL); 243 243 } 244 244 245 - static int devfreq_register_opp_notifier(struct device *dev, 245 + static inline int devfreq_register_opp_notifier(struct device *dev, 246 246 struct devfreq *devfreq) 247 247 { 248 248 return -EINVAL; 249 249 } 250 250 251 - static int devfreq_unregister_opp_notifier(struct device *dev, 251 + static inline int devfreq_unregister_opp_notifier(struct device *dev, 252 252 struct devfreq *devfreq) 253 253 { 254 254 return -EINVAL;