diff options
author | Zev Weiss <zev@bewilderbeest.net> | 2022-08-09 22:26:46 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2022-08-10 06:37:01 -0700 |
commit | f4e6960f4f16b1ca5da16cec7612ecc86402ac05 (patch) | |
tree | 97d59bedcf95242153ac19413e82955213bfe979 /drivers/hwmon/nct6775.h | |
parent | 7aeef1548ac026c8bcb9ec223b672f81da340011 (diff) | |
download | linux-f4e6960f4f16b1ca5da16cec7612ecc86402ac05.tar.gz linux-f4e6960f4f16b1ca5da16cec7612ecc86402ac05.tar.bz2 linux-f4e6960f4f16b1ca5da16cec7612ecc86402ac05.zip |
hwmon: (nct6775) Fix platform driver suspend regression
Commit c3963bc0a0cf ("hwmon: (nct6775) Split core and platform
driver") introduced a slight change in nct6775_suspend() in order to
avoid an otherwise-needless symbol export for nct6775_update_device(),
replacing a call to that function with a simple dev_get_drvdata()
instead.
As it turns out, there is no guarantee that nct6775_update_device()
is ever called prior to suspend. If this happens, the resume function
ends up writing bad data into the various chip registers, which results
in a crash shortly after resume.
To fix the problem, just add the symbol export and return to using
nct6775_update_device() as was employed previously.
Reported-by: Zoltán Kővágó <dirty.ice.hu@gmail.com>
Tested-by: Zoltán Kővágó <dirty.ice.hu@gmail.com>
Fixes: c3963bc0a0cf ("hwmon: (nct6775) Split core and platform driver")
Cc: stable@kernel.org
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Link: https://lore.kernel.org/r/20220810052646.13825-1-zev@bewilderbeest.net
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/nct6775.h')
-rw-r--r-- | drivers/hwmon/nct6775.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwmon/nct6775.h b/drivers/hwmon/nct6775.h index 93f708148e65..be41848c3cd2 100644 --- a/drivers/hwmon/nct6775.h +++ b/drivers/hwmon/nct6775.h @@ -196,6 +196,8 @@ static inline int nct6775_write_value(struct nct6775_data *data, u16 reg, u16 va return regmap_write(data->regmap, reg, value); } +struct nct6775_data *nct6775_update_device(struct device *dev); + bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg); int nct6775_probe(struct device *dev, struct nct6775_data *data, const struct regmap_config *regmapcfg); |