]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
EDAC: Fix csrow size reported in sysfs
authorBorislav Petkov <borislav.petkov@amd.com>
Thu, 13 Sep 2012 16:53:58 +0000 (18:53 +0200)
committerBorislav Petkov <borislav.petkov@amd.com>
Tue, 16 Oct 2012 14:15:48 +0000 (16:15 +0200)
On csrow-based memory controllers, we combine the csrow size from both
channels and there's no need to do that again in csrow_size_show which
leads to double the size of a csrow.

Fix it.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
drivers/edac/amd64_edac.c
drivers/edac/edac_mc_sysfs.c
include/linux/edac.h

index f9ec497f6560266f8d50837ed30433eca687d014..501bfb938f26e25baa7047e4e4105ca9ec5ed7c3 100644 (file)
@@ -2177,6 +2177,7 @@ static int init_csrows(struct mem_ctl_info *mci)
                        dimm->edac_mode = edac_mode;
                        dimm->nr_pages = nr_pages;
                }
+               csrow->nr_pages = nr_pages;
        }
 
        return empty;
index cf13bff94f5c795fa20fc2d874767490ffcf8c09..bd46610979c756e8d674c1ba110f2f69c9c9593e 100644 (file)
@@ -180,6 +180,9 @@ static ssize_t csrow_size_show(struct device *dev,
        int i;
        u32 nr_pages = 0;
 
+       if (csrow->mci->csbased)
+               return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages));
+
        for (i = 0; i < csrow->nr_channels; i++)
                nr_pages += csrow->channels[i]->dimm->nr_pages;
        return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages));
index 07bda01bf20a52fe5db06f07ac3bb53c89a6a746..1b8c02b36f76f5ed7023fda4c4f6c7e9392a4f6b 100644 (file)
@@ -533,6 +533,7 @@ struct csrow_info {
 
        u32 ue_count;           /* Uncorrectable Errors for this csrow */
        u32 ce_count;           /* Correctable Errors for this csrow */
+       u32 nr_pages;           /* combined pages count of all channels */
 
        struct mem_ctl_info *mci;       /* the parent */