From 45df5e27711ed2ef16674df9be62ceda44b74359 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 10 Dec 2018 14:02:21 -0800 Subject: hwmon: (sht3x) 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_ 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 --- drivers/hwmon/sht3x.c | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) (limited to 'drivers/hwmon') diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index 370b57dafab7..81ebc96cdec9 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -629,40 +629,22 @@ out: return count; } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, temp1_input_show, NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, humidity1_input_show, - NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, - temp1_limit_show, temp1_limit_store, - limit_max); -static SENSOR_DEVICE_ATTR(humidity1_max, S_IRUGO | S_IWUSR, - humidity1_limit_show, humidity1_limit_store, - limit_max); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, - temp1_limit_show, temp1_limit_store, - limit_max_hyst); -static SENSOR_DEVICE_ATTR(humidity1_max_hyst, S_IRUGO | S_IWUSR, - humidity1_limit_show, humidity1_limit_store, - limit_max_hyst); -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, - temp1_limit_show, temp1_limit_store, - limit_min); -static SENSOR_DEVICE_ATTR(humidity1_min, S_IRUGO | S_IWUSR, - humidity1_limit_show, humidity1_limit_store, - limit_min); -static SENSOR_DEVICE_ATTR(temp1_min_hyst, S_IRUGO | S_IWUSR, - temp1_limit_show, temp1_limit_store, - limit_min_hyst); -static SENSOR_DEVICE_ATTR(humidity1_min_hyst, S_IRUGO | S_IWUSR, - humidity1_limit_show, humidity1_limit_store, - limit_min_hyst); -static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, temp1_alarm_show, NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_alarm, S_IRUGO, humidity1_alarm_show, - NULL, 0); -static SENSOR_DEVICE_ATTR(heater_enable, S_IRUGO | S_IWUSR, - heater_enable_show, heater_enable_store, 0); -static SENSOR_DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, - update_interval_show, update_interval_store, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp1_input, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_input, humidity1_input, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp1_limit, limit_max); +static SENSOR_DEVICE_ATTR_RW(humidity1_max, humidity1_limit, limit_max); +static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp1_limit, limit_max_hyst); +static SENSOR_DEVICE_ATTR_RW(humidity1_max_hyst, humidity1_limit, + limit_max_hyst); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp1_limit, limit_min); +static SENSOR_DEVICE_ATTR_RW(humidity1_min, humidity1_limit, limit_min); +static SENSOR_DEVICE_ATTR_RW(temp1_min_hyst, temp1_limit, limit_min_hyst); +static SENSOR_DEVICE_ATTR_RW(humidity1_min_hyst, humidity1_limit, + limit_min_hyst); +static SENSOR_DEVICE_ATTR_RO(temp1_alarm, temp1_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_alarm, humidity1_alarm, 0); +static SENSOR_DEVICE_ATTR_RW(heater_enable, heater_enable, 0); +static SENSOR_DEVICE_ATTR_RW(update_interval, update_interval, 0); static struct attribute *sht3x_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, -- cgit