aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-03 22:43:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-03 22:43:08 -0400
commit597f03f9d133e9837d00965016170271d4f87dcf (patch)
tree33bdb5c1104d5b466387f4ae98748c5f4ddd29bb /drivers/cpufreq
parent999dcbe2414e15e19cdc1f91497d01f262c6e1cf (diff)
parent0bf71e4d02ffec8ab9a6adecca61d3eed74fc99d (diff)
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug updates from Thomas Gleixner: "Yet another batch of cpu hotplug core updates and conversions: - Provide core infrastructure for multi instance drivers so the drivers do not have to keep custom lists. - Convert custom lists to the new infrastructure. The block-mq custom list conversion comes through the block tree and makes the diffstat tip over to more lines removed than added. - Handle unbalanced hotplug enable/disable calls more gracefully. - Remove the obsolete CPU_STARTING/DYING notifier support. - Convert another batch of notifier users. The relayfs changes which conflicted with the conversion have been shipped to me by Andrew. The remaining lot is targeted for 4.10 so that we finally can remove the rest of the notifiers" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) cpufreq: Fix up conversion to hotplug state machine blk/mq: Reserve hotplug states for block multiqueue x86/apic/uv: Convert to hotplug state machine s390/mm/pfault: Convert to hotplug state machine mips/loongson/smp: Convert to hotplug state machine mips/octeon/smp: Convert to hotplug state machine fault-injection/cpu: Convert to hotplug state machine padata: Convert to hotplug state machine cpufreq: Convert to hotplug state machine ACPI/processor: Convert to hotplug state machine virtio scsi: Convert to hotplug state machine oprofile/timer: Convert to hotplug state machine block/softirq: Convert to hotplug state machine lib/irq_poll: Convert to hotplug state machine x86/microcode: Convert to hotplug state machine sh/SH-X3 SMP: Convert to hotplug state machine ia64/mca: Convert to hotplug state machine ARM/OMAP/wakeupgen: Convert to hotplug state machine ARM/shmobile: Convert to hotplug state machine arm64/FP/SIMD: Convert to hotplug state machine ...
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3a64136bf21b..6e6c1fb60fbc 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1286,7 +1286,7 @@ out_free_policy:
1286 return ret; 1286 return ret;
1287} 1287}
1288 1288
1289static void cpufreq_offline(unsigned int cpu); 1289static int cpufreq_offline(unsigned int cpu);
1290 1290
1291/** 1291/**
1292 * cpufreq_add_dev - the cpufreq interface for a CPU device. 1292 * cpufreq_add_dev - the cpufreq interface for a CPU device.
@@ -1321,7 +1321,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
1321 return ret; 1321 return ret;
1322} 1322}
1323 1323
1324static void cpufreq_offline(unsigned int cpu) 1324static int cpufreq_offline(unsigned int cpu)
1325{ 1325{
1326 struct cpufreq_policy *policy; 1326 struct cpufreq_policy *policy;
1327 int ret; 1327 int ret;
@@ -1331,7 +1331,7 @@ static void cpufreq_offline(unsigned int cpu)
1331 policy = cpufreq_cpu_get_raw(cpu); 1331 policy = cpufreq_cpu_get_raw(cpu);
1332 if (!policy) { 1332 if (!policy) {
1333 pr_debug("%s: No cpu_data found\n", __func__); 1333 pr_debug("%s: No cpu_data found\n", __func__);
1334 return; 1334 return 0;
1335 } 1335 }
1336 1336
1337 down_write(&policy->rwsem); 1337 down_write(&policy->rwsem);
@@ -1380,6 +1380,7 @@ static void cpufreq_offline(unsigned int cpu)
1380 1380
1381unlock: 1381unlock:
1382 up_write(&policy->rwsem); 1382 up_write(&policy->rwsem);
1383 return 0;
1383} 1384}
1384 1385
1385/** 1386/**
@@ -2295,28 +2296,6 @@ unlock:
2295} 2296}
2296EXPORT_SYMBOL(cpufreq_update_policy); 2297EXPORT_SYMBOL(cpufreq_update_policy);
2297 2298
2298static int cpufreq_cpu_callback(struct notifier_block *nfb,
2299 unsigned long action, void *hcpu)
2300{
2301 unsigned int cpu = (unsigned long)hcpu;
2302
2303 switch (action & ~CPU_TASKS_FROZEN) {
2304 case CPU_ONLINE:
2305 case CPU_DOWN_FAILED:
2306 cpufreq_online(cpu);
2307 break;
2308
2309 case CPU_DOWN_PREPARE:
2310 cpufreq_offline(cpu);
2311 break;
2312 }
2313 return NOTIFY_OK;
2314}
2315
2316static struct notifier_block __refdata cpufreq_cpu_notifier = {
2317 .notifier_call = cpufreq_cpu_callback,
2318};
2319
2320/********************************************************************* 2299/*********************************************************************
2321 * BOOST * 2300 * BOOST *
2322 *********************************************************************/ 2301 *********************************************************************/
@@ -2418,6 +2397,7 @@ EXPORT_SYMBOL_GPL(cpufreq_boost_enabled);
2418/********************************************************************* 2397/*********************************************************************
2419 * REGISTER / UNREGISTER CPUFREQ DRIVER * 2398 * REGISTER / UNREGISTER CPUFREQ DRIVER *
2420 *********************************************************************/ 2399 *********************************************************************/
2400static enum cpuhp_state hp_online;
2421 2401
2422/** 2402/**
2423 * cpufreq_register_driver - register a CPU Frequency driver 2403 * cpufreq_register_driver - register a CPU Frequency driver
@@ -2480,7 +2460,14 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
2480 goto err_if_unreg; 2460 goto err_if_unreg;
2481 } 2461 }
2482 2462
2483 register_hotcpu_notifier(&cpufreq_cpu_notifier); 2463 ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online",
2464 cpufreq_online,
2465 cpufreq_offline);
2466 if (ret < 0)
2467 goto err_if_unreg;
2468 hp_online = ret;
2469 ret = 0;
2470
2484 pr_debug("driver %s up and running\n", driver_data->name); 2471 pr_debug("driver %s up and running\n", driver_data->name);
2485 goto out; 2472 goto out;
2486 2473
@@ -2519,7 +2506,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
2519 get_online_cpus(); 2506 get_online_cpus();
2520 subsys_interface_unregister(&cpufreq_interface); 2507 subsys_interface_unregister(&cpufreq_interface);
2521 remove_boost_sysfs_file(); 2508 remove_boost_sysfs_file();
2522 unregister_hotcpu_notifier(&cpufreq_cpu_notifier); 2509 cpuhp_remove_state_nocalls(hp_online);
2523 2510
2524 write_lock_irqsave(&cpufreq_driver_lock, flags); 2511 write_lock_irqsave(&cpufreq_driver_lock, flags);
2525 2512