summaryrefslogtreecommitdiff
path: root/drivers/hwmon/sch56xx-common.h
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2023-09-07 08:26:37 +0300
committerGuenter Roeck <linux@roeck-us.net>2023-10-27 17:27:24 +0300
commita54fe61639d9f3b6765fee32edda7cfceb6d705a (patch)
tree9709cc7d9bec857e1cfdfc4f1a422ce0906078c0 /drivers/hwmon/sch56xx-common.h
parent7da8a635436029957c5350da3acf51d78ed64071 (diff)
downloadlinux-a54fe61639d9f3b6765fee32edda7cfceb6d705a.tar.xz
hwmon: (sch5627) Use regmap for pwm map register caching
Accessing virtual registers is very inefficient, so pwm map values should be cached when possible, else userspace could effectively do a DOS attack by reading pwm map values in a while loop. Use the regmap cache to cache those values. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230907052639.16491-4-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/sch56xx-common.h')
-rw-r--r--drivers/hwmon/sch56xx-common.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/sch56xx-common.h b/drivers/hwmon/sch56xx-common.h
index e907d9da0dd5..3fb1cddbf977 100644
--- a/drivers/hwmon/sch56xx-common.h
+++ b/drivers/hwmon/sch56xx-common.h
@@ -5,9 +5,12 @@
***************************************************************************/
#include <linux/mutex.h>
+#include <linux/regmap.h>
struct sch56xx_watchdog_data;
+struct regmap *devm_regmap_init_sch56xx(struct device *dev, struct mutex *lock, u16 addr,
+ const struct regmap_config *config);
int sch56xx_read_virtual_reg(u16 addr, u16 reg);
int sch56xx_write_virtual_reg(u16 addr, u16 reg, u8 val);
int sch56xx_read_virtual_reg16(u16 addr, u16 reg);