aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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 /drivers
parentf2711a19651f28b426cf78792822a37f7641f43c (diff)
downloadnet-8640f9ab1015741e22dff2dd1d6665ad024d5534.tar.gz
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>
Diffstat (limited to 'drivers')
-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 22e2b862fb3363..23195dead74f6c 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);