diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 14:02:10 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 14:23:29 -0800 |
commit | a4ec92ed8bc8ca8242b5f2205c255a384cf65710 (patch) | |
tree | dd69d531e83c4093549e0f815136dc377e5a97fd /drivers/hwmon/ina3221.c | |
parent | 46dce7a19551470c25d27d69a56671da00a10545 (diff) |
hwmon: (ina3221) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readability, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the driver with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ina3221.c')
-rw-r--r-- | drivers/hwmon/ina3221.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index e90ccac8bebb..f157214b3b83 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -499,7 +499,7 @@ static const struct hwmon_chip_info ina3221_chip_info = { }; /* Extra attribute groups */ -static ssize_t ina3221_show_shunt(struct device *dev, +static ssize_t ina3221_shunt_show(struct device *dev, struct device_attribute *attr, char *buf) { struct sensor_device_attribute *sd_attr = to_sensor_dev_attr(attr); @@ -510,9 +510,9 @@ static ssize_t ina3221_show_shunt(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", input->shunt_resistor); } -static ssize_t ina3221_set_shunt(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t ina3221_shunt_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { struct sensor_device_attribute *sd_attr = to_sensor_dev_attr(attr); struct ina3221_data *ina = dev_get_drvdata(dev); @@ -533,12 +533,9 @@ static ssize_t ina3221_set_shunt(struct device *dev, } /* shunt resistance */ -static SENSOR_DEVICE_ATTR(shunt1_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL1); -static SENSOR_DEVICE_ATTR(shunt2_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL2); -static SENSOR_DEVICE_ATTR(shunt3_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL3); +static SENSOR_DEVICE_ATTR_RW(shunt1_resistor, ina3221_shunt, INA3221_CHANNEL1); +static SENSOR_DEVICE_ATTR_RW(shunt2_resistor, ina3221_shunt, INA3221_CHANNEL2); +static SENSOR_DEVICE_ATTR_RW(shunt3_resistor, ina3221_shunt, INA3221_CHANNEL3); static struct attribute *ina3221_attrs[] = { &sensor_dev_attr_shunt1_resistor.dev_attr.attr, |