Skip to content

Commit

Permalink
cpumask: convert misc driver functions
Browse files Browse the repository at this point in the history
Impact: use new cpumask API.

Convert misc driver functions to use struct cpumask.

To Do:
  - Convert iucv_buffer_cpumask to cpumask_var_t.

Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Mike Travis <[email protected]>
Acked-by: Dean Nelson <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: [email protected]
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: Chris Wright <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Ursula Braun <[email protected]>
Cc: [email protected]
Cc: [email protected]
  • Loading branch information
rustyrussell authored and Ingo Molnar committed Jan 11, 2009
1 parent fbd59a8 commit f7df8ed
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/base/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
/*
* Print cpu online, possible, present, and system maps
*/
static ssize_t print_cpus_map(char *buf, cpumask_t *map)
static ssize_t print_cpus_map(char *buf, const struct cpumask *map)
{
int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map);

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/sgi-xp/xpc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ xpc_hb_checker(void *ignore)

/* this thread was marked active by xpc_hb_init() */

set_cpus_allowed_ptr(current, &cpumask_of_cpu(XPC_HB_CHECK_CPU));
set_cpus_allowed_ptr(current, cpumask_of(XPC_HB_CHECK_CPU));

/* set our heartbeating to other partitions into motion */
xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ);
Expand Down
22 changes: 18 additions & 4 deletions drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

static LIST_HEAD(dying_tasks);
static LIST_HEAD(dead_tasks);
static cpumask_t marked_cpus = CPU_MASK_NONE;
static cpumask_var_t marked_cpus;
static DEFINE_SPINLOCK(task_mortuary);
static void process_task_mortuary(void);

Expand Down Expand Up @@ -456,10 +456,10 @@ static void mark_done(int cpu)
{
int i;

cpu_set(cpu, marked_cpus);
cpumask_set_cpu(cpu, marked_cpus);

for_each_online_cpu(i) {
if (!cpu_isset(i, marked_cpus))
if (!cpumask_test_cpu(i, marked_cpus))
return;
}

Expand All @@ -468,7 +468,7 @@ static void mark_done(int cpu)
*/
process_task_mortuary();

cpus_clear(marked_cpus);
cpumask_clear(marked_cpus);
}


Expand Down Expand Up @@ -565,6 +565,20 @@ void sync_buffer(int cpu)
mutex_unlock(&buffer_mutex);
}

int __init buffer_sync_init(void)
{
if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;

cpumask_clear(marked_cpus);
return 0;
}

void __exit buffer_sync_cleanup(void)
{
free_cpumask_var(marked_cpus);
}

/* The function can be used to add a buffer worth of data directly to
* the kernel buffer. The buffer is assumed to be a circular buffer.
* Take the entries from index start and end at index end, wrapping
Expand Down
4 changes: 4 additions & 0 deletions drivers/oprofile/buffer_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ void sync_stop(void);
/* sync the given CPU's buffer */
void sync_buffer(int cpu);

/* initialize/destroy the buffer system. */
int buffer_sync_init(void);
void buffer_sync_cleanup(void);

#endif /* OPROFILE_BUFFER_SYNC_H */
9 changes: 8 additions & 1 deletion drivers/oprofile/oprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ static int __init oprofile_init(void)
{
int err;

err = buffer_sync_init();
if (err)
return err;

err = oprofile_arch_init(&oprofile_ops);

if (err < 0 || timer) {
Expand All @@ -191,8 +195,10 @@ static int __init oprofile_init(void)
}

err = oprofilefs_register();
if (err)
if (err) {
oprofile_arch_exit();
buffer_sync_cleanup();
}

return err;
}
Expand All @@ -202,6 +208,7 @@ static void __exit oprofile_exit(void)
{
oprofilefs_unregister();
oprofile_arch_exit();
buffer_sync_cleanup();
}


Expand Down
2 changes: 1 addition & 1 deletion drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void do_suspend(void)
/* XXX use normal device tree? */
xenbus_suspend();

err = stop_machine(xen_suspend, &cancelled, &cpumask_of_cpu(0));
err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
if (err) {
printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
goto out;
Expand Down

0 comments on commit f7df8ed

Please sign in to comment.