aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc_sysfs.c
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-09-21 08:10:43 -0400
committerBorislav Petkov <bp@alien8.de>2012-03-19 07:03:58 -0400
commit5e8e19bf6c3c9d8ecf74e2a7fdae99a76949bdf6 (patch)
treef31689e646f1badffab20574e301c162f07b653a /drivers/edac/edac_mc_sysfs.c
parent11b0a31473edf74b70ab6f8fe857b61bff82d7cc (diff)
EDAC: Correct scrub rate API
The original scrub rate API definition states that if scrub rate accessors are not implemented, a negative value (-1) should be written to the sysfs file (/sys/devices/system/edac/mc/mc<N>/sdram_scrub_rate, where N is the memory controller number on the system). This is counter-intuitive and awkward at the very least because, when setting the scrub rate, userspace has to write to sysfs and then read it back to check error status of the operation. As Tony notes, best it would be to not have the sdram_scrub_rate in sysfs if scrub rate support is not implemented. It is too late about that and a bunch of drivers on a bunch of arches would need to be changed and tested which is not a trivial task ATM. Instead, settle for the next best thing of returning -ENODEV when implementation is missing and -EINVAL when there was an error encountered while setting the scrub rate. Reported-by: Han Pingtian <phan@redhat.com> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/20110916105856.GA13253@hpt.nay.redhat.com Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r--drivers/edac/edac_mc_sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index d56e63477d5c..e9a28f576d14 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -452,7 +452,7 @@ static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci,
452 int new_bw = 0; 452 int new_bw = 0;
453 453
454 if (!mci->set_sdram_scrub_rate) 454 if (!mci->set_sdram_scrub_rate)
455 return -EINVAL; 455 return -ENODEV;
456 456
457 if (strict_strtoul(data, 10, &bandwidth) < 0) 457 if (strict_strtoul(data, 10, &bandwidth) < 0)
458 return -EINVAL; 458 return -EINVAL;
@@ -475,7 +475,7 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data)
475 int bandwidth = 0; 475 int bandwidth = 0;
476 476
477 if (!mci->get_sdram_scrub_rate) 477 if (!mci->get_sdram_scrub_rate)
478 return -EINVAL; 478 return -ENODEV;
479 479
480 bandwidth = mci->get_sdram_scrub_rate(mci); 480 bandwidth = mci->get_sdram_scrub_rate(mci);
481 if (bandwidth < 0) { 481 if (bandwidth < 0) {