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

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

Pull ACPI and power management fixes from Rafael Wysocki:

1) Four fixes for cpufreq regressions introduced by the changes that
removed Device Tree parsing for CPU device nodes from cpufreq
drivers from Sudeep KarkadaNagesha.

2) Two fixes for recent cpufreq regressions introduced by changes
related to the preservation of sysfs attributes over system
suspend/resume cycles from Viresh Kumar.

3) Fix for ACPI-based wakeup signaling in the PCI subsystem that
fails to stop PME polling for devices put into the D3cold power
state from Rafael J Wysocki.

4) Fix for bad interactions between cpufreq and udev on systems
supporting intel_pstate where acpi-cpufreq is available as well
from Yinghai Lu.

* tag 'pm+acpi-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq: return EEXIST instead of EBUSY for second registering
PCI / ACPI / PM: Clear pme_poll for devices in D3cold on wakeup
ARM: shmobile: change dev_id to cpu0 while registering cpu clock
ARM: i.MX: change dev_id to cpu0 while registering cpu clock
cpufreq: imx6q-cpufreq: assign cpu_dev correctly to cpu0 device
cpufreq: cpufreq-cpu0: assign cpu_dev correctly to cpu0 device
cpufreq: unlock correct rwsem while updating policy->cpu
cpufreq: Clear policy->cpus bits in __cpufreq_remove_dev_finish()

