mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-22 21:25:25 -04:00
x86/nmi: Use a macro to initialize NMI descriptors
The NMI descriptors for each NMI type are stored in an array. However, they are currently initialized using raw numbers, which makes it difficult to understand the code. Introduce a macro to initialize the NMI descriptors using the NMI type enum values to make the code more readable. No functional change intended. Signed-off-by: Sohil Mehta <sohil.mehta@intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Kai Huang <kai.huang@intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://lore.kernel.org/r/20250327234629.3953536-4-sohil.mehta@intel.com
This commit is contained in:
@@ -49,27 +49,20 @@ struct nmi_desc {
|
||||
struct list_head head;
|
||||
};
|
||||
|
||||
static struct nmi_desc nmi_desc[NMI_MAX] =
|
||||
{
|
||||
{
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[0].lock),
|
||||
.head = LIST_HEAD_INIT(nmi_desc[0].head),
|
||||
},
|
||||
{
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock),
|
||||
.head = LIST_HEAD_INIT(nmi_desc[1].head),
|
||||
},
|
||||
{
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[2].lock),
|
||||
.head = LIST_HEAD_INIT(nmi_desc[2].head),
|
||||
},
|
||||
{
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[3].lock),
|
||||
.head = LIST_HEAD_INIT(nmi_desc[3].head),
|
||||
},
|
||||
#define NMI_DESC_INIT(type) { \
|
||||
.lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[type].lock), \
|
||||
.head = LIST_HEAD_INIT(nmi_desc[type].head), \
|
||||
}
|
||||
|
||||
static struct nmi_desc nmi_desc[NMI_MAX] = {
|
||||
NMI_DESC_INIT(NMI_LOCAL),
|
||||
NMI_DESC_INIT(NMI_UNKNOWN),
|
||||
NMI_DESC_INIT(NMI_SERR),
|
||||
NMI_DESC_INIT(NMI_IO_CHECK),
|
||||
};
|
||||
|
||||
#define nmi_to_desc(type) (&nmi_desc[type])
|
||||
|
||||
struct nmi_stats {
|
||||
unsigned int normal;
|
||||
unsigned int unknown;
|
||||
@@ -107,8 +100,6 @@ static int __init setup_unknown_nmi_panic(char *str)
|
||||
}
|
||||
__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
|
||||
|
||||
#define nmi_to_desc(type) (&nmi_desc[type])
|
||||
|
||||
static u64 nmi_longest_ns = 1 * NSEC_PER_MSEC;
|
||||
|
||||
static int __init nmi_warning_debugfs(void)
|
||||
|
||||
Reference in New Issue
Block a user