summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2025-09-01 11:01:53 -0700
committerGuenter Roeck <linux@roeck-us.net>2025-09-07 16:34:07 -0700
commit8640f9ab1015741e22dff2dd1d6665ad024d5534 (patch)
treee696216f9ad474aa9c284e16e1dca0d990fb7adb
parentf2711a19651f28b426cf78792822a37f7641f43c (diff)
downloadlinux-stable-8640f9ab1015741e22dff2dd1d6665ad024d5534.tar.gz
linux-stable-8640f9ab1015741e22dff2dd1d6665ad024d5534.zip
hwmon: (ina238) Drop pointless power attribute check on attribute writes
There is only a single writeable power attribute, and it is very unlikely that the chips supported by this driver will ever require another one. That means checking for that attribute during runtime is unnecessary. Drop the check. Rename the write function from ina238_write_power() to ina238_write_power_max() to reflect that a single attribute is written. No functional change intended. Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # INA780 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/ina238.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/ina238.c b/drivers/hwmon/ina238.c
index 22e2b862fb33..23195dead74f 100644
--- a/drivers/hwmon/ina238.c
+++ b/drivers/hwmon/ina238.c
@@ -503,14 +503,11 @@ static int ina238_read_power(struct device *dev, u32 attr, long *val)
return 0;
}
-static int ina238_write_power(struct device *dev, u32 attr, long val)
+static int ina238_write_power_max(struct device *dev, long val)
{
struct ina238_data *data = dev_get_drvdata(dev);
long regval;
- if (attr != hwmon_power_max)
- return -EOPNOTSUPP;
-
/*
* Unsigned postive values. Compared against the 24-bit power register,
* lower 8-bits are truncated. Same conversion to/from uW as POWER
@@ -628,7 +625,7 @@ static int ina238_write(struct device *dev, enum hwmon_sensor_types type,
err = ina238_write_in(dev, attr, channel, val);
break;
case hwmon_power:
- err = ina238_write_power(dev, attr, val);
+ err = ina238_write_power_max(dev, val);
break;
case hwmon_temp:
err = ina238_write_temp(dev, attr, val);