Skip to content

Commit a217961

Browse files
qzhuo2aegl
authored andcommitted
EDAC/ie31200: Fold the two channel loops into one loop
Fold the two channel loops to simplify the code and improve readability. Also, delete the comments related to the DRB register, as this register is not used here. No functional changes intended. Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Tested-by: Gary Wang <gary.c.wang@intel.com> Link: https://lore.kernel.org/r/20250310011411.31685-9-qiuxu.zhuo@intel.com
1 parent afdbc36 commit a217961

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

drivers/edac/ie31200_edac.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int ie31200_probe1(struct pci_dev *pdev, struct res_config *cfg)
339339
struct edac_mc_layer layers[2];
340340
void __iomem *window;
341341
struct ie31200_priv *priv;
342-
u32 addr_decode[IE31200_CHANNELS];
342+
u32 addr_decode;
343343

344344
edac_dbg(0, "MC:\n");
345345

@@ -383,25 +383,17 @@ static int ie31200_probe1(struct pci_dev *pdev, struct res_config *cfg)
383383
priv->cfg = cfg;
384384

385385
for (i = 0; i < IE31200_CHANNELS; i++) {
386-
addr_decode[i] = readl(window + cfg->reg_mad_dimm_offset[i]);
387-
edac_dbg(0, "addr_decode: 0x%x\n", addr_decode[i]);
388-
}
386+
addr_decode = readl(window + cfg->reg_mad_dimm_offset[i]);
387+
edac_dbg(0, "addr_decode: 0x%x\n", addr_decode);
389388

390-
/*
391-
* The dram rank boundary (DRB) reg values are boundary addresses
392-
* for each DRAM rank with a granularity of 64MB. DRB regs are
393-
* cumulative; the last one will contain the total memory
394-
* contained in all ranks.
395-
*/
396-
for (i = 0; i < IE31200_DIMMS_PER_CHANNEL; i++) {
397-
for (j = 0; j < IE31200_CHANNELS; j++) {
389+
for (j = 0; j < IE31200_DIMMS_PER_CHANNEL; j++) {
398390
struct dimm_data dimm_info;
399391
struct dimm_info *dimm;
400392
unsigned long nr_pages;
401393

402-
populate_dimm_info(&dimm_info, addr_decode[j], i, cfg);
394+
populate_dimm_info(&dimm_info, addr_decode, j, cfg);
403395
edac_dbg(0, "channel: %d, dimm: %d, size: %lld MiB, ranks: %d, DRAM chip type: %d\n",
404-
j, i, dimm_info.size >> 20,
396+
i, j, dimm_info.size >> 20,
405397
dimm_info.ranks,
406398
dimm_info.dtype);
407399

@@ -411,7 +403,7 @@ static int ie31200_probe1(struct pci_dev *pdev, struct res_config *cfg)
411403

412404
nr_pages = nr_pages / dimm_info.ranks;
413405
for (k = 0; k < dimm_info.ranks; k++) {
414-
dimm = edac_get_dimm(mci, (i * dimm_info.ranks) + k, j, 0);
406+
dimm = edac_get_dimm(mci, (j * dimm_info.ranks) + k, i, 0);
415407
dimm->nr_pages = nr_pages;
416408
edac_dbg(0, "set nr pages: 0x%lx\n", nr_pages);
417409
dimm->grain = 8; /* just a guess */

0 commit comments

Comments
 (0)