Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1190706

[PATCH 3/3] cpufreq: use cpumask_test_and_clear_cpu() instead of separate routines

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 3/3] cpufreq: use cpumask_test_and_clear_cpu() instead of separate routines
Date 2015-07-23 10:20 +0200
Message-ID <pPjTr-11y-15@gated-at.bofh.it> (permalink)
References <pPhRE-6Cd-21@gated-at.bofh.it> <pPjTr-11y-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We need to clear cpumask only if the relevant cpu is set and we could
have used cpumask_test_and_clear_cpu() and set instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d01cad993fa7..b223c9c5296b 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1498,10 +1498,9 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
 	}
 
 	/* sysfs links are removed only on subsys callback */
-	if (cpumask_test_cpu(cpu, policy->linked_cpus)) {
+	if (cpumask_test_and_clear_cpu(cpu, policy->linked_cpus)) {
 		dev_dbg(dev, "%s: Removing symlink for CPU: %u\n", __func__,
 			cpu);
-		cpumask_clear_cpu(cpu, policy->linked_cpus);
 		sysfs_remove_link(&dev->kobj, "cpufreq");
 		return 0;
 	}
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH V2] cpufreq: Fix double addition of sysfs links "Rafael J. Wysocki" <rafael@kernel.org> - 2015-07-22 18:50 +0200
  Re: [PATCH V2] cpufreq: Fix double addition of sysfs links Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-23 08:10 +0200
    [PATCH 1/3] cpufreq: print error messages with dev_err() Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-23 10:20 +0200
      [PATCH 3/3] cpufreq: use cpumask_test_and_clear_cpu() instead of separate routines Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-23 10:20 +0200
      [PATCH 2/3] cpufreq: Create links for offline CPUs that got added earlier Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-23 10:20 +0200
    Re: [PATCH V2] cpufreq: Fix double addition of sysfs links "Rafael J. Wysocki" <rafael@kernel.org> - 2015-07-23 19:30 +0200

csiph-web