x86: cleanup remaining cpumask_t code in mce_amd_64.c
Impact: Reduce memory usage, use new cpumask API. Use cpumask_var_t for 'cpus' cpumask in struct threshold_bank and update remaining old cpumask_t functions to new cpumask API. Signed-off-by: Mike Travis <travis@sgi.com>
This commit is contained in:
parent
0e21990ae7
commit
a1c33bbeb7
|
@ -67,7 +67,7 @@ static struct threshold_block threshold_defaults = {
|
|||
struct threshold_bank {
|
||||
struct kobject *kobj;
|
||||
struct threshold_block *blocks;
|
||||
cpumask_t cpus;
|
||||
cpumask_var_t cpus;
|
||||
};
|
||||
static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]);
|
||||
|
||||
|
@ -481,7 +481,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|||
|
||||
#ifdef CONFIG_SMP
|
||||
if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
|
||||
i = first_cpu(per_cpu(cpu_core_map, cpu));
|
||||
i = cpumask_first(&per_cpu(cpu_core_map, cpu));
|
||||
|
||||
/* first core not up yet */
|
||||
if (cpu_data(i).cpu_core_id)
|
||||
|
@ -501,7 +501,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|||
if (err)
|
||||
goto out;
|
||||
|
||||
b->cpus = per_cpu(cpu_core_map, cpu);
|
||||
cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu));
|
||||
per_cpu(threshold_banks, cpu)[bank] = b;
|
||||
goto out;
|
||||
}
|
||||
|
@ -512,15 +512,20 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (!alloc_cpumask_var(&b->cpus, GFP_KERNEL)) {
|
||||
kfree(b);
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj);
|
||||
if (!b->kobj)
|
||||
goto out_free;
|
||||
|
||||
#ifndef CONFIG_SMP
|
||||
b->cpus = CPU_MASK_ALL;
|
||||
cpumask_setall(b->cpus);
|
||||
#else
|
||||
b->cpus = per_cpu(cpu_core_map, cpu);
|
||||
cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu));
|
||||
#endif
|
||||
|
||||
per_cpu(threshold_banks, cpu)[bank] = b;
|
||||
|
@ -529,7 +534,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|||
if (err)
|
||||
goto out_free;
|
||||
|
||||
for_each_cpu_mask_nr(i, b->cpus) {
|
||||
for_each_cpu(i, b->cpus) {
|
||||
if (i == cpu)
|
||||
continue;
|
||||
|
||||
|
@ -545,6 +550,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
|
|||
|
||||
out_free:
|
||||
per_cpu(threshold_banks, cpu)[bank] = NULL;
|
||||
free_cpumask_var(b->cpus);
|
||||
kfree(b);
|
||||
out:
|
||||
return err;
|
||||
|
@ -619,7 +625,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
|
|||
#endif
|
||||
|
||||
/* remove all sibling symlinks before unregistering */
|
||||
for_each_cpu_mask_nr(i, b->cpus) {
|
||||
for_each_cpu(i, b->cpus) {
|
||||
if (i == cpu)
|
||||
continue;
|
||||
|
||||
|
@ -632,6 +638,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
|
|||
free_out:
|
||||
kobject_del(b->kobj);
|
||||
kobject_put(b->kobj);
|
||||
free_cpumask_var(b->cpus);
|
||||
kfree(b);
|
||||
per_cpu(threshold_banks, cpu)[bank] = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue