From: Borislav Petkov <bp@alien8.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>, X86 ML <x86@kernel.org>
Subject: [PATCH 1/3] x86/RAS: Simplify SMCA bank descriptor struct
Date: Thu, 3 Nov 2016 13:55:54 +0100 [thread overview]
Message-ID: <20161103125556.15482-1-bp@alien8.de> (raw)
From: Borislav Petkov <bp@suse.de>
Call the struct simply smca_bank, it's instance ID can be simply ->id.
Makes the code much more readable.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/include/asm/mce.h | 7 ++++---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 10 +++++-----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 9bd7ff5ffbcc..4d97875d9543 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -371,12 +371,13 @@ struct smca_hwid_mcatype {
u32 xec_bitmap; /* Bitmap of valid ExtErrorCodes; current max is 21. */
};
-struct smca_bank_info {
+struct smca_bank {
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
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 9b5403462936..ac2f4f2cad18 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -116,7 +116,7 @@ static struct smca_hwid_mcatype smca_hwid_mcatypes[] = {
{ 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);
/*
@@ -150,14 +150,14 @@ static void get_smca_bank_info(unsigned int bank)
{
unsigned int i, hwid_mcatype, cpu = smp_processor_id();
struct smca_hwid_mcatype *type;
- u32 high, instanceId;
+ u32 high, instance_id;
u16 hwid, mcatype;
/* Collect bank_info using CPU 0 for now. */
if (cpu)
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);
return;
}
@@ -170,7 +170,7 @@ static void get_smca_bank_info(unsigned int bank)
type = &smca_hwid_mcatypes[i];
if (hwid_mcatype == type->hwid_mcatype) {
smca_banks[bank].type = type;
- smca_banks[bank].type_instance = instanceId;
+ smca_banks[bank].id = instance_id;
break;
}
}
@@ -839,7 +839,7 @@ static const char *get_name(unsigned int bank, struct threshold_block *b)
snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN,
"%s_%x", smca_bank_names[bank_type].name,
- smca_banks[bank].type_instance);
+ smca_banks[bank].id);
return buf_mcatype;
}
--
2.10.0
next reply other threads:[~2016-11-03 12:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 12:55 Borislav Petkov [this message]
2016-11-03 12:55 ` [PATCH 2/3] x86/RAS: Simplify SMCA HWID descriptor struct Borislav Petkov
2016-11-08 16:20 ` [tip:ras/core] " tip-bot for Borislav Petkov
2016-11-10 17:50 ` Yazen Ghannam
2016-11-10 17:57 ` Borislav Petkov
2016-11-10 19:53 ` Thomas Gleixner
2016-11-10 20:12 ` Yazen Ghannam
2016-11-03 12:55 ` [PATCH 3/3] x86/RAS: Rename smca_bank_names to smca_names Borislav Petkov
2016-11-08 16:21 ` [tip:ras/core] " tip-bot for Borislav Petkov
2016-11-04 14:44 ` [PATCH 1/3] x86/RAS: Simplify SMCA bank descriptor struct Yazen Ghannam
2016-11-04 15:23 ` Borislav Petkov
2016-11-08 16:21 ` [tip:ras/core] x86/RAS: Hide SMCA bank names tip-bot for Borislav Petkov
2016-11-08 16:20 ` [tip:ras/core] x86/RAS: Simplify SMCA bank descriptor struct tip-bot for Borislav Petkov
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=20161103125556.15482-1-bp@alien8.de \
--to=bp@alien8.de \
--cc=Yazen.Ghannam@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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).