[PATCH v2 0/3] ghes_edac: refactor memory error reporting to avoid code duplication

From: Shuai Xue
Date: Fri Dec 10 2021 - 08:40:27 EST


ghes_edac_report_mem_error() in ghes_edac.c is Long Method and have
Duplicated Code with cper_mem_err_location(), cper_dimm_err_location(), and
cper_mem_err_type_str() in drivers/firmware/efi/cper.c. In addition, the
cper_print_mem() in drivers/firmware/efi/cper.c only reports the error
status and misses its description.

This patch set is to refactor ghes_edac_report_mem_error with:

- Patch 01 is to unify memory error report format with cper;
- Patch 02 is to introduces cper_*(), into ghes_edac_report_mem_error(),
this can avoid bunch of duplicate code lines;
- Patch 02 is to wrap up error status decoding logics and reuse it in
cper_print_mem().

Changes since v1:
https://lore.kernel.org/all/20211207031905.61906-2-xueshuai@xxxxxxxxxxxxxxxxx/

- add a new patch to unify ghes and cper before removing duplication.
- document the changes in patch description
- add EXPORT_SYMBOL_GPL()s for cper_*()
- document and the dependency and add UEFI_CPER dependency explicitly
Thanks Robert Richter for review comments.

Shuai Xue (3):
ghes_edac: unify memory error report format with cper
ghes_edac: refactor memory error location processing
ghes_edac: refactor error status fields decoding

drivers/edac/Kconfig | 1 +
drivers/edac/ghes_edac.c | 196 +++++++-----------------------------
drivers/firmware/efi/cper.c | 86 ++++++++++++----
include/linux/cper.h | 3 +
4 files changed, 105 insertions(+), 181 deletions(-)

--
2.20.1.12.g72788fdb