[PATCH v3 27/31] edac: Initialize the dimm label with the known information

From: Mauro Carvalho Chehab
Date: Thu Feb 09 2012 - 19:03:05 EST


Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
---
drivers/edac/edac_mc.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 5326b6b..91545a5 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -210,10 +210,10 @@ struct mem_ctl_info *edac_mc_alloc(unsigned edac_index,
struct errcount_attribute_data *ercd;
struct dimm_info *dimm;
u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
- void *pvt;
+ void *pvt, *p;
unsigned size, tot_dimms, count, per_layer_count[EDAC_MAX_LAYERS];
unsigned tot_csrows, tot_cschannels, tot_errcount = 0;
- int i, j;
+ int i, j, n, len;
int err;
int row, chn;

@@ -327,9 +327,22 @@ struct mem_ctl_info *edac_mc_alloc(unsigned edac_index,
dimm = &mci->dimms[i];
dimm->mci = mci;

- /* Copy DIMM location */
- for (j = 0; j < n_layers; j++)
+ /*
+ * Copy DIMM location and initialize the memory location
+ */
+ len = sizeof(dimm->label);
+ p = dimm->label;
+ n = snprintf(p, len,"mc#%u", edac_index);
+ p += n;
+ len -= n;
+ for (j = 0; j < n_layers; j++) {
+ n = snprintf(p, len,"%s#%u",
+ edac_layer_name[layers[j].type],
+ per_layer_count[j]);
+ p += n;
+ len -= n;
dimm->location[j] = per_layer_count[j];
+ }

/* Link it to the csrows old API data */
chan->dimm = dimm;
--
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/