>From 2ae58bdca43cd52e0d24685b21baa5692cbd4ef9 Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Fri, 21 Sep 2012 07:45:49 -0700 Subject: [PATCH] EDAC: Fix mc size reported in sysfs This is the complement to commit: EDAC: Fix csrow size reported in sysfs. This fixes the memory controller size reporting on csrow-based memory controllers. The csrow size is already combined for both channels. Without this patch memory size is reported doubled. Signed-off-by: Josh Hunt --- drivers/edac/edac_mc_sysfs.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index bd46610..a242dae 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -781,10 +781,14 @@ static ssize_t mci_size_mb_show(struct device *dev, for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { struct csrow_info *csrow = mci->csrows[csrow_idx]; - for (j = 0; j < csrow->nr_channels; j++) { - struct dimm_info *dimm = csrow->channels[j]->dimm; - - total_pages += dimm->nr_pages; + if (csrow->mci->csbased) { + total_pages += csrow->nr_pages; + } else { + for (j = 0; j < csrow->nr_channels; j++) { + struct dimm_info *dimm = csrow->channels[j]->dimm; + + total_pages += dimm->nr_pages; + } } } -- 1.7.0.4