+46 -22
+1 -1
arch/arm/mach-imx/clk-imx27.c
··· 285 285 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL); 286 286 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc"); 287 287 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL); 288 - clk_register_clkdev(clk[cpu_div], NULL, "cpufreq-cpu0.0"); 288 + clk_register_clkdev(clk[cpu_div], NULL, "cpu0"); 289 289 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL); 290 290 291 291 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
+1 -1
arch/arm/mach-imx/clk-imx51-imx53.c
··· 328 328 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 329 329 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2"); 330 330 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 331 - clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0"); 331 + clk_register_clkdev(clk[cpu_podf], NULL, "cpu0"); 332 332 clk_register_clkdev(clk[iim_gate], "iim", NULL); 333 333 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0"); 334 334 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1");
+7 -2
arch/arm/mach-imx/mach-imx6q.c
··· 233 233 of_node_put(np); 234 234 } 235 235 236 - static void __init imx6q_opp_init(struct device *cpu_dev) 236 + static void __init imx6q_opp_init(void) 237 237 { 238 238 struct device_node *np; 239 + struct device *cpu_dev = get_cpu_device(0); 239 240 241 + if (!cpu_dev) { 242 + pr_warn("failed to get cpu0 device\n"); 243 + return; 244 + } 240 245 np = of_node_get(cpu_dev->of_node); 241 246 if (!np) { 242 247 pr_warn("failed to find cpu0 node\n"); ··· 273 268 imx6q_cpuidle_init(); 274 269 275 270 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) { 276 - imx6q_opp_init(&imx6q_cpufreq_pdev.dev); 271 + imx6q_opp_init(); 277 272 platform_device_register(&imx6q_cpufreq_pdev); 278 273 } 279 274 }
+1 -1
arch/arm/mach-shmobile/clock-r8a73a4.c
··· 555 555 CLKDEV_CON_ID("pll2h", &pll2h_clk), 556 556 557 557 /* CPU clock */ 558 - CLKDEV_DEV_ID("cpufreq-cpu0", &z_clk), 558 + CLKDEV_DEV_ID("cpu0", &z_clk), 559 559 560 560 /* DIV6 */ 561 561 CLKDEV_CON_ID("zb", &div6_clks[DIV6_ZB]),
+1 -1
arch/arm/mach-shmobile/clock-sh73a0.c
··· 616 616 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */ 617 617 618 618 /* DIV4 clocks */ 619 - CLKDEV_DEV_ID("cpufreq-cpu0", &div4_clks[DIV4_Z]), 619 + CLKDEV_DEV_ID("cpu0", &div4_clks[DIV4_Z]), 620 620 621 621 /* DIV6 clocks */ 622 622 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
+6 -1
drivers/cpufreq/cpufreq-cpu0.c
··· 12 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13 13 14 14 #include <linux/clk.h> 15 + #include <linux/cpu.h> 15 16 #include <linux/cpufreq.h> 16 17 #include <linux/err.h> 17 18 #include <linux/module.h> ··· 178 177 struct device_node *np; 179 178 int ret; 180 179 181 - cpu_dev = &pdev->dev; 180 + cpu_dev = get_cpu_device(0); 181 + if (!cpu_dev) { 182 + pr_err("failed to get cpu0 device\n"); 183 + return -ENODEV; 184 + } 182 185 183 186 np = of_node_get(cpu_dev->of_node); 184 187 if (!np) {
+20 -11
drivers/cpufreq/cpufreq.c
··· 952 952 if (cpu == policy->cpu) 953 953 return; 954 954 955 + /* 956 + * Take direct locks as lock_policy_rwsem_write wouldn't work here. 957 + * Also lock for last cpu is enough here as contention will happen only 958 + * after policy->cpu is changed and after it is changed, other threads 959 + * will try to acquire lock for new cpu. And policy is already updated 960 + * by then. 961 + */ 962 + down_write(&per_cpu(cpu_policy_rwsem, policy->cpu)); 963 + 955 964 policy->last_cpu = policy->cpu; 956 965 policy->cpu = cpu; 966 + 967 + up_write(&per_cpu(cpu_policy_rwsem, policy->last_cpu)); 957 968 958 969 #ifdef CONFIG_CPU_FREQ_TABLE 959 970 cpufreq_frequency_table_update_policy_cpu(policy); ··· 1136 1125 int ret; 1137 1126 1138 1127 /* first sibling now owns the new sysfs dir */ 1139 - cpu_dev = get_cpu_device(cpumask_first(policy->cpus)); 1128 + cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu)); 1140 1129 1141 1130 /* Don't touch sysfs files during light-weight tear-down */ 1142 1131 if (frozen) ··· 1200 1189 policy->governor->name, CPUFREQ_NAME_LEN); 1201 1190 #endif 1202 1191 1203 - WARN_ON(lock_policy_rwsem_write(cpu)); 1192 + lock_policy_rwsem_read(cpu); 1204 1193 cpus = cpumask_weight(policy->cpus); 1205 - 1206 - if (cpus > 1) 1207 - cpumask_clear_cpu(cpu, policy->cpus); 1208 - unlock_policy_rwsem_write(cpu); 1194 + unlock_policy_rwsem_read(cpu); 1209 1195 1210 1196 if (cpu != policy->cpu) { 1211 1197 if (!frozen) ··· 1211 1203 1212 1204 new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen); 1213 1205 if (new_cpu >= 0) { 1214 - WARN_ON(lock_policy_rwsem_write(cpu)); 1215 1206 update_policy_cpu(policy, new_cpu); 1216 - unlock_policy_rwsem_write(cpu); 1217 1207 1218 1208 if (!frozen) { 1219 1209 pr_debug("%s: policy Kobject moved to cpu: %d " ··· 1243 1237 return -EINVAL; 1244 1238 } 1245 1239 1246 - lock_policy_rwsem_read(cpu); 1240 + WARN_ON(lock_policy_rwsem_write(cpu)); 1247 1241 cpus = cpumask_weight(policy->cpus); 1248 - unlock_policy_rwsem_read(cpu); 1242 + 1243 + if (cpus > 1) 1244 + cpumask_clear_cpu(cpu, policy->cpus); 1245 + unlock_policy_rwsem_write(cpu); 1249 1246 1250 1247 /* If cpu is last user of policy, free policy */ 1251 1248 if (cpus == 1) { ··· 2104 2095 write_lock_irqsave(&cpufreq_driver_lock, flags); 2105 2096 if (cpufreq_driver) { 2106 2097 write_unlock_irqrestore(&cpufreq_driver_lock, flags); 2107 - return -EBUSY; 2098 + return -EEXIST; 2108 2099 } 2109 2100 cpufreq_driver = driver_data; 2110 2101 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+6 -1
drivers/cpufreq/imx6q-cpufreq.c
··· 7 7 */ 8 8 9 9 #include <linux/clk.h> 10 + #include <linux/cpu.h> 10 11 #include <linux/cpufreq.h> 11 12 #include <linux/delay.h> 12 13 #include <linux/err.h> ··· 203 202 unsigned long min_volt, max_volt; 204 203 int num, ret; 205 204 206 - cpu_dev = &pdev->dev; 205 + cpu_dev = get_cpu_device(0); 206 + if (!cpu_dev) { 207 + pr_err("failed to get cpu0 device\n"); 208 + return -ENODEV; 209 + } 207 210 208 211 np = of_node_get(cpu_dev->of_node); 209 212 if (!np) {
+3 -3
drivers/pci/pci-acpi.c
··· 47 47 if (event != ACPI_NOTIFY_DEVICE_WAKE || !pci_dev) 48 48 return; 49 49 50 + if (pci_dev->pme_poll) 51 + pci_dev->pme_poll = false; 52 + 50 53 if (pci_dev->current_state == PCI_D3cold) { 51 54 pci_wakeup_event(pci_dev); 52 55 pm_runtime_resume(&pci_dev->dev); ··· 59 56 /* Clear PME Status if set. */ 60 57 if (pci_dev->pme_support) 61 58 pci_check_pme_status(pci_dev); 62 - 63 - if (pci_dev->pme_poll) 64 - pci_dev->pme_poll = false; 65 59 66 60 pci_wakeup_event(pci_dev); 67 61 pm_runtime_resume(&pci_dev->dev);