aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-11-02 23:26:35 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2009-12-07 13:14:27 -0500
commitba578cb34a71fb08fff14ac0796b934a8c9991e1 (patch)
treeb381425ca353aed514220ea2e03a526e1b903bf1 /drivers
parente97f8bb8ce5611a855c5a0dba949706ec37d4155 (diff)
cpumask: use modern cpumask style in drivers/edac/amd64_edac.c
cpumask_t -> struct cpumask, and don't put one on the stack. (Note: this is actually on the stack unless CONFIG_CPUMASK_OFFSTACK=y). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/amd64_edac.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 3408b94b1181..67541e7d1cfe 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2631,7 +2631,7 @@ static int amd64_init_csrows(struct mem_ctl_info *mci)
2631static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci) 2631static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci)
2632{ 2632{
2633 struct amd64_pvt *pvt = mci->pvt_info; 2633 struct amd64_pvt *pvt = mci->pvt_info;
2634 const cpumask_t *cpumask = cpumask_of_node(pvt->mc_node_id); 2634 const struct cpumask *cpumask = cpumask_of_node(pvt->mc_node_id);
2635 int cpu, idx = 0, err = 0; 2635 int cpu, idx = 0, err = 0;
2636 struct msr msrs[cpumask_weight(cpumask)]; 2636 struct msr msrs[cpumask_weight(cpumask)];
2637 u32 value; 2637 u32 value;
@@ -2707,7 +2707,7 @@ static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci)
2707 2707
2708static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt) 2708static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
2709{ 2709{
2710 const cpumask_t *cpumask = cpumask_of_node(pvt->mc_node_id); 2710 const struct cpumask *cpumask = cpumask_of_node(pvt->mc_node_id);
2711 int cpu, idx = 0, err = 0; 2711 int cpu, idx = 0, err = 0;
2712 struct msr msrs[cpumask_weight(cpumask)]; 2712 struct msr msrs[cpumask_weight(cpumask)];
2713 u32 value; 2713 u32 value;
@@ -2740,7 +2740,7 @@ static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
2740} 2740}
2741 2741
2742/* get all cores on this DCT */ 2742/* get all cores on this DCT */
2743static void get_cpus_on_this_dct_cpumask(cpumask_t *mask, int nid) 2743static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, int nid)
2744{ 2744{
2745 int cpu; 2745 int cpu;
2746 2746
@@ -2752,25 +2752,30 @@ static void get_cpus_on_this_dct_cpumask(cpumask_t *mask, int nid)
2752/* check MCG_CTL on all the cpus on this node */ 2752/* check MCG_CTL on all the cpus on this node */
2753static bool amd64_nb_mce_bank_enabled_on_node(int nid) 2753static bool amd64_nb_mce_bank_enabled_on_node(int nid)
2754{ 2754{
2755 cpumask_t mask; 2755 cpumask_var_t mask;
2756 struct msr *msrs; 2756 struct msr *msrs;
2757 int cpu, nbe, idx = 0; 2757 int cpu, nbe, idx = 0;
2758 bool ret = false; 2758 bool ret = false;
2759 2759
2760 cpumask_clear(&mask); 2760 if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) {
2761 amd64_printk(KERN_WARNING, "%s: error allocating mask\n",
2762 __func__);
2763 return false;
2764 }
2761 2765
2762 get_cpus_on_this_dct_cpumask(&mask, nid); 2766 get_cpus_on_this_dct_cpumask(mask, nid);
2763 2767
2764 msrs = kzalloc(sizeof(struct msr) * cpumask_weight(&mask), GFP_KERNEL); 2768 msrs = kzalloc(sizeof(struct msr) * cpumask_weight(mask), GFP_KERNEL);
2765 if (!msrs) { 2769 if (!msrs) {
2766 amd64_printk(KERN_WARNING, "%s: error allocating msrs\n", 2770 amd64_printk(KERN_WARNING, "%s: error allocating msrs\n",
2767 __func__); 2771 __func__);
2772 free_cpumask_var(mask);
2768 return false; 2773 return false;
2769 } 2774 }
2770 2775
2771 rdmsr_on_cpus(&mask, MSR_IA32_MCG_CTL, msrs); 2776 rdmsr_on_cpus(mask, MSR_IA32_MCG_CTL, msrs);
2772 2777
2773 for_each_cpu(cpu, &mask) { 2778 for_each_cpu(cpu, mask) {
2774 nbe = msrs[idx].l & K8_MSR_MCGCTL_NBE; 2779 nbe = msrs[idx].l & K8_MSR_MCGCTL_NBE;
2775 2780
2776 debugf0("core: %u, MCG_CTL: 0x%llx, NB MSR is %s\n", 2781 debugf0("core: %u, MCG_CTL: 0x%llx, NB MSR is %s\n",
@@ -2786,6 +2791,7 @@ static bool amd64_nb_mce_bank_enabled_on_node(int nid)
2786 2791
2787out: 2792out:
2788 kfree(msrs); 2793 kfree(msrs);
2794 free_cpumask_var(mask);
2789 return ret; 2795 return ret;
2790} 2796}
2791 2797