Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+2 -5
+2 -5
drivers/hwmon/ina238.c
··· 503 503 return 0; 504 504 } 505 505 506 - static int ina238_write_power(struct device *dev, u32 attr, long val) 506 + static int ina238_write_power_max(struct device *dev, long val) 507 507 { 508 508 struct ina238_data *data = dev_get_drvdata(dev); 509 509 long regval; 510 - 511 - if (attr != hwmon_power_max) 512 - return -EOPNOTSUPP; 513 510 514 511 /* 515 512 * Unsigned postive values. Compared against the 24-bit power register, ··· 625 628 err = ina238_write_in(dev, attr, channel, val); 626 629 break; 627 630 case hwmon_power: 628 - err = ina238_write_power(dev, attr, val); 631 + err = ina238_write_power_max(dev, val); 629 632 break; 630 633 case hwmon_temp: 631 634 err = ina238_write_temp(dev, attr, val);