summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2019-04-16 15:51:03 +0000
committerAndrew Jeffery <andrew@aj.id.au>2019-04-18 11:11:05 +0930
commit2ed835e9a1dc6e38a05b1755142e657af38e2b71 (patch)
treea980313b66db73ab871f25ba59fc825f38c19dcc
parentf775b1e7f9e42753caad56231b48689e1dd1edf8 (diff)
downloadtalos-obmc-linux-2ed835e9a1dc6e38a05b1755142e657af38e2b71.tar.gz
talos-obmc-linux-2ed835e9a1dc6e38a05b1755142e657af38e2b71.zip
hwmon (occ): Store error condition for rate-limited polls
The OCC driver limits the rate of sending poll commands to the OCC. If a user reads a hwmon entry after a poll response resulted in an error and is rate-limited, the error is invisible to the user. Fix this by storing the last error and returning that in the rate-limited case. OpenBMC-Staging-Count: 1 Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r--drivers/hwmon/occ/common.c4
-rw-r--r--drivers/hwmon/occ/common.h3
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index c888f4aca45c..0e812effba6a 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -138,6 +138,7 @@ static int occ_poll(struct occ *occ)
/* mutex should already be locked if necessary */
rc = occ->send_cmd(occ, cmd);
if (rc) {
+ occ->last_error = rc;
if (occ->error_count++ > OCC_ERROR_COUNT_THRESHOLD)
occ->error = rc;
@@ -146,6 +147,7 @@ static int occ_poll(struct occ *occ)
/* clear error since communication was successful */
occ->error_count = 0;
+ occ->last_error = 0;
occ->error = 0;
/* check for safe state */
@@ -207,6 +209,8 @@ int occ_update_response(struct occ *occ)
if (time_after(jiffies, occ->last_update + OCC_UPDATE_FREQUENCY)) {
rc = occ_poll(occ);
occ->last_update = jiffies;
+ } else {
+ rc = occ->last_error;
}
mutex_unlock(&occ->lock);
diff --git a/drivers/hwmon/occ/common.h b/drivers/hwmon/occ/common.h
index 7c44df3f5631..c676e48b01d8 100644
--- a/drivers/hwmon/occ/common.h
+++ b/drivers/hwmon/occ/common.h
@@ -105,7 +105,8 @@ struct occ {
struct attribute_group group;
const struct attribute_group *groups[2];
- int error; /* latest transfer error */
+ int error; /* final transfer error after retry */
+ int last_error; /* latest transfer error */
unsigned int error_count; /* number of xfr errors observed */
unsigned long last_safe; /* time OCC entered "safe" state */
OpenPOWER on IntegriCloud