Re: [RESEND v5 1/4] ACPI: APEI: EINJ: Refactor available_error_type_show()

From: Avadhut Naik
Date: Thu Nov 16 2023 - 16:46:53 EST


Hi,

On 11/8/2023 14:19, Borislav Petkov wrote:
> On Tue, Nov 07, 2023 at 03:36:44PM -0600, Avadhut Naik wrote:
>> +static struct { u32 mask; const char *str; } const einj_error_type_string[] = {
>> + {BIT(0), "Processor Correctable"},
>> + {BIT(1), "Processor Uncorrectable non-fatal"},
>> + {BIT(2), "Processor Uncorrectable fatal"},
>> + {BIT(3), "Memory Correctable"},
>> + {BIT(4), "Memory Uncorrectable non-fatal"},
>> + {BIT(5), "Memory Uncorrectable fatal"},
>> + {BIT(6), "PCI Express Correctable"},
>> + {BIT(7), "PCI Express Uncorrectable non-fatal"},
>> + {BIT(8), "PCI Express Uncorrectable fatal"},
>> + {BIT(9), "Platform Correctable"},
>> + {BIT(10), "Platform Uncorrectable non-fatal"},
>> + {BIT(11), "Platform Uncorrectable fatal"},
>> + {BIT(12), "CXL.cache Protocol Correctable"},
>> + {BIT(13), "CXL.cache Protocol Uncorrectable non-fatal"},
>> + {BIT(14), "CXL.cache Protocol Uncorrectable fatal"},
>> + {BIT(15), "CXL.mem Protocol Correctable"},
>> + {BIT(16), "CXL.mem Protocol Uncorrectable non-fatal"},
>> + {BIT(17), "CXL.mem Protocol Uncorrectable fatal"},
>
> Might as well put spaces between the '{' and '}' brackets for better
> readability.
>
>> static int available_error_type_show(struct seq_file *m, void *v)
>> @@ -607,8 +607,9 @@ static int available_error_type_show(struct seq_file *m, void *v)
>> if (rc)
>> return rc;
>> for (int pos = 0; pos < ARRAY_SIZE(einj_error_type_string); pos++)
>> - if (available_error_type & BIT(pos))
>> - seq_puts(m, einj_error_type_string[pos]);
>> + if (available_error_type & einj_error_type_string[pos].mask)
>
> Call that variable simply "error_type". Those are simple functions, one
> can see that it is the available error type.
>
>> + seq_printf(m, "0x%08x\t%s\n", einj_error_type_string[pos].mask,
>> + einj_error_type_string[pos].str);
>>
>> return 0;
>
> But those are just nitpicks.
>
> Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
>
Thanks for reviewing. Will address this in v6.
> Thx.
>

--
Thanks,
Avadhut Naik