linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, Dave Jones <davej@redhat.com>
Subject: [PATCH 2/8] cpumask: Replace CPUMASK_ALLOC etc with cpumask_var_t. From: Rusty Russell <rusty@rustcorp.com.au>
Date: Thu, 18 Dec 2008 16:00:31 -0800	[thread overview]
Message-ID: <20081219000029.895223000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: 20081219000029.540121000@polaris-admin.engr.sgi.com

[-- Attachment #1: cpumask:get-rid-of-CPUMASK_ALLOC-x86.patch --]
[-- Type: text/plain, Size: 1916 bytes --]

Impact: cleanup

There's only one user, and it's a fairly easy conversion.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Dave Jones <davej@redhat.com>
---
 arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c |   21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

--- linux-2.6-for-ingo.orig/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ linux-2.6-for-ingo/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -458,11 +458,6 @@ static int centrino_verify (struct cpufr
  *
  * Sets a new CPUFreq policy.
  */
-struct allmasks {
-	cpumask_t		saved_mask;
-	cpumask_t		covered_cpus;
-};
-
 static int centrino_target (struct cpufreq_policy *policy,
 			    unsigned int target_freq,
 			    unsigned int relation)
@@ -472,12 +467,15 @@ static int centrino_target (struct cpufr
 	struct cpufreq_freqs	freqs;
 	int			retval = 0;
 	unsigned int		j, k, first_cpu, tmp;
-	CPUMASK_ALLOC(allmasks);
-	CPUMASK_PTR(saved_mask, allmasks);
-	CPUMASK_PTR(covered_cpus, allmasks);
+	cpumask_var_t saved_mask, covered_cpus;
 
-	if (unlikely(allmasks == NULL))
+	if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL)))
 		return -ENOMEM;
+	if (unlikely(!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))) {
+		free_cpumask_var(saved_mask);
+		return -ENOMEM;
+	}
+	cpumask_copy(saved_mask, &current->cpus_allowed);
 
 	if (unlikely(per_cpu(centrino_model, cpu) == NULL)) {
 		retval = -ENODEV;
@@ -493,9 +491,7 @@ static int centrino_target (struct cpufr
 		goto out;
 	}
 
-	*saved_mask = current->cpus_allowed;
 	first_cpu = 1;
-	cpus_clear(*covered_cpus);
 	for_each_cpu_mask_nr(j, policy->cpus) {
 		const cpumask_t *mask;
 
@@ -605,7 +601,8 @@ migrate_end:
 	preempt_enable();
 	set_cpus_allowed_ptr(current, saved_mask);
 out:
-	CPUMASK_FREE(allmasks);
+	free_cpumask_var(saved_mask);
+	free_cpumask_var(covered_cpus);
 	return retval;
 }
 

-- 

  parent reply	other threads:[~2008-12-19  0:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19  0:00 [PATCH 0/8] x86 cpumask: update more code to use new cpumask API Mike Travis
2008-12-19  0:00 ` [PATCH 1/8] x86: clean up speedstep-centrino and reduce cpumask_t usage From: Rusty Russell <rusty@rustcorp.com.au> Mike Travis
2008-12-19  0:00 ` Mike Travis [this message]
2008-12-19  0:00 ` [PATCH 3/8] cpumask: convert shared_cpu_map in acpi_processor* structs to cpumask_var_t " Mike Travis
2008-12-19  0:00 ` [PATCH 4/8] cpumask: convert struct cpufreq_policy to cpumask_var_t. " Mike Travis
2008-12-19  0:00 ` [PATCH 5/8] cpumask: use work_on_cpu in some other places Mike Travis
2008-12-19  0:00 ` [PATCH 6/8] x86: use-cpumask_var_t-in-acpi_boot_c Mike Travis
2008-12-19  0:00 ` [PATCH 7/8] cpumask: use percpu allocations instead of array in arch/x86/kernel/nmi.c From: Rusty Russell <rusty@rustcorp.com.au> Mike Travis
2008-12-19  0:00 ` [PATCH 8/8] cpumask: use percpu allocations instead of array in arch/x86/kernel/cpu/mcheck/mce_64.c " Mike Travis
2008-12-20  1:00 [PATCH 0/8] x86 cpumask: update more code to use new cpumask API Mike Travis
2008-12-20  1:00 ` [PATCH 2/8] cpumask: Replace CPUMASK_ALLOC etc with cpumask_var_t. From: Rusty Russell <rusty@rustcorp.com.au> Mike Travis

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=20081219000029.895223000@polaris-admin.engr.sgi.com \
    --to=travis@sgi.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rusty@rustcorp.com.au \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).