diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2025-12-04 12:19:49 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2025-12-04 12:19:49 -0800 |
| commit | 02892f90a9851f508e557b3c75e93fc178310d5f (patch) | |
| tree | dce4a63d452b76b565919aef70e8edb401bd8f43 /drivers/hwmon/sfctemp.c | |
| parent | fca5327eaa8117b18c8faf79154d6eafecaf4892 (diff) | |
| parent | 30ca0e049f507001c6377e28482a636689351f64 (diff) | |
Merge tag 'hwmon-for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
"New drivers:
- Apple Silicon SMC
- TSC1641 I2C power monitor
- MPS MP9945
- MAX17616
- MP2925 and MP2929
Added support for new devices to existing drivers:
- dell-smm: Add Dell G5 5505 to fan control whitelist
- aspeed-g6-pwm-tach: Support for AST2700
- asus-ec-sensors: Support for ROG STRIX X470-I GAMING, ROG STRIX
X870-F GAMING WIFI, ROG STRIX X870E-H GAMING WIFI7, and Pro WS
TRX50-SAGE WIFI
- k10temp: Support for AMD Steam Deck APU ID
- pmbus/isl68137: Support for raa229141
- aht10: Support for dht20
- adt7410: Support for ADT7422
- peci: Support for Intel Emerald Rapids
- nct6775: Support for ASUS ROG STRIX X870E-H GAMING WIFI7
- pmbus/max34440: Support for ADPM12200
- ntc-thermistor: Support for Murata ncp18wm474
Infrastructure updates:
- Utilize subsystem locking in various drivers
- ltc4282, ltc2947: Use the new energy64 attribute
Bug fixes:
- Various drivers: Fixes to avoid TOCTOU, mostly in macro functions
evaluating parameters multiple times, as well as missing locks
- max6697: Fix regmap leak on probe failure
- sy7636a: Fix regulator_enable resource leak on error path
- asus-ec-sensors: Correct Pro WS TRX50-SAGE WIFI entry
Other changes and improvements:
- w83781d, lm78: Drop REALLY_SLOW_IO
- Fix broken datasheet links in various drivers
And various other minor fixes and improvements"
* tag 'hwmon-for-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (110 commits)
hwmon: (dell-smm) Add Dell G5 5505 to fan control whitelist
hwmon: (max16065) Use local variable to avoid TOCTOU
hwmon: (w83l786ng) Convert macros to functions to avoid TOCTOU
hwmon: (max6697) fix regmap leak on probe failure
hwmon/w83781d: Drop REALLY_SLOW_IO setting
hwmon/lm78: Drop REALLY_SLOW_IO setting
hwmon: sy7636a: Fix regulator_enable resource leak on error path
hwmon: (adm1026) Convert macros to functions to avoid TOCTOU
hwmon: (adm1029) Add locking to avoid TOCTOU
hwmon: (lm87) Convert macros to functions to avoid TOCTOU
hwmon: (asus-ec-sensors) correct Pro WS TRX50-SAGE WIFI entry
hwmon: (vt8231) Convert macros to functions to avoid TOCTOU
hwmon: (emc2103) Add locking to avoid TOCTOU
hwmon: (aspeed-g6-pwm-tach): Add AST2700 compatible string
dt-bindings: hwmon: Add AST2700 compatible
hwmon: (asus-ec-sensors) add ROG STRIX X470-I GAMING
hwmon: (vt1211) Convert macros to functions to avoid TOCTOU
hwmon: (k10temp) Add AMD Steam Deck APU ID
hwmon: Add Apple Silicon SMC hwmon driver
Documentation/hwmon: Fix broken datasheet links for zl6100
...
Diffstat (limited to 'drivers/hwmon/sfctemp.c')
| -rw-r--r-- | drivers/hwmon/sfctemp.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/drivers/hwmon/sfctemp.c b/drivers/hwmon/sfctemp.c index fb1da93383d7..b78b2c099a12 100644 --- a/drivers/hwmon/sfctemp.c +++ b/drivers/hwmon/sfctemp.c @@ -10,7 +10,6 @@ #include <linux/hwmon.h> #include <linux/io.h> #include <linux/module.h> -#include <linux/mutex.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/reset.h> @@ -49,8 +48,6 @@ #define SFCTEMP_K1000 81100L struct sfctemp { - /* serialize access to hardware register and enabled below */ - struct mutex lock; void __iomem *regs; struct clk *clk_sense; struct clk *clk_bus; @@ -92,15 +89,14 @@ static void sfctemp_stop(struct sfctemp *sfctemp) static int sfctemp_enable(struct sfctemp *sfctemp) { - int ret = 0; + int ret; - mutex_lock(&sfctemp->lock); if (sfctemp->enabled) - goto done; + return 0; ret = clk_prepare_enable(sfctemp->clk_bus); if (ret) - goto err; + return ret; ret = reset_control_deassert(sfctemp->rst_bus); if (ret) goto err_disable_bus; @@ -115,9 +111,7 @@ static int sfctemp_enable(struct sfctemp *sfctemp) sfctemp_power_up(sfctemp); sfctemp_run(sfctemp); sfctemp->enabled = true; -done: - mutex_unlock(&sfctemp->lock); - return ret; + return 0; err_disable_sense: clk_disable_unprepare(sfctemp->clk_sense); @@ -125,16 +119,13 @@ err_assert_bus: reset_control_assert(sfctemp->rst_bus); err_disable_bus: clk_disable_unprepare(sfctemp->clk_bus); -err: - mutex_unlock(&sfctemp->lock); return ret; } static int sfctemp_disable(struct sfctemp *sfctemp) { - mutex_lock(&sfctemp->lock); if (!sfctemp->enabled) - goto done; + return 0; sfctemp_stop(sfctemp); sfctemp_power_down(sfctemp); @@ -143,8 +134,6 @@ static int sfctemp_disable(struct sfctemp *sfctemp) reset_control_assert(sfctemp->rst_bus); clk_disable_unprepare(sfctemp->clk_bus); sfctemp->enabled = false; -done: - mutex_unlock(&sfctemp->lock); return 0; } @@ -155,22 +144,14 @@ static void sfctemp_disable_action(void *data) static int sfctemp_convert(struct sfctemp *sfctemp, long *val) { - int ret; - - mutex_lock(&sfctemp->lock); - if (!sfctemp->enabled) { - ret = -ENODATA; - goto out; - } + if (!sfctemp->enabled) + return -ENODATA; /* calculate temperature in milli Celcius */ *val = (long)((readl(sfctemp->regs) & SFCTEMP_DOUT_MSK) >> SFCTEMP_DOUT_POS) * SFCTEMP_Y1000 / SFCTEMP_Z - SFCTEMP_K1000; - ret = 0; -out: - mutex_unlock(&sfctemp->lock); - return ret; + return 0; } static umode_t sfctemp_is_visible(const void *data, enum hwmon_sensor_types type, @@ -263,7 +244,6 @@ static int sfctemp_probe(struct platform_device *pdev) return -ENOMEM; dev_set_drvdata(dev, sfctemp); - mutex_init(&sfctemp->lock); sfctemp->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sfctemp->regs)) |
