Commit 91b327f6 authored by Robert Richter's avatar Robert Richter Committed by Borislav Petkov

EDAC/mc: Determine mci pointer from the error descriptor

Each struct mci has its own error descriptor. Create a function
error_desc_to_mci() to determine the corresponding mci from an
error descriptor. This removes @mci from the parameter list of
edac_raw_mc_handle_error() as the mci pointer does not need to be passed
any longer.

 [ bp: Massage commit message. ]
Signed-off-by: default avatarRobert Richter <rrichter@marvell.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: default avatarAristeu Rozanski <aris@redhat.com>
Link: https://lkml.kernel.org/r/20200123090210.26933-5-rrichter@marvell.com
parent 672ef0e5
...@@ -55,6 +55,11 @@ static LIST_HEAD(mc_devices); ...@@ -55,6 +55,11 @@ static LIST_HEAD(mc_devices);
*/ */
static const char *edac_mc_owner; static const char *edac_mc_owner;
static struct mem_ctl_info *error_desc_to_mci(struct edac_raw_error_desc *e)
{
return container_of(e, struct mem_ctl_info, error_desc);
}
int edac_get_report_status(void) int edac_get_report_status(void)
{ {
return edac_report; return edac_report;
...@@ -1084,9 +1089,9 @@ static void edac_ue_error(struct mem_ctl_info *mci, ...@@ -1084,9 +1089,9 @@ static void edac_ue_error(struct mem_ctl_info *mci,
edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count);
} }
void edac_raw_mc_handle_error(struct mem_ctl_info *mci, void edac_raw_mc_handle_error(struct edac_raw_error_desc *e)
struct edac_raw_error_desc *e)
{ {
struct mem_ctl_info *mci = error_desc_to_mci(e);
char detail[80]; char detail[80];
int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer };
u8 grain_bits; u8 grain_bits;
...@@ -1282,6 +1287,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, ...@@ -1282,6 +1287,6 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
if (p > e->location) if (p > e->location)
*(p - 1) = '\0'; *(p - 1) = '\0';
edac_raw_mc_handle_error(mci, e); edac_raw_mc_handle_error(e);
} }
EXPORT_SYMBOL_GPL(edac_mc_handle_error); EXPORT_SYMBOL_GPL(edac_mc_handle_error);
...@@ -212,15 +212,13 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, ...@@ -212,15 +212,13 @@ extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
* edac_raw_mc_handle_error() - Reports a memory event to userspace without * edac_raw_mc_handle_error() - Reports a memory event to userspace without
* doing anything to discover the error location. * doing anything to discover the error location.
* *
* @mci: a struct mem_ctl_info pointer
* @e: error description * @e: error description
* *
* This raw function is used internally by edac_mc_handle_error(). It should * This raw function is used internally by edac_mc_handle_error(). It should
* only be called directly when the hardware error come directly from BIOS, * only be called directly when the hardware error come directly from BIOS,
* like in the case of APEI GHES driver. * like in the case of APEI GHES driver.
*/ */
void edac_raw_mc_handle_error(struct mem_ctl_info *mci, void edac_raw_mc_handle_error(struct edac_raw_error_desc *e);
struct edac_raw_error_desc *e);
/** /**
* edac_mc_handle_error() - Reports a memory event to userspace. * edac_mc_handle_error() - Reports a memory event to userspace.
......
...@@ -441,7 +441,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) ...@@ -441,7 +441,7 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
if (p > pvt->other_detail) if (p > pvt->other_detail)
*(p - 1) = '\0'; *(p - 1) = '\0';
edac_raw_mc_handle_error(mci, e); edac_raw_mc_handle_error(e);
unlock: unlock:
spin_unlock_irqrestore(&ghes_lock, flags); spin_unlock_irqrestore(&ghes_lock, flags);
......
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