aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/occ/common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-06 19:56:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-06 19:56:51 -0700
commit7aefd944f038c7469571adb37769cb6f3924ecfa (patch)
treef0a8dc23633b6bbbc4f0bff932f332e847fb6c1b /drivers/hwmon/occ/common.c
parentMerge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (diff)
parenthwmon: (lm75) Add support for TMP75B (diff)
downloadlinux-dev-7aefd944f038c7469571adb37769cb6f3924ecfa.tar.xz
linux-dev-7aefd944f038c7469571adb37769cb6f3924ecfa.zip
Merge tag 'hwmon-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck: - Add driver for Intersil ISL68137 PWM Controller - Add driver for Lochnagar 2 - Add driver for Infineon IR38064 Voltage Regulator - Add support for TMP75B to lm75 driver - Convert documentation to ReST format - Use request_muxed_region for Super-IO accesses in several drivers - Add 'samples' attribute to ABI, and start using it - Add support for custom sysfs attributes to pmbus drivers (used in ISL68137 driver) - Introduce HWMON_CHANNEL_INFO macro - Automated changes: - Use permission specific [SENSOR_][DEVICE_]ATTR variants - Fix build warnings due to unused of_device_id structures - Use HWMON_CHANNEL_INFO macro - Various minor improvements and fixes * tag 'hwmon-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (125 commits) hwmon: (lm75) Add support for TMP75B dt-bindings: hwmon: Add tmp75b to lm75.txt hwmon: (s3c) Use dev_get_drvdata() hwmon: (max6650) Drop call to thermal_cdev_update docs: hwmon: remove the extension from .rst files docs: hwmon: convert three docs to ReST format hwmon: (max6650) add thermal cooling device capability hwmon: (ina3221) Add voltage conversion time settings hwmon: (ina3221) Do not read-back to cache reg_config docs: hwmon: Add an index file and rename docs to *.rst docs: hwmon: convert remaining files to ReST format docs: hwmon: misc files: convert to ReST format docs: hwmon: pmbus files: convert to ReST format docs: hwmon: k8temp, w83793: convert to ReST format docs: hwmon: da9052, da9055: convert to ReST format docs: hwmon: wm831x, wm8350: convert to ReST format docs: hwmon: dme1737, vt1211: convert to ReST format docs: hwmon: ads1015: convert to ReST format docs: hwmon: asc7621: convert to ReST format docs: hwmon: ibmpowernv: convert to ReST format ...
Diffstat (limited to 'drivers/hwmon/occ/common.c')
-rw-r--r--drivers/hwmon/occ/common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index 4679acb4918e..13a6290c8d25 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -2,11 +2,13 @@
// Copyright IBM Corp 2019
#include <linux/device.h>
+#include <linux/export.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/math64.h>
+#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <asm/unaligned.h>
@@ -139,6 +141,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;
@@ -147,6 +150,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 */
@@ -208,6 +212,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);
@@ -1099,3 +1105,8 @@ int occ_setup(struct occ *occ, const char *name)
return rc;
}
+EXPORT_SYMBOL_GPL(occ_setup);
+
+MODULE_AUTHOR("Eddie James <eajames@linux.ibm.com>");
+MODULE_DESCRIPTION("Common OCC hwmon code");
+MODULE_LICENSE("GPL");