Commit 79349f52 authored by Borislav Petkov's avatar Borislav Petkov Committed by Thomas Gleixner

x86/RAS: Simplify SMCA bank descriptor struct

Call the struct simply smca_bank, it's instance ID can be simply ->id.
Makes the code much more readable.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Tested-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Link: http://lkml.kernel.org/r/20161103125556.15482-1-bp@alien8.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent cd9c57ca
...@@ -371,12 +371,13 @@ struct smca_hwid_mcatype { ...@@ -371,12 +371,13 @@ struct smca_hwid_mcatype {
u32 xec_bitmap; /* Bitmap of valid ExtErrorCodes; current max is 21. */ u32 xec_bitmap; /* Bitmap of valid ExtErrorCodes; current max is 21. */
}; };
struct smca_bank_info { struct smca_bank {
struct smca_hwid_mcatype *type; struct smca_hwid_mcatype *type;
u32 type_instance; /* Instance ID */
u32 id;
}; };
extern struct smca_bank_info smca_banks[MAX_NR_BANKS]; extern struct smca_bank smca_banks[MAX_NR_BANKS];
#endif #endif
......
...@@ -116,7 +116,7 @@ static struct smca_hwid_mcatype smca_hwid_mcatypes[] = { ...@@ -116,7 +116,7 @@ static struct smca_hwid_mcatype smca_hwid_mcatypes[] = {
{ SMCA_SMU, HWID_MCATYPE(0x01, 0x0), 0x1 }, { SMCA_SMU, HWID_MCATYPE(0x01, 0x0), 0x1 },
}; };
struct smca_bank_info smca_banks[MAX_NR_BANKS]; struct smca_bank smca_banks[MAX_NR_BANKS];
EXPORT_SYMBOL_GPL(smca_banks); EXPORT_SYMBOL_GPL(smca_banks);
/* /*
...@@ -150,14 +150,14 @@ static void get_smca_bank_info(unsigned int bank) ...@@ -150,14 +150,14 @@ static void get_smca_bank_info(unsigned int bank)
{ {
unsigned int i, hwid_mcatype, cpu = smp_processor_id(); unsigned int i, hwid_mcatype, cpu = smp_processor_id();
struct smca_hwid_mcatype *type; struct smca_hwid_mcatype *type;
u32 high, instanceId; u32 high, instance_id;
u16 hwid, mcatype; u16 hwid, mcatype;
/* Collect bank_info using CPU 0 for now. */ /* Collect bank_info using CPU 0 for now. */
if (cpu) if (cpu)
return; return;
if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_IPID(bank), &instanceId, &high)) { if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_IPID(bank), &instance_id, &high)) {
pr_warn("Failed to read MCA_IPID for bank %d\n", bank); pr_warn("Failed to read MCA_IPID for bank %d\n", bank);
return; return;
} }
...@@ -170,7 +170,7 @@ static void get_smca_bank_info(unsigned int bank) ...@@ -170,7 +170,7 @@ static void get_smca_bank_info(unsigned int bank)
type = &smca_hwid_mcatypes[i]; type = &smca_hwid_mcatypes[i];
if (hwid_mcatype == type->hwid_mcatype) { if (hwid_mcatype == type->hwid_mcatype) {
smca_banks[bank].type = type; smca_banks[bank].type = type;
smca_banks[bank].type_instance = instanceId; smca_banks[bank].id = instance_id;
break; break;
} }
} }
...@@ -839,7 +839,7 @@ static const char *get_name(unsigned int bank, struct threshold_block *b) ...@@ -839,7 +839,7 @@ static const char *get_name(unsigned int bank, struct threshold_block *b)
snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN, snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN,
"%s_%x", smca_bank_names[bank_type].name, "%s_%x", smca_bank_names[bank_type].name,
smca_banks[bank].type_instance); smca_banks[bank].id);
return buf_mcatype; return buf_mcatype;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment