Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319371
b: refs/heads/master
c: e39f4ea
h: refs/heads/master
i:
  319369: 7c68644
  319367: e9734dd
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Jun 11, 2012
1 parent ab7a2fa commit b857e62
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fd63312dfe70b8279618b4d77dc951b6e309ffa2
refs/heads/master: e39f4ea9b01f137f9e6fa631f3e9088fb9175e91
24 changes: 24 additions & 0 deletions trunk/drivers/edac/edac_mc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ static struct device_attribute *dynamic_csrow_ce_count_attr[] = {
&dev_attr_legacy_ch5_ce_count.attr
};

static inline int nr_pages_per_csrow(struct csrow_info *csrow)
{
int chan, nr_pages = 0;

for (chan = 0; chan < csrow->nr_channels; chan++)
nr_pages += csrow->channels[chan].dimm->nr_pages;

return nr_pages;
}

/* Create a CSROW object under specifed edac_mc_device */
static int edac_create_csrow_object(struct mem_ctl_info *mci,
struct csrow_info *csrow, int index)
Expand All @@ -371,6 +381,9 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
return err;

for (chan = 0; chan < csrow->nr_channels; chan++) {
/* Only expose populated DIMMs */
if (!csrow->channels[chan].dimm->nr_pages)
continue;
err = device_create_file(&csrow->dev,
dynamic_csrow_dimm_attr[chan]);
if (err < 0)
Expand Down Expand Up @@ -405,6 +418,9 @@ static int edac_create_csrow_objects(struct mem_ctl_info *mci)
struct csrow_info *csrow;

for (i = 0; i < mci->nr_csrows; i++) {
csrow = &mci->csrows[i];
if (!nr_pages_per_csrow(csrow))
continue;
err = edac_create_csrow_object(mci, &mci->csrows[i], i);
if (err < 0)
goto error;
Expand All @@ -414,7 +430,11 @@ static int edac_create_csrow_objects(struct mem_ctl_info *mci)
error:
for (--i; i >= 0; i--) {
csrow = &mci->csrows[i];
if (!nr_pages_per_csrow(csrow))
continue;
for (chan = csrow->nr_channels - 1; chan >= 0; chan--) {
if (!csrow->channels[chan].dimm->nr_pages)
continue;
device_remove_file(&csrow->dev,
dynamic_csrow_dimm_attr[chan]);
device_remove_file(&csrow->dev,
Expand All @@ -433,7 +453,11 @@ static void edac_delete_csrow_objects(struct mem_ctl_info *mci)

for (i = mci->nr_csrows - 1; i >= 0; i--) {
csrow = &mci->csrows[i];
if (!nr_pages_per_csrow(csrow))
continue;
for (chan = csrow->nr_channels - 1; chan >= 0; chan--) {
if (!csrow->channels[chan].dimm->nr_pages)
continue;
debugf1("Removing csrow %d channel %d sysfs nodes\n",
i, chan);
device_remove_file(&csrow->dev,
Expand Down

0 comments on commit b857e62

Please sign in to comment.