From: Viresh Kumar <viresh.kumar@linaro.org> To: edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, linux-pm@vger.kernel.org, radivoje.jovanovic@linux.intel.com, punit.agrawal@arm.com, Viresh Kumar <viresh.kumar@linaro.org>, linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/6] thermal/cpu_cooling: convert 'switch' block to 'if' block in notifier Date: Thu, 30 Jul 2015 12:40:32 +0530 [thread overview] Message-ID: <46d2492a9e665e05ec03124ffcebbe663846ff37.1438239727.git.viresh.kumar@linaro.org> (raw) In-Reply-To: <cover.1438239727.git.viresh.kumar@linaro.org> In-Reply-To: <cover.1438239727.git.viresh.kumar@linaro.org> We just need to take care of single event here and there is no need to increase indentation level of most of the code (which causes lines longer that 80 columns to break). Kill the switch block. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/thermal/cpu_cooling.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 276cec5a1fb7..bf2673bb3cf5 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -218,27 +218,21 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, unsigned long max_freq; struct cpufreq_cooling_device *cpufreq_dev; - switch (event) { + if (event != CPUFREQ_ADJUST) + return NOTIFY_DONE; - case CPUFREQ_ADJUST: - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { - if (!cpumask_test_cpu(policy->cpu, - &cpufreq_dev->allowed_cpus)) - continue; + mutex_lock(&cooling_cpufreq_lock); + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { + if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) + continue; - max_freq = cpufreq_dev->cpufreq_val; + max_freq = cpufreq_dev->cpufreq_val; - if (policy->max != max_freq) - cpufreq_verify_within_limits(policy, 0, - max_freq); - break; - } - mutex_unlock(&cooling_cpufreq_lock); + if (policy->max != max_freq) + cpufreq_verify_within_limits(policy, 0, max_freq); break; - default: - return NOTIFY_DONE; } + mutex_unlock(&cooling_cpufreq_lock); return NOTIFY_OK; } -- 2.4.0
WARNING: multiple messages have this Message-ID (diff)
From: Viresh Kumar <viresh.kumar@linaro.org> To: edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, linux-pm@vger.kernel.org, radivoje.jovanovic@linux.intel.com, punit.agrawal@arm.com, Viresh Kumar <viresh.kumar@linaro.org>, open list <linux-kernel@vger.kernel.org> Subject: [PATCH 3/6] thermal/cpu_cooling: convert 'switch' block to 'if' block in notifier Date: Thu, 30 Jul 2015 12:40:32 +0530 [thread overview] Message-ID: <46d2492a9e665e05ec03124ffcebbe663846ff37.1438239727.git.viresh.kumar@linaro.org> (raw) In-Reply-To: <cover.1438239727.git.viresh.kumar@linaro.org> In-Reply-To: <cover.1438239727.git.viresh.kumar@linaro.org> We just need to take care of single event here and there is no need to increase indentation level of most of the code (which causes lines longer that 80 columns to break). Kill the switch block. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/thermal/cpu_cooling.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 276cec5a1fb7..bf2673bb3cf5 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -218,27 +218,21 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, unsigned long max_freq; struct cpufreq_cooling_device *cpufreq_dev; - switch (event) { + if (event != CPUFREQ_ADJUST) + return NOTIFY_DONE; - case CPUFREQ_ADJUST: - mutex_lock(&cooling_cpufreq_lock); - list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { - if (!cpumask_test_cpu(policy->cpu, - &cpufreq_dev->allowed_cpus)) - continue; + mutex_lock(&cooling_cpufreq_lock); + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { + if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) + continue; - max_freq = cpufreq_dev->cpufreq_val; + max_freq = cpufreq_dev->cpufreq_val; - if (policy->max != max_freq) - cpufreq_verify_within_limits(policy, 0, - max_freq); - break; - } - mutex_unlock(&cooling_cpufreq_lock); + if (policy->max != max_freq) + cpufreq_verify_within_limits(policy, 0, max_freq); break; - default: - return NOTIFY_DONE; } + mutex_unlock(&cooling_cpufreq_lock); return NOTIFY_OK; } -- 2.4.0
next prev parent reply other threads:[~2015-07-30 7:11 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-07-30 7:10 [PATCH 0/6] thermal/cpu_cooling: Minor cleanups Viresh Kumar 2015-07-30 7:10 ` [PATCH 1/6] thermal/cpu_cooling: No need to initialize max_freq to 0 Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar 2015-07-30 7:10 ` [PATCH 2/6] thermal/cpu_cooling: quit early after updating policy Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar [this message] 2015-07-30 7:10 ` [PATCH 3/6] thermal/cpu_cooling: convert 'switch' block to 'if' block in notifier Viresh Kumar 2015-07-30 7:10 ` [PATCH 4/6] thermal/cpu_cooling: rename cpufreq_val as clipped_freq Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar 2015-07-30 7:10 ` [PATCH 5/6] thermal/cpu_cooling: rename max_freq as clipped_freq in notifier Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar 2015-07-30 7:10 ` [PATCH 6/6] thermal/cpu_cooling: update policy limits if clipped_freq < policy->max Viresh Kumar 2015-07-30 7:10 ` Viresh Kumar 2015-08-04 8:56 ` [PATCH 0/6] thermal/cpu_cooling: Minor cleanups Viresh Kumar 2015-08-12 10:17 ` Viresh Kumar 2015-08-14 4:59 ` Eduardo Valentin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=46d2492a9e665e05ec03124ffcebbe663846ff37.1438239727.git.viresh.kumar@linaro.org \ --to=viresh.kumar@linaro.org \ --cc=edubezval@gmail.com \ --cc=linaro-kernel@lists.linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=punit.agrawal@arm.com \ --cc=radivoje.jovanovic@linux.intel.com \ --cc=rui.zhang@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.