diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-06 21:31:57 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-08 19:37:07 -0400 |
commit | a794d6138cda391b6a9ba28c4cf27651415669c6 (patch) | |
tree | 0a5de8326c028cd388083d083a772d2e4e0662f7 /drivers/cpufreq/cpufreq.c | |
parent | cd73e9b01f635d25dbd17ed090f9351becf00280 (diff) |
cpufreq: Rearrange cpufreq_add_dev()
Reorganize the code in cpufreq_add_dev() to avoid using the ret
variable and reduce the indentation level in it.
No functional changes.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 859281592680..2f1ae568f74b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1320,26 +1320,24 @@ out_free_policy: | |||
1320 | */ | 1320 | */ |
1321 | static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) | 1321 | static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) |
1322 | { | 1322 | { |
1323 | struct cpufreq_policy *policy; | ||
1323 | unsigned cpu = dev->id; | 1324 | unsigned cpu = dev->id; |
1324 | int ret; | ||
1325 | 1325 | ||
1326 | dev_dbg(dev, "%s: adding CPU%u\n", __func__, cpu); | 1326 | dev_dbg(dev, "%s: adding CPU%u\n", __func__, cpu); |
1327 | 1327 | ||
1328 | if (cpu_online(cpu)) { | 1328 | if (cpu_online(cpu)) |
1329 | ret = cpufreq_online(cpu); | 1329 | return cpufreq_online(cpu); |
1330 | } else { | ||
1331 | /* | ||
1332 | * A hotplug notifier will follow and we will handle it as CPU | ||
1333 | * online then. For now, just create the sysfs link, unless | ||
1334 | * there is no policy or the link is already present. | ||
1335 | */ | ||
1336 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | ||
1337 | 1330 | ||
1338 | ret = policy && !cpumask_test_and_set_cpu(cpu, policy->real_cpus) | 1331 | /* |
1339 | ? add_cpu_dev_symlink(policy, cpu) : 0; | 1332 | * A hotplug notifier will follow and we will handle it as CPU online |
1340 | } | 1333 | * then. For now, just create the sysfs link, unless there is no policy |
1334 | * or the link is already present. | ||
1335 | */ | ||
1336 | policy = per_cpu(cpufreq_cpu_data, cpu); | ||
1337 | if (!policy || cpumask_test_and_set_cpu(cpu, policy->real_cpus)) | ||
1338 | return 0; | ||
1341 | 1339 | ||
1342 | return ret; | 1340 | return add_cpu_dev_symlink(policy, cpu); |
1343 | } | 1341 | } |
1344 | 1342 | ||
1345 | static void cpufreq_offline(unsigned int cpu) | 1343 | static void cpufreq_offline(unsigned int cpu) |