hwmon: Use permission specific SENSOR[_DEVICE]_ATTR
Subsystems (8)
Guenter Roeck
maintainercover hwmon: Use permission specific SENSOR[_DEVICE]_ATTR
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the drivers 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 series does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes.
Note that the conversion of DEVICE_ATTR to DEVICE_ATTR_{RO,RW} is not part of this series.
This is the final patch set with auto-converted drivers.
Guenter Roeck
maintainerPATCH 1/30 hwmon: (ltc4261) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/ltc4261.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
drivers/hwmon/ltc4261.c +10 -18
@@ -132,7 +132,7 @@ static int ltc4261_get_value(struct ltc4261_data *data, u8 reg)return val; } -static ssize_t ltc4261_show_value (struct device *dev, +static ssize_t ltc4261_value_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -146,7 +146,7 @@ static ssize_t ltc4261_show_value(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , value); } -static ssize_t ltc4261_show_bool (struct device *dev, +static ssize_t ltc4261_bool_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -166,10 +166,8 @@ static ssize_t ltc4261_show_bool(struct device *dev,/* * Input voltages. */ -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4261_show_value, NULL, - LTC4261_ADIN_H); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4261_show_value, NULL, - LTC4261_ADIN2_H); +static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4261_value, LTC4261_ADIN_H); +static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4261_value, LTC4261_ADIN2_H);/* * Voltage alarms. The chip has only one set of voltage alarm status bits,
@@ -179,22 +177,16 @@ static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4261_show_value, NULL,* To ensure that the alarm condition is reported to the user, report it * with both voltage sensors. */ -static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc4261_show_bool, NULL, - FAULT_UV); -static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, - FAULT_OV); -static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc4261_show_bool, NULL, - FAULT_UV); -static SENSOR_DEVICE_ATTR(in2_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, - FAULT_OV); +static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ltc4261_bool, FAULT_UV); +static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ltc4261_bool, FAULT_OV); +static SENSOR_DEVICE_ATTR_RO(in2_min_alarm, ltc4261_bool, FAULT_UV); +static SENSOR_DEVICE_ATTR_RO(in2_max_alarm, ltc4261_bool, FAULT_OV);/* Currents (via sense resistor) */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4261_show_value, NULL, - LTC4261_SENSE_H); +static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4261_value, LTC4261_SENSE_H);/* Overcurrent alarm */ -static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, - FAULT_OC); +static SENSOR_DEVICE_ATTR_RO(curr1_max_alarm, ltc4261_bool, FAULT_OC);static struct attribute *ltc4261_attrs[] = { &sensor_dev_attr_in1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 2/30 hwmon: (max16065) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max16065.c | 225 +++++++++++++++++------------------------------ 1 file changed, 82 insertions(+), 143 deletions(-)
drivers/hwmon/max16065.c +82 -143
@@ -175,7 +175,7 @@ static struct max16065_data *max16065_update_device(struct device *dev)return data; } -static ssize_t max16065_show_alarm (struct device *dev, +static ssize_t max16065_alarm_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute_2 *attr2 =to_sensor_dev_attr_2 (da);
@@ -193,7 +193,7 @@ static ssize_t max16065_show_alarm(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , !!val); } -static ssize_t max16065_show_input (struct device *dev, +static ssize_t max16065_input_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -207,7 +207,7 @@ static ssize_t max16065_show_input(struct device *dev, ADC_TO_MV(adc, data->range[attr->index])); } -static ssize_t max16065_show_current (struct device *dev, +static ssize_t max16065_current_show (struct device *dev,struct device_attribute *da,char *buf) {struct max16065_data *data =max16065_update_device (dev);
@@ -219,9 +219,9 @@ static ssize_t max16065_show_current(struct device *dev, ADC_TO_CURR(data->curr_sense, data->curr_gain)); } -static ssize_t max16065_set_limit (struct device *dev, -struct device_attribute *da, -const char *buf,size_t count) +static ssize_t max16065_limit_store (struct device *dev, +struct device_attribute *da, +const char *buf,size_t count) {struct sensor_device_attribute_2 *attr2 =to_sensor_dev_attr_2 (da);struct max16065_data *data =dev_get_drvdata (dev);
@@ -246,7 +246,7 @@ static ssize_t max16065_set_limit(struct device *dev,return count; } -static ssize_t max16065_show_limit (struct device *dev, +static ssize_t max16065_limit_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute_2 *attr2 =to_sensor_dev_attr_2 (da);
@@ -259,154 +259,93 @@ static ssize_t max16065_show_limit(struct device *dev,/* Construct a sensor_device_attribute structure for each register */ /* Input voltages */ -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, max16065_show_input, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, max16065_show_input, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, max16065_show_input, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, max16065_show_input, NULL, 3); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, max16065_show_input, NULL, 4); -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, max16065_show_input, NULL, 5); -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, max16065_show_input, NULL, 6); -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, max16065_show_input, NULL, 7); -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, max16065_show_input, NULL, 8); -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, max16065_show_input, NULL, 9); -static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, max16065_show_input, NULL, 10); -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, max16065_show_input, NULL, 11); -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, max16065_show_input, NULL, 12); +static SENSOR_DEVICE_ATTR_RO(in0_input, max16065_input, 0); +static SENSOR_DEVICE_ATTR_RO(in1_input, max16065_input, 1); +static SENSOR_DEVICE_ATTR_RO(in2_input, max16065_input, 2); +static SENSOR_DEVICE_ATTR_RO(in3_input, max16065_input, 3); +static SENSOR_DEVICE_ATTR_RO(in4_input, max16065_input, 4); +static SENSOR_DEVICE_ATTR_RO(in5_input, max16065_input, 5); +static SENSOR_DEVICE_ATTR_RO(in6_input, max16065_input, 6); +static SENSOR_DEVICE_ATTR_RO(in7_input, max16065_input, 7); +static SENSOR_DEVICE_ATTR_RO(in8_input, max16065_input, 8); +static SENSOR_DEVICE_ATTR_RO(in9_input, max16065_input, 9); +static SENSOR_DEVICE_ATTR_RO(in10_input, max16065_input, 10); +static SENSOR_DEVICE_ATTR_RO(in11_input, max16065_input, 11); +static SENSOR_DEVICE_ATTR_RO(in12_input, max16065_input, 12);/* Input voltages lcrit */ -static SENSOR_DEVICE_ATTR_2(in0_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 0); -static SENSOR_DEVICE_ATTR_2(in1_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 1); -static SENSOR_DEVICE_ATTR_2(in2_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 2); -static SENSOR_DEVICE_ATTR_2(in3_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 3); -static SENSOR_DEVICE_ATTR_2(in4_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 4); -static SENSOR_DEVICE_ATTR_2(in5_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 5); -static SENSOR_DEVICE_ATTR_2(in6_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 6); -static SENSOR_DEVICE_ATTR_2(in7_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 7); -static SENSOR_DEVICE_ATTR_2(in8_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 8); -static SENSOR_DEVICE_ATTR_2(in9_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 9); -static SENSOR_DEVICE_ATTR_2(in10_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 10); -static SENSOR_DEVICE_ATTR_2(in11_lcrit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 2, 11); +static SENSOR_DEVICE_ATTR_2_RW(in0_lcrit, max16065_limit, 2, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_lcrit, max16065_limit, 2, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_lcrit, max16065_limit, 2, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_lcrit, max16065_limit, 2, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_lcrit, max16065_limit, 2, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_lcrit, max16065_limit, 2, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_lcrit, max16065_limit, 2, 6); +static SENSOR_DEVICE_ATTR_2_RW(in7_lcrit, max16065_limit, 2, 7); +static SENSOR_DEVICE_ATTR_2_RW(in8_lcrit, max16065_limit, 2, 8); +static SENSOR_DEVICE_ATTR_2_RW(in9_lcrit, max16065_limit, 2, 9); +static SENSOR_DEVICE_ATTR_2_RW(in10_lcrit, max16065_limit, 2, 10); +static SENSOR_DEVICE_ATTR_2_RW(in11_lcrit, max16065_limit, 2, 11);/* Input voltages crit */ -static SENSOR_DEVICE_ATTR_2(in0_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 0); -static SENSOR_DEVICE_ATTR_2(in1_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 1); -static SENSOR_DEVICE_ATTR_2(in2_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 2); -static SENSOR_DEVICE_ATTR_2(in3_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 3); -static SENSOR_DEVICE_ATTR_2(in4_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 4); -static SENSOR_DEVICE_ATTR_2(in5_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 5); -static SENSOR_DEVICE_ATTR_2(in6_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 6); -static SENSOR_DEVICE_ATTR_2(in7_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 7); -static SENSOR_DEVICE_ATTR_2(in8_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 8); -static SENSOR_DEVICE_ATTR_2(in9_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 9); -static SENSOR_DEVICE_ATTR_2(in10_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 10); -static SENSOR_DEVICE_ATTR_2(in11_crit, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 1, 11); +static SENSOR_DEVICE_ATTR_2_RW(in0_crit, max16065_limit, 1, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_crit, max16065_limit, 1, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_crit, max16065_limit, 1, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_crit, max16065_limit, 1, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_crit, max16065_limit, 1, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_crit, max16065_limit, 1, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_crit, max16065_limit, 1, 6); +static SENSOR_DEVICE_ATTR_2_RW(in7_crit, max16065_limit, 1, 7); +static SENSOR_DEVICE_ATTR_2_RW(in8_crit, max16065_limit, 1, 8); +static SENSOR_DEVICE_ATTR_2_RW(in9_crit, max16065_limit, 1, 9); +static SENSOR_DEVICE_ATTR_2_RW(in10_crit, max16065_limit, 1, 10); +static SENSOR_DEVICE_ATTR_2_RW(in11_crit, max16065_limit, 1, 11);/* Input voltages min */ -static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 0); -static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 1); -static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 2); -static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 3); -static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 4); -static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 5); -static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 6); -static SENSOR_DEVICE_ATTR_2(in7_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 7); -static SENSOR_DEVICE_ATTR_2(in8_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 8); -static SENSOR_DEVICE_ATTR_2(in9_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 9); -static SENSOR_DEVICE_ATTR_2(in10_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 10); -static SENSOR_DEVICE_ATTR_2(in11_min, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 11); +static SENSOR_DEVICE_ATTR_2_RW(in0_min, max16065_limit, 0, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_min, max16065_limit, 0, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_min, max16065_limit, 0, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_min, max16065_limit, 0, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_min, max16065_limit, 0, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_min, max16065_limit, 0, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_min, max16065_limit, 0, 6); +static SENSOR_DEVICE_ATTR_2_RW(in7_min, max16065_limit, 0, 7); +static SENSOR_DEVICE_ATTR_2_RW(in8_min, max16065_limit, 0, 8); +static SENSOR_DEVICE_ATTR_2_RW(in9_min, max16065_limit, 0, 9); +static SENSOR_DEVICE_ATTR_2_RW(in10_min, max16065_limit, 0, 10); +static SENSOR_DEVICE_ATTR_2_RW(in11_min, max16065_limit, 0, 11);/* Input voltages max */ -static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 0); -static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 1); -static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 2); -static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 3); -static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 4); -static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 5); -static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 6); -static SENSOR_DEVICE_ATTR_2(in7_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 7); -static SENSOR_DEVICE_ATTR_2(in8_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 8); -static SENSOR_DEVICE_ATTR_2(in9_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 9); -static SENSOR_DEVICE_ATTR_2(in10_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 10); -static SENSOR_DEVICE_ATTR_2(in11_max, S_IWUSR | S_IRUGO, max16065_show_limit, - max16065_set_limit, 0, 11); +static SENSOR_DEVICE_ATTR_2_RW(in0_max, max16065_limit, 0, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_max, max16065_limit, 0, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_max, max16065_limit, 0, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_max, max16065_limit, 0, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_max, max16065_limit, 0, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_max, max16065_limit, 0, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_max, max16065_limit, 0, 6); +static SENSOR_DEVICE_ATTR_2_RW(in7_max, max16065_limit, 0, 7); +static SENSOR_DEVICE_ATTR_2_RW(in8_max, max16065_limit, 0, 8); +static SENSOR_DEVICE_ATTR_2_RW(in9_max, max16065_limit, 0, 9); +static SENSOR_DEVICE_ATTR_2_RW(in10_max, max16065_limit, 0, 10); +static SENSOR_DEVICE_ATTR_2_RW(in11_max, max16065_limit, 0, 11);/* alarms */ -static SENSOR_DEVICE_ATTR_2(in0_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 0); -static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 1); -static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 2); -static SENSOR_DEVICE_ATTR_2(in3_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 3); -static SENSOR_DEVICE_ATTR_2(in4_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 4); -static SENSOR_DEVICE_ATTR_2(in5_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 5); -static SENSOR_DEVICE_ATTR_2(in6_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 6); -static SENSOR_DEVICE_ATTR_2(in7_alarm, S_IRUGO, max16065_show_alarm, NULL, - 0, 7); -static SENSOR_DEVICE_ATTR_2(in8_alarm, S_IRUGO, max16065_show_alarm, NULL, - 1, 0); -static SENSOR_DEVICE_ATTR_2(in9_alarm, S_IRUGO, max16065_show_alarm, NULL, - 1, 1); -static SENSOR_DEVICE_ATTR_2(in10_alarm, S_IRUGO, max16065_show_alarm, NULL, - 1, 2); -static SENSOR_DEVICE_ATTR_2(in11_alarm, S_IRUGO, max16065_show_alarm, NULL, - 1, 3); +static SENSOR_DEVICE_ATTR_2_RO(in0_alarm, max16065_alarm, 0, 0); +static SENSOR_DEVICE_ATTR_2_RO(in1_alarm, max16065_alarm, 0, 1); +static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, max16065_alarm, 0, 2); +static SENSOR_DEVICE_ATTR_2_RO(in3_alarm, max16065_alarm, 0, 3); +static SENSOR_DEVICE_ATTR_2_RO(in4_alarm, max16065_alarm, 0, 4); +static SENSOR_DEVICE_ATTR_2_RO(in5_alarm, max16065_alarm, 0, 5); +static SENSOR_DEVICE_ATTR_2_RO(in6_alarm, max16065_alarm, 0, 6); +static SENSOR_DEVICE_ATTR_2_RO(in7_alarm, max16065_alarm, 0, 7); +static SENSOR_DEVICE_ATTR_2_RO(in8_alarm, max16065_alarm, 1, 0); +static SENSOR_DEVICE_ATTR_2_RO(in9_alarm, max16065_alarm, 1, 1); +static SENSOR_DEVICE_ATTR_2_RO(in10_alarm, max16065_alarm, 1, 2); +static SENSOR_DEVICE_ATTR_2_RO(in11_alarm, max16065_alarm, 1, 3);/* Current and alarm */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, max16065_show_current, NULL, 0); -static SENSOR_DEVICE_ATTR_2(curr1_alarm, S_IRUGO, max16065_show_alarm, NULL, - 1, 4); +static SENSOR_DEVICE_ATTR_RO(curr1_input, max16065_current, 0); +static SENSOR_DEVICE_ATTR_2_RO(curr1_alarm, max16065_alarm, 1, 4);/* * Finally, construct an array of pointers to members of the above objects,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 3/30 hwmon: (max1619) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max1619.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/hwmon/max1619.c +15 -18
@@ -145,7 +145,7 @@ static struct max1619_data *max1619_update_device(struct device *dev)* Sysfs stuff */ -static ssize_t show_temp (struct device *dev,struct device_attribute *devattr, +static ssize_t temp_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -154,8 +154,9 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,return sprintf (buf,"%d\n" ,temp_from_reg (data->temp[attr->index])); } -static ssize_t set_temp (struct device *dev,struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t temp_store (struct device *dev, +struct device_attribute *devattr,const char *buf, +size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct max1619_data *data =dev_get_drvdata (dev);
@@ -180,7 +181,7 @@ static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , data->alarms); } -static ssize_t show_alarm (struct device *dev,struct device_attribute *attr, +static ssize_t alarm_show (struct device *dev,struct device_attribute *attr,char *buf) {int bitnr =to_sensor_dev_attr (attr)->index;
@@ -188,22 +189,18 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , (data->alarms >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input1); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, t_input2); -static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_low2); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_high2); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_crit2); -static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_hyst2); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input1); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, t_input2); +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp, t_low2); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp, t_high2); +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp, t_crit2); +static SENSOR_DEVICE_ATTR_RW(temp2_crit_hyst, temp, t_hyst2);static DEVICE_ATTR_RO (alarms); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 4);static struct attribute *max1619_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 4/30 hwmon: (max31722) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max31722.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/hwmon/max31722.c +3 -5
@@ -50,9 +50,8 @@ static int max31722_set_mode(struct max31722_data *data, u8 mode)return 0 ; } -static ssize_t max31722_show_temp (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t max31722_temp_show (struct device *dev, +struct device_attribute *attr,char *buf) {ssize_t ret;struct max31722_data *data =dev_get_drvdata (dev);
@@ -64,8 +63,7 @@ static ssize_t max31722_show_temp(struct device *dev,return sprintf (buf,"%d\n" , (s16 )le16_to_cpu (ret) *125 /32 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, - max31722_show_temp, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, max31722_temp, 0);static struct attribute *max31722_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 5/30 hwmon: (max31790) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/max31790.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/max31790.c +3 -3
@@ -252,12 +252,12 @@ static umode_t max31790_fan_is_visible(const void *_data, u32 attr, int channel)case hwmon_fan_fault:if (channel <NR_CHANNEL || (fan_config &MAX31790_FAN_CFG_TACH_INPUT )) -return S_IRUGO ; +return 0444 ;return 0 ;case hwmon_fan_target:if (channel <NR_CHANNEL && !(fan_config &MAX31790_FAN_CFG_TACH_INPUT )) -return S_IRUGO |S_IWUSR ; +return 0644 ;return 0 ;default :return 0 ;
@@ -353,7 +353,7 @@ static umode_t max31790_pwm_is_visible(const void *_data, u32 attr, int channel)case hwmon_pwm_input:case hwmon_pwm_enable:if (!(fan_config &MAX31790_FAN_CFG_TACH_INPUT )) -return S_IRUGO |S_IWUSR ; +return 0644 ;return 0 ;default :return 0 ;
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 6/30 hwmon: (max6639) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max6639.c | 92 +++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 49 deletions(-)
drivers/hwmon/max6639.c +43 -49
@@ -162,7 +162,7 @@ static struct max6639_data *max6639_update_device(struct device *dev)return ret; } -static ssize_t show_temp_input (struct device *dev, +static ssize_t temp_input_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {long temp;
@@ -176,7 +176,7 @@ static ssize_t show_temp_input(struct device *dev,return sprintf (buf,"%ld\n" , temp); } -static ssize_t show_temp_fault (struct device *dev, +static ssize_t temp_fault_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct max6639_data *data =max6639_update_device (dev);
@@ -188,7 +188,7 @@ static ssize_t show_temp_fault(struct device *dev,return sprintf (buf,"%d\n" , data->temp_fault[attr->index]); } -static ssize_t show_temp_max (struct device *dev, +static ssize_t temp_max_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);
@@ -197,9 +197,9 @@ static ssize_t show_temp_max(struct device *dev,return sprintf (buf,"%d\n" , (data->temp_therm[attr->index] *1000 )); } -static ssize_t set_temp_max (struct device *dev, -struct device_attribute *dev_attr, -const char *buf,size_t count) +static ssize_t temp_max_store (struct device *dev, +struct device_attribute *dev_attr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct max6639_data *data =dev_get_drvdata (dev);
@@ -220,7 +220,7 @@ static ssize_t set_temp_max(struct device *dev,return count; } -static ssize_t show_temp_crit (struct device *dev, +static ssize_t temp_crit_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);
@@ -229,9 +229,9 @@ static ssize_t show_temp_crit(struct device *dev,return sprintf (buf,"%d\n" , (data->temp_alert[attr->index] *1000 )); } -static ssize_t set_temp_crit (struct device *dev, -struct device_attribute *dev_attr, -const char *buf,size_t count) +static ssize_t temp_crit_store (struct device *dev, +struct device_attribute *dev_attr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct max6639_data *data =dev_get_drvdata (dev);
@@ -252,7 +252,7 @@ static ssize_t set_temp_crit(struct device *dev,return count; } -static ssize_t show_temp_emergency (struct device *dev, +static ssize_t temp_emergency_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {
@@ -262,9 +262,9 @@ static ssize_t show_temp_emergency(struct device *dev,return sprintf (buf,"%d\n" , (data->temp_ot[attr->index] *1000 )); } -static ssize_t set_temp_emergency (struct device *dev, -struct device_attribute *dev_attr, -const char *buf,size_t count) +static ssize_t temp_emergency_store (struct device *dev, +struct device_attribute *dev_attr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct max6639_data *data =dev_get_drvdata (dev);
@@ -285,8 +285,8 @@ static ssize_t set_temp_emergency(struct device *dev,return count; } -static ssize_t show_pwm (struct device *dev, -struct device_attribute *dev_attr,char *buf) +static ssize_t pwm_show (struct device *dev,struct device_attribute *dev_attr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct max6639_data *data =dev_get_drvdata (dev);
@@ -294,9 +294,9 @@ static ssize_t show_pwm(struct device *dev,return sprintf (buf,"%d\n" , data->pwm[attr->index] *255 /120 ); } -static ssize_t set_pwm (struct device *dev, -struct device_attribute *dev_attr, -const char *buf,size_t count) +static ssize_t pwm_store (struct device *dev, +struct device_attribute *dev_attr,const char *buf, +size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct max6639_data *data =dev_get_drvdata (dev);
@@ -319,7 +319,7 @@ static ssize_t set_pwm(struct device *dev,return count; } -static ssize_t show_fan_input (struct device *dev, +static ssize_t fan_input_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct max6639_data *data =max6639_update_device (dev);
@@ -332,7 +332,7 @@ static ssize_t show_fan_input(struct device *dev, data->rpm_range)); } -static ssize_t show_alarm (struct device *dev, +static ssize_t alarm_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct max6639_data *data =max6639_update_device (dev);
@@ -344,34 +344,28 @@ static ssize_t show_alarm(struct device *dev,return sprintf (buf,"%d\n" , !!(data->status & (1 << attr->index))); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 1); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp_crit, - set_temp_crit, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit, - set_temp_crit, 1); -static SENSOR_DEVICE_ATTR(temp1_emergency, S_IWUSR | S_IRUGO, - show_temp_emergency, set_temp_emergency, 0); -static SENSOR_DEVICE_ATTR(temp2_emergency, S_IWUSR | S_IRUGO, - show_temp_emergency, set_temp_emergency, 1); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 7); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO, show_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(temp2_emergency_alarm, S_IRUGO, show_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_emergency, temp_emergency, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_emergency, temp_emergency, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); +static SENSOR_DEVICE_ATTR_RO(fan1_fault, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 7); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(temp1_emergency_alarm, alarm, 5); +static SENSOR_DEVICE_ATTR_RO(temp2_emergency_alarm, alarm, 4);static struct attribute *max6639_attrs[] = {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 7/30 hwmon: (max6642) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max6642.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/hwmon/max6642.c +16 -15
@@ -206,7 +206,7 @@ static struct max6642_data *max6642_update_device(struct device *dev)* Sysfs stuff */ -static ssize_t show_temp_max10 (struct device *dev, +static ssize_t temp_max10_show (struct device *dev,struct device_attribute *dev_attr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);
@@ -216,8 +216,8 @@ static ssize_t show_temp_max10(struct device *dev, temp_from_reg10(data->temp_input[attr->index])); } -static ssize_t show_temp_max (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t temp_max_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct sensor_device_attribute_2 *attr2 =to_sensor_dev_attr_2 (attr);struct max6642_data *data =max6642_update_device (dev);
@@ -225,8 +225,9 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,temp_from_reg (data->temp_high[attr2->nr])); } -static ssize_t set_temp_max (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_max_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {struct sensor_device_attribute_2 *attr2 =to_sensor_dev_attr_2 (attr);struct max6642_data *data =dev_get_drvdata (dev);
@@ -245,7 +246,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t show_alarm (struct device *dev,struct device_attribute *attr, +static ssize_t alarm_show (struct device *dev,struct device_attribute *attr,char *buf) {int bitnr =to_sensor_dev_attr (attr)->index;
@@ -253,15 +254,15 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , (data->alarms >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_max10, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_max10, NULL, 1); -static SENSOR_DEVICE_ATTR_2(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 0, MAX6642_REG_W_LOCAL_HIGH); -static SENSOR_DEVICE_ATTR_2(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 1, MAX6642_REG_W_REMOTE_HIGH); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_max10, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_max10, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp1_max, temp_max, 0, + MAX6642_REG_W_LOCAL_HIGH); +static SENSOR_DEVICE_ATTR_2_RW(temp2_max, temp_max, 1, + MAX6642_REG_W_REMOTE_HIGH); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 4);static struct attribute *max6642_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 8/30 hwmon: (max6650) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/max6650.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/max6650.c +3 -3
@@ -52,9 +52,9 @@ static int prescaler;/* clock: The clock frequency of the chip (max6651 can be clocked externally) */ static int clock =254000 ; -module_param (fan_voltage, int,S_IRUGO ); -module_param (prescaler, int,S_IRUGO ); -module_param (clock, int,S_IRUGO ); +module_param (fan_voltage, int,0444 ); +module_param (prescaler, int,0444 ); +module_param (clock, int,0444 );/* * MAX 6650/6651 registers
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 9/30 hwmon: (mc13783-adc) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/mc13783-adc.c | 49 ++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 23 deletions(-)
drivers/hwmon/mc13783-adc.c +26 -23
@@ -63,8 +63,9 @@ static int mc13783_adc_read(struct device *dev,return 0 ; } -static ssize_t mc13783_adc_read_bp (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t mc13783_adc_bp_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {unsigned val;struct platform_device *pdev =to_platform_device (dev);
@@ -86,8 +87,9 @@ static ssize_t mc13783_adc_read_bp(struct device *dev,return sprintf (buf,"%u\n" , val); } -static ssize_t mc13783_adc_read_gp (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t mc13783_adc_gp_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {unsigned val;int ret =mc13783_adc_read (dev, devattr, &val);
@@ -104,8 +106,9 @@ static ssize_t mc13783_adc_read_gp(struct device *dev,return sprintf (buf,"%u\n" , val); } -static ssize_t mc13783_adc_read_uid (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t mc13783_adc_uid_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {unsigned int val;struct platform_device *pdev =to_platform_device (dev);
@@ -125,8 +128,9 @@ static ssize_t mc13783_adc_read_uid(struct device *dev,return sprintf (buf,"%u\n" , val); } -static ssize_t mc13783_adc_read_temp (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t mc13783_adc_temp_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {unsigned int val;struct platform_device *pdev =to_platform_device (dev);
@@ -156,21 +160,20 @@ static ssize_t mc13783_adc_read_temp(struct device *dev, }static DEVICE_ATTR_RO (name); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, mc13783_adc_read_bp, NULL, 2); -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, mc13783_adc_read_gp, NULL, 5); -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, mc13783_adc_read_gp, NULL, 6); -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, mc13783_adc_read_gp, NULL, 7); -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, mc13783_adc_read_gp, NULL, 8); -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, mc13783_adc_read_gp, NULL, 9); -static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, mc13783_adc_read_gp, NULL, 10); -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, mc13783_adc_read_gp, NULL, 11); -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12); -static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, mc13783_adc_read_gp, NULL, 13); -static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, mc13783_adc_read_gp, NULL, 14); -static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, mc13783_adc_read_gp, NULL, 15); -static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, mc13783_adc_read_uid, NULL, 16); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, - mc13783_adc_read_temp, NULL, 17); +static SENSOR_DEVICE_ATTR_RO(in2_input, mc13783_adc_bp, 2); +static SENSOR_DEVICE_ATTR_RO(in5_input, mc13783_adc_gp, 5); +static SENSOR_DEVICE_ATTR_RO(in6_input, mc13783_adc_gp, 6); +static SENSOR_DEVICE_ATTR_RO(in7_input, mc13783_adc_gp, 7); +static SENSOR_DEVICE_ATTR_RO(in8_input, mc13783_adc_gp, 8); +static SENSOR_DEVICE_ATTR_RO(in9_input, mc13783_adc_gp, 9); +static SENSOR_DEVICE_ATTR_RO(in10_input, mc13783_adc_gp, 10); +static SENSOR_DEVICE_ATTR_RO(in11_input, mc13783_adc_gp, 11); +static SENSOR_DEVICE_ATTR_RO(in12_input, mc13783_adc_gp, 12); +static SENSOR_DEVICE_ATTR_RO(in13_input, mc13783_adc_gp, 13); +static SENSOR_DEVICE_ATTR_RO(in14_input, mc13783_adc_gp, 14); +static SENSOR_DEVICE_ATTR_RO(in15_input, mc13783_adc_gp, 15); +static SENSOR_DEVICE_ATTR_RO(in16_input, mc13783_adc_uid, 16); +static SENSOR_DEVICE_ATTR_RO(temp1_input, mc13783_adc_temp, 17);static struct attribute *mc13783_attr_base[] = { &dev_attr_name.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 10/30 hwmon: (nct7904) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/nct7904.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/nct7904.c +5 -5
@@ -182,7 +182,7 @@ static umode_t nct7904_fan_is_visible(const void *_data, u32 attr, int channel)const struct nct7904_data *data = _data;if (attr == hwmon_fan_input && data->fanin_mask & (1 << channel)) -return S_IRUGO ; +return 0444 ;return 0 ; }
@@ -225,7 +225,7 @@ static umode_t nct7904_in_is_visible(const void *_data, u32 attr, int channel)if (channel >0 && attr == hwmon_in_input && (data->vsen_mask &BIT (index))) -return S_IRUGO ; +return 0444 ;return 0 ; }
@@ -260,10 +260,10 @@ static umode_t nct7904_temp_is_visible(const void *_data, u32 attr, int channel)if (attr == hwmon_temp_input) {if (channel ==0 ) {if (data->vsen_mask &BIT (17 )) -return S_IRUGO ; +return 0444 ; }else {if (data->tcpu_mask &BIT (channel -1 )) -return S_IRUGO ; +return 0444 ; } }
@@ -325,7 +325,7 @@ static umode_t nct7904_pwm_is_visible(const void *_data, u32 attr, int channel)switch (attr) {case hwmon_pwm_input:case hwmon_pwm_enable: -return S_IRUGO |S_IWUSR ; +return 0644 ;default :return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 11/30 hwmon: (nsa320-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/nsa320-hwmon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/nsa320-hwmon.c +4 -4
@@ -114,8 +114,8 @@ static s32 nsa320_hwmon_update(struct device *dev)return mcu_data; } -static ssize_t show_label (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t label_show (struct device *dev,struct device_attribute *attr, +char *buf) {int channel =to_sensor_dev_attr (attr)->index;
@@ -144,9 +144,9 @@ static ssize_t fan1_input_show(struct device *dev,return sprintf (buf,"%d\n" , ((mcu_data &0xff0000 ) >>16 ) *100 ); } -static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP); +static SENSOR_DEVICE_ATTR_RO(temp1_label, label, NSA320_TEMP);static DEVICE_ATTR_RO (temp1_input); -static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN); +static SENSOR_DEVICE_ATTR_RO(fan1_label, label, NSA320_FAN);static DEVICE_ATTR_RO (fan1_input);static struct attribute *nsa320_attrs[] = {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 12/30 hwmon: (pc87360) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/pc87360.c | 427 +++++++++++++++++++++++------------------------- 1 file changed, 204 insertions(+), 223 deletions(-)
drivers/hwmon/pc87360.c +204 -223
@@ -254,7 +254,7 @@ static struct platform_driver pc87360_driver = {* Sysfs stuff */ -static ssize_t show_fan_input (struct device *dev, +static ssize_t fan_input_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -262,7 +262,7 @@ static ssize_t show_fan_input(struct device *dev,return sprintf (buf,"%u\n" ,FAN_FROM_REG (data->fan[attr->index],FAN_DIV_FROM_REG (data->fan_status[attr->index]))); } -static ssize_t show_fan_min (struct device *dev, +static ssize_t fan_min_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -270,7 +270,7 @@ static ssize_t show_fan_min(struct device *dev,return sprintf (buf,"%u\n" ,FAN_FROM_REG (data->fan_min[attr->index],FAN_DIV_FROM_REG (data->fan_status[attr->index]))); } -static ssize_t show_fan_div (struct device *dev, +static ssize_t fan_div_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -278,7 +278,7 @@ static ssize_t show_fan_div(struct device *dev,return sprintf (buf,"%u\n" ,FAN_DIV_FROM_REG (data->fan_status[attr->index])); } -static ssize_t show_fan_status (struct device *dev, +static ssize_t fan_status_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -286,9 +286,9 @@ static ssize_t show_fan_status(struct device *dev,return sprintf (buf,"%u\n" ,FAN_STATUS_FROM_REG (data->fan_status[attr->index])); } -static ssize_t set_fan_min (struct device *dev, -struct device_attribute *devattr,const char *buf, -size_t count) +static ssize_t fan_min_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -325,24 +325,24 @@ static ssize_t set_fan_min(struct device *dev, }static struct sensor_device_attribute fan_input[] = { -SENSOR_ATTR (fan1_input,S_IRUGO , show_fan_input,NULL ,0 ), -SENSOR_ATTR (fan2_input,S_IRUGO , show_fan_input,NULL ,1 ), -SENSOR_ATTR (fan3_input,S_IRUGO , show_fan_input,NULL ,2 ), +SENSOR_ATTR_RO (fan1_input, fan_input,0 ), +SENSOR_ATTR_RO (fan2_input, fan_input,1 ), +SENSOR_ATTR_RO (fan3_input, fan_input,2 ), };static struct sensor_device_attribute fan_status[] = { -SENSOR_ATTR (fan1_status,S_IRUGO , show_fan_status,NULL ,0 ), -SENSOR_ATTR (fan2_status,S_IRUGO , show_fan_status,NULL ,1 ), -SENSOR_ATTR (fan3_status,S_IRUGO , show_fan_status,NULL ,2 ), +SENSOR_ATTR_RO (fan1_status, fan_status,0 ), +SENSOR_ATTR_RO (fan2_status, fan_status,1 ), +SENSOR_ATTR_RO (fan3_status, fan_status,2 ), };static struct sensor_device_attribute fan_div[] = { -SENSOR_ATTR (fan1_div,S_IRUGO , show_fan_div,NULL ,0 ), -SENSOR_ATTR (fan2_div,S_IRUGO , show_fan_div,NULL ,1 ), -SENSOR_ATTR (fan3_div,S_IRUGO , show_fan_div,NULL ,2 ), +SENSOR_ATTR_RO (fan1_div, fan_div,0 ), +SENSOR_ATTR_RO (fan2_div, fan_div,1 ), +SENSOR_ATTR_RO (fan3_div, fan_div,2 ), };static struct sensor_device_attribute fan_min[] = { -SENSOR_ATTR (fan1_min,S_IWUSR |S_IRUGO , show_fan_min, set_fan_min,0 ), -SENSOR_ATTR (fan2_min,S_IWUSR |S_IRUGO , show_fan_min, set_fan_min,1 ), -SENSOR_ATTR (fan3_min,S_IWUSR |S_IRUGO , show_fan_min, set_fan_min,2 ), +SENSOR_ATTR_RW (fan1_min, fan_min,0 ), +SENSOR_ATTR_RW (fan2_min, fan_min,1 ), +SENSOR_ATTR_RW (fan3_min, fan_min,2 ), };#define FAN_UNIT_ATTRS (X ) \
@@ -353,7 +353,7 @@ static struct sensor_device_attribute fan_min[] = { NULL \ } -static ssize_t show_pwm (struct device *dev,struct device_attribute *devattr, +static ssize_t pwm_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -363,8 +363,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr,FAN_CONFIG_INVERT (data->fan_conf, attr->index))); } -static ssize_t set_pwm (struct device *dev,struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t pwm_store (struct device *dev,struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -385,9 +385,9 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, }static struct sensor_device_attribute pwm[] = { -SENSOR_ATTR (pwm1,S_IWUSR |S_IRUGO , show_pwm, set_pwm,0 ), -SENSOR_ATTR (pwm2,S_IWUSR |S_IRUGO , show_pwm, set_pwm,1 ), -SENSOR_ATTR (pwm3,S_IWUSR |S_IRUGO , show_pwm, set_pwm,2 ), +SENSOR_ATTR_RW (pwm1, pwm,0 ), +SENSOR_ATTR_RW (pwm2, pwm,1 ), +SENSOR_ATTR_RW (pwm3, pwm,2 ), };static struct attribute *pc8736x_fan_attr[][5 ] = {
@@ -402,7 +402,7 @@ static const struct attribute_group pc8736x_fan_attr_group[] = { { .attrs = pc8736x_fan_attr[2], }, }; -static ssize_t show_in_input (struct device *dev, +static ssize_t in_input_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -410,7 +410,7 @@ static ssize_t show_in_input(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in[attr->index], data->in_vref)); } -static ssize_t show_in_min (struct device *dev, +static ssize_t in_min_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -418,7 +418,7 @@ static ssize_t show_in_min(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in_min[attr->index], data->in_vref)); } -static ssize_t show_in_max (struct device *dev, +static ssize_t in_max_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -426,15 +426,16 @@ static ssize_t show_in_max(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in_max[attr->index], data->in_vref)); } -static ssize_t show_in_status (struct device *dev, +static ssize_t in_status_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =pc87360_update_device (dev);return sprintf (buf,"%u\n" , data->in_status[attr->index]); } -static ssize_t set_in_min (struct device *dev,struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t in_min_store (struct device *dev, +struct device_attribute *devattr,const char *buf, +size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -452,8 +453,9 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *devattr,mutex_unlock (&data->update_lock);return count; } -static ssize_t set_in_max (struct device *dev,struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t in_max_store (struct device *dev, +struct device_attribute *devattr,const char *buf, +size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -474,56 +476,56 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *devattr, }static struct sensor_device_attribute in_input[] = { -SENSOR_ATTR (in0_input,S_IRUGO , show_in_input,NULL ,0 ), -SENSOR_ATTR (in1_input,S_IRUGO , show_in_input,NULL ,1 ), -SENSOR_ATTR (in2_input,S_IRUGO , show_in_input,NULL ,2 ), -SENSOR_ATTR (in3_input,S_IRUGO , show_in_input,NULL ,3 ), -SENSOR_ATTR (in4_input,S_IRUGO , show_in_input,NULL ,4 ), -SENSOR_ATTR (in5_input,S_IRUGO , show_in_input,NULL ,5 ), -SENSOR_ATTR (in6_input,S_IRUGO , show_in_input,NULL ,6 ), -SENSOR_ATTR (in7_input,S_IRUGO , show_in_input,NULL ,7 ), -SENSOR_ATTR (in8_input,S_IRUGO , show_in_input,NULL ,8 ), -SENSOR_ATTR (in9_input,S_IRUGO , show_in_input,NULL ,9 ), -SENSOR_ATTR (in10_input,S_IRUGO , show_in_input,NULL ,10 ), +SENSOR_ATTR_RO (in0_input, in_input,0 ), +SENSOR_ATTR_RO (in1_input, in_input,1 ), +SENSOR_ATTR_RO (in2_input, in_input,2 ), +SENSOR_ATTR_RO (in3_input, in_input,3 ), +SENSOR_ATTR_RO (in4_input, in_input,4 ), +SENSOR_ATTR_RO (in5_input, in_input,5 ), +SENSOR_ATTR_RO (in6_input, in_input,6 ), +SENSOR_ATTR_RO (in7_input, in_input,7 ), +SENSOR_ATTR_RO (in8_input, in_input,8 ), +SENSOR_ATTR_RO (in9_input, in_input,9 ), +SENSOR_ATTR_RO (in10_input, in_input,10 ), };static struct sensor_device_attribute in_status[] = { -SENSOR_ATTR (in0_status,S_IRUGO , show_in_status,NULL ,0 ), -SENSOR_ATTR (in1_status,S_IRUGO , show_in_status,NULL ,1 ), -SENSOR_ATTR (in2_status,S_IRUGO , show_in_status,NULL ,2 ), -SENSOR_ATTR (in3_status,S_IRUGO , show_in_status,NULL ,3 ), -SENSOR_ATTR (in4_status,S_IRUGO , show_in_status,NULL ,4 ), -SENSOR_ATTR (in5_status,S_IRUGO , show_in_status,NULL ,5 ), -SENSOR_ATTR (in6_status,S_IRUGO , show_in_status,NULL ,6 ), -SENSOR_ATTR (in7_status,S_IRUGO , show_in_status,NULL ,7 ), -SENSOR_ATTR (in8_status,S_IRUGO , show_in_status,NULL ,8 ), -SENSOR_ATTR (in9_status,S_IRUGO , show_in_status,NULL ,9 ), -SENSOR_ATTR (in10_status,S_IRUGO , show_in_status,NULL ,10 ), +SENSOR_ATTR_RO (in0_status, in_status,0 ), +SENSOR_ATTR_RO (in1_status, in_status,1 ), +SENSOR_ATTR_RO (in2_status, in_status,2 ), +SENSOR_ATTR_RO (in3_status, in_status,3 ), +SENSOR_ATTR_RO (in4_status, in_status,4 ), +SENSOR_ATTR_RO (in5_status, in_status,5 ), +SENSOR_ATTR_RO (in6_status, in_status,6 ), +SENSOR_ATTR_RO (in7_status, in_status,7 ), +SENSOR_ATTR_RO (in8_status, in_status,8 ), +SENSOR_ATTR_RO (in9_status, in_status,9 ), +SENSOR_ATTR_RO (in10_status, in_status,10 ), };static struct sensor_device_attribute in_min[] = { -SENSOR_ATTR (in0_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,0 ), -SENSOR_ATTR (in1_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,1 ), -SENSOR_ATTR (in2_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,2 ), -SENSOR_ATTR (in3_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,3 ), -SENSOR_ATTR (in4_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,4 ), -SENSOR_ATTR (in5_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,5 ), -SENSOR_ATTR (in6_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,6 ), -SENSOR_ATTR (in7_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,7 ), -SENSOR_ATTR (in8_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,8 ), -SENSOR_ATTR (in9_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,9 ), -SENSOR_ATTR (in10_min,S_IWUSR |S_IRUGO , show_in_min, set_in_min,10 ), +SENSOR_ATTR_RW (in0_min, in_min,0 ), +SENSOR_ATTR_RW (in1_min, in_min,1 ), +SENSOR_ATTR_RW (in2_min, in_min,2 ), +SENSOR_ATTR_RW (in3_min, in_min,3 ), +SENSOR_ATTR_RW (in4_min, in_min,4 ), +SENSOR_ATTR_RW (in5_min, in_min,5 ), +SENSOR_ATTR_RW (in6_min, in_min,6 ), +SENSOR_ATTR_RW (in7_min, in_min,7 ), +SENSOR_ATTR_RW (in8_min, in_min,8 ), +SENSOR_ATTR_RW (in9_min, in_min,9 ), +SENSOR_ATTR_RW (in10_min, in_min,10 ), };static struct sensor_device_attribute in_max[] = { -SENSOR_ATTR (in0_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,0 ), -SENSOR_ATTR (in1_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,1 ), -SENSOR_ATTR (in2_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,2 ), -SENSOR_ATTR (in3_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,3 ), -SENSOR_ATTR (in4_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,4 ), -SENSOR_ATTR (in5_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,5 ), -SENSOR_ATTR (in6_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,6 ), -SENSOR_ATTR (in7_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,7 ), -SENSOR_ATTR (in8_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,8 ), -SENSOR_ATTR (in9_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,9 ), -SENSOR_ATTR (in10_max,S_IWUSR |S_IRUGO , show_in_max, set_in_max,10 ), +SENSOR_ATTR_RW (in0_max, in_max,0 ), +SENSOR_ATTR_RW (in1_max, in_max,1 ), +SENSOR_ATTR_RW (in2_max, in_max,2 ), +SENSOR_ATTR_RW (in3_max, in_max,3 ), +SENSOR_ATTR_RW (in4_max, in_max,4 ), +SENSOR_ATTR_RW (in5_max, in_max,5 ), +SENSOR_ATTR_RW (in6_max, in_max,6 ), +SENSOR_ATTR_RW (in7_max, in_max,7 ), +SENSOR_ATTR_RW (in8_max, in_max,8 ), +SENSOR_ATTR_RW (in9_max, in_max,9 ), +SENSOR_ATTR_RW (in10_max, in_max,10 ), };/* (temp & vin) channel status register alarm bits (pdf sec.11.5.12) */
@@ -537,16 +539,16 @@ static struct sensor_device_attribute in_max[] = {* 11.5.2) that (legacy) show_in_alarm() resds (via data->in_alarms) */ -static ssize_t show_in_min_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t in_min_alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;return sprintf (buf,"%u\n" , !!(data->in_status[nr] &CHAN_ALM_MIN )); } -static ssize_t show_in_max_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t in_max_alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -555,30 +557,30 @@ static ssize_t show_in_max_alarm(struct device *dev, }static struct sensor_device_attribute in_min_alarm[] = { -SENSOR_ATTR (in0_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,0 ), -SENSOR_ATTR (in1_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,1 ), -SENSOR_ATTR (in2_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,2 ), -SENSOR_ATTR (in3_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,3 ), -SENSOR_ATTR (in4_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,4 ), -SENSOR_ATTR (in5_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,5 ), -SENSOR_ATTR (in6_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,6 ), -SENSOR_ATTR (in7_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,7 ), -SENSOR_ATTR (in8_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,8 ), -SENSOR_ATTR (in9_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,9 ), -SENSOR_ATTR (in10_min_alarm,S_IRUGO , show_in_min_alarm,NULL ,10 ), +SENSOR_ATTR_RO (in0_min_alarm, in_min_alarm,0 ), +SENSOR_ATTR_RO (in1_min_alarm, in_min_alarm,1 ), +SENSOR_ATTR_RO (in2_min_alarm, in_min_alarm,2 ), +SENSOR_ATTR_RO (in3_min_alarm, in_min_alarm,3 ), +SENSOR_ATTR_RO (in4_min_alarm, in_min_alarm,4 ), +SENSOR_ATTR_RO (in5_min_alarm, in_min_alarm,5 ), +SENSOR_ATTR_RO (in6_min_alarm, in_min_alarm,6 ), +SENSOR_ATTR_RO (in7_min_alarm, in_min_alarm,7 ), +SENSOR_ATTR_RO (in8_min_alarm, in_min_alarm,8 ), +SENSOR_ATTR_RO (in9_min_alarm, in_min_alarm,9 ), +SENSOR_ATTR_RO (in10_min_alarm, in_min_alarm,10 ), };static struct sensor_device_attribute in_max_alarm[] = { -SENSOR_ATTR (in0_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,0 ), -SENSOR_ATTR (in1_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,1 ), -SENSOR_ATTR (in2_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,2 ), -SENSOR_ATTR (in3_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,3 ), -SENSOR_ATTR (in4_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,4 ), -SENSOR_ATTR (in5_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,5 ), -SENSOR_ATTR (in6_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,6 ), -SENSOR_ATTR (in7_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,7 ), -SENSOR_ATTR (in8_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,8 ), -SENSOR_ATTR (in9_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,9 ), -SENSOR_ATTR (in10_max_alarm,S_IRUGO , show_in_max_alarm,NULL ,10 ), +SENSOR_ATTR_RO (in0_max_alarm, in_max_alarm,0 ), +SENSOR_ATTR_RO (in1_max_alarm, in_max_alarm,1 ), +SENSOR_ATTR_RO (in2_max_alarm, in_max_alarm,2 ), +SENSOR_ATTR_RO (in3_max_alarm, in_max_alarm,3 ), +SENSOR_ATTR_RO (in4_max_alarm, in_max_alarm,4 ), +SENSOR_ATTR_RO (in5_max_alarm, in_max_alarm,5 ), +SENSOR_ATTR_RO (in6_max_alarm, in_max_alarm,6 ), +SENSOR_ATTR_RO (in7_max_alarm, in_max_alarm,7 ), +SENSOR_ATTR_RO (in8_max_alarm, in_max_alarm,8 ), +SENSOR_ATTR_RO (in9_max_alarm, in_max_alarm,9 ), +SENSOR_ATTR_RO (in10_max_alarm, in_max_alarm,10 ), };#define VIN_UNIT_ATTRS (X ) \
@@ -651,7 +653,7 @@ static const struct attribute_group pc8736x_vin_group = { .attrs = pc8736x_vin_attr_array, }; -static ssize_t show_therm_input (struct device *dev, +static ssize_t therm_input_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -659,7 +661,7 @@ static ssize_t show_therm_input(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in[attr->index], data->in_vref)); } -static ssize_t show_therm_min (struct device *dev, +static ssize_t therm_min_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -667,7 +669,7 @@ static ssize_t show_therm_min(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in_min[attr->index], data->in_vref)); } -static ssize_t show_therm_max (struct device *dev, +static ssize_t therm_max_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -675,7 +677,7 @@ static ssize_t show_therm_max(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in_max[attr->index], data->in_vref)); } -static ssize_t show_therm_crit (struct device *dev, +static ssize_t therm_crit_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -683,7 +685,7 @@ static ssize_t show_therm_crit(struct device *dev,return sprintf (buf,"%u\n" ,IN_FROM_REG (data->in_crit[attr->index-11 ], data->in_vref)); } -static ssize_t show_therm_status (struct device *dev, +static ssize_t therm_status_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -691,9 +693,9 @@ static ssize_t show_therm_status(struct device *dev,return sprintf (buf,"%u\n" , data->in_status[attr->index]); } -static ssize_t set_therm_min (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t therm_min_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -712,9 +714,9 @@ static ssize_t set_therm_min(struct device *dev,return count; } -static ssize_t set_therm_max (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t therm_max_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -732,9 +734,9 @@ static ssize_t set_therm_max(struct device *dev,mutex_unlock (&data->update_lock);return count; } -static ssize_t set_therm_crit (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t therm_crit_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -758,38 +760,29 @@ static ssize_t set_therm_crit(struct device *dev,* used in the chip to measure voltage across the thermistors */ static struct sensor_device_attribute therm_input[] = { -SENSOR_ATTR (temp4_input,S_IRUGO , show_therm_input,NULL ,0 +11 ), -SENSOR_ATTR (temp5_input,S_IRUGO , show_therm_input,NULL ,1 +11 ), -SENSOR_ATTR (temp6_input,S_IRUGO , show_therm_input,NULL ,2 +11 ), +SENSOR_ATTR_RO (temp4_input, therm_input,0 +11 ), +SENSOR_ATTR_RO (temp5_input, therm_input,1 +11 ), +SENSOR_ATTR_RO (temp6_input, therm_input,2 +11 ), };static struct sensor_device_attribute therm_status[] = { -SENSOR_ATTR (temp4_status,S_IRUGO , show_therm_status,NULL ,0 +11 ), -SENSOR_ATTR (temp5_status,S_IRUGO , show_therm_status,NULL ,1 +11 ), -SENSOR_ATTR (temp6_status,S_IRUGO , show_therm_status,NULL ,2 +11 ), +SENSOR_ATTR_RO (temp4_status, therm_status,0 +11 ), +SENSOR_ATTR_RO (temp5_status, therm_status,1 +11 ), +SENSOR_ATTR_RO (temp6_status, therm_status,2 +11 ), };static struct sensor_device_attribute therm_min[] = { -SENSOR_ATTR (temp4_min,S_IRUGO |S_IWUSR , - show_therm_min, set_therm_min,0 +11 ), -SENSOR_ATTR (temp5_min,S_IRUGO |S_IWUSR , - show_therm_min, set_therm_min,1 +11 ), -SENSOR_ATTR (temp6_min,S_IRUGO |S_IWUSR , - show_therm_min, set_therm_min,2 +11 ), +SENSOR_ATTR_RW (temp4_min, therm_min,0 +11 ), +SENSOR_ATTR_RW (temp5_min, therm_min,1 +11 ), +SENSOR_ATTR_RW (temp6_min, therm_min,2 +11 ), };static struct sensor_device_attribute therm_max[] = { -SENSOR_ATTR (temp4_max,S_IRUGO |S_IWUSR , - show_therm_max, set_therm_max,0 +11 ), -SENSOR_ATTR (temp5_max,S_IRUGO |S_IWUSR , - show_therm_max, set_therm_max,1 +11 ), -SENSOR_ATTR (temp6_max,S_IRUGO |S_IWUSR , - show_therm_max, set_therm_max,2 +11 ), +SENSOR_ATTR_RW (temp4_max, therm_max,0 +11 ), +SENSOR_ATTR_RW (temp5_max, therm_max,1 +11 ), +SENSOR_ATTR_RW (temp6_max, therm_max,2 +11 ), };static struct sensor_device_attribute therm_crit[] = { -SENSOR_ATTR (temp4_crit,S_IRUGO |S_IWUSR , - show_therm_crit, set_therm_crit,0 +11 ), -SENSOR_ATTR (temp5_crit,S_IRUGO |S_IWUSR , - show_therm_crit, set_therm_crit,1 +11 ), -SENSOR_ATTR (temp6_crit,S_IRUGO |S_IWUSR , - show_therm_crit, set_therm_crit,2 +11 ), +SENSOR_ATTR_RW (temp4_crit, therm_crit,0 +11 ), +SENSOR_ATTR_RW (temp5_crit, therm_crit,1 +11 ), +SENSOR_ATTR_RW (temp6_crit, therm_crit,2 +11 ), };/*
@@ -797,24 +790,27 @@ static struct sensor_device_attribute therm_crit[] = {* status register (sec 11.5.12) */ -static ssize_t show_therm_min_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t therm_min_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;return sprintf (buf,"%u\n" , !!(data->in_status[nr] &CHAN_ALM_MIN )); } -static ssize_t show_therm_max_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t therm_max_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;return sprintf (buf,"%u\n" , !!(data->in_status[nr] &CHAN_ALM_MAX )); } -static ssize_t show_therm_crit_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t therm_crit_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -823,28 +819,19 @@ static ssize_t show_therm_crit_alarm(struct device *dev, }static struct sensor_device_attribute therm_min_alarm[] = { -SENSOR_ATTR (temp4_min_alarm,S_IRUGO , - show_therm_min_alarm,NULL ,0 +11 ), -SENSOR_ATTR (temp5_min_alarm,S_IRUGO , - show_therm_min_alarm,NULL ,1 +11 ), -SENSOR_ATTR (temp6_min_alarm,S_IRUGO , - show_therm_min_alarm,NULL ,2 +11 ), +SENSOR_ATTR_RO (temp4_min_alarm, therm_min_alarm,0 +11 ), +SENSOR_ATTR_RO (temp5_min_alarm, therm_min_alarm,1 +11 ), +SENSOR_ATTR_RO (temp6_min_alarm, therm_min_alarm,2 +11 ), };static struct sensor_device_attribute therm_max_alarm[] = { -SENSOR_ATTR (temp4_max_alarm,S_IRUGO , - show_therm_max_alarm,NULL ,0 +11 ), -SENSOR_ATTR (temp5_max_alarm,S_IRUGO , - show_therm_max_alarm,NULL ,1 +11 ), -SENSOR_ATTR (temp6_max_alarm,S_IRUGO , - show_therm_max_alarm,NULL ,2 +11 ), +SENSOR_ATTR_RO (temp4_max_alarm, therm_max_alarm,0 +11 ), +SENSOR_ATTR_RO (temp5_max_alarm, therm_max_alarm,1 +11 ), +SENSOR_ATTR_RO (temp6_max_alarm, therm_max_alarm,2 +11 ), };static struct sensor_device_attribute therm_crit_alarm[] = { -SENSOR_ATTR (temp4_crit_alarm,S_IRUGO , - show_therm_crit_alarm,NULL ,0 +11 ), -SENSOR_ATTR (temp5_crit_alarm,S_IRUGO , - show_therm_crit_alarm,NULL ,1 +11 ), -SENSOR_ATTR (temp6_crit_alarm,S_IRUGO , - show_therm_crit_alarm,NULL ,2 +11 ), +SENSOR_ATTR_RO (temp4_crit_alarm, therm_crit_alarm,0 +11 ), +SENSOR_ATTR_RO (temp5_crit_alarm, therm_crit_alarm,1 +11 ), +SENSOR_ATTR_RO (temp6_crit_alarm, therm_crit_alarm,2 +11 ), };#define THERM_UNIT_ATTRS (X ) \
@@ -867,7 +854,7 @@ static const struct attribute_group pc8736x_therm_group = { .attrs = pc8736x_therm_attr_array, }; -static ssize_t show_temp_input (struct device *dev, +static ssize_t temp_input_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -875,7 +862,7 @@ static ssize_t show_temp_input(struct device *dev,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp[attr->index])); } -static ssize_t show_temp_min (struct device *dev, +static ssize_t temp_min_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -883,7 +870,7 @@ static ssize_t show_temp_min(struct device *dev,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_min[attr->index])); } -static ssize_t show_temp_max (struct device *dev, +static ssize_t temp_max_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -891,7 +878,7 @@ static ssize_t show_temp_max(struct device *dev,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_max[attr->index])); } -static ssize_t show_temp_crit (struct device *dev, +static ssize_t temp_crit_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -900,7 +887,7 @@ static ssize_t show_temp_crit(struct device *dev, TEMP_FROM_REG(data->temp_crit[attr->index])); } -static ssize_t show_temp_status (struct device *dev, +static ssize_t temp_status_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -908,9 +895,9 @@ static ssize_t show_temp_status(struct device *dev,return sprintf (buf,"%d\n" , data->temp_status[attr->index]); } -static ssize_t set_temp_min (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t temp_min_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -929,9 +916,9 @@ static ssize_t set_temp_min(struct device *dev,return count; } -static ssize_t set_temp_max (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t temp_max_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -950,9 +937,9 @@ static ssize_t set_temp_max(struct device *dev,return count; } -static ssize_t set_temp_crit (struct device *dev, -struct device_attribute *devattr,const char *buf, -size_t count) +static ssize_t temp_crit_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct pc87360_data *data =dev_get_drvdata (dev);
@@ -972,38 +959,29 @@ static ssize_t set_temp_crit(struct device *dev, }static struct sensor_device_attribute temp_input[] = { -SENSOR_ATTR (temp1_input,S_IRUGO , show_temp_input,NULL ,0 ), -SENSOR_ATTR (temp2_input,S_IRUGO , show_temp_input,NULL ,1 ), -SENSOR_ATTR (temp3_input,S_IRUGO , show_temp_input,NULL ,2 ), +SENSOR_ATTR_RO (temp1_input, temp_input,0 ), +SENSOR_ATTR_RO (temp2_input, temp_input,1 ), +SENSOR_ATTR_RO (temp3_input, temp_input,2 ), };static struct sensor_device_attribute temp_status[] = { -SENSOR_ATTR (temp1_status,S_IRUGO , show_temp_status,NULL ,0 ), -SENSOR_ATTR (temp2_status,S_IRUGO , show_temp_status,NULL ,1 ), -SENSOR_ATTR (temp3_status,S_IRUGO , show_temp_status,NULL ,2 ), +SENSOR_ATTR_RO (temp1_status, temp_status,0 ), +SENSOR_ATTR_RO (temp2_status, temp_status,1 ), +SENSOR_ATTR_RO (temp3_status, temp_status,2 ), };static struct sensor_device_attribute temp_min[] = { -SENSOR_ATTR (temp1_min,S_IRUGO |S_IWUSR , - show_temp_min, set_temp_min,0 ), -SENSOR_ATTR (temp2_min,S_IRUGO |S_IWUSR , - show_temp_min, set_temp_min,1 ), -SENSOR_ATTR (temp3_min,S_IRUGO |S_IWUSR , - show_temp_min, set_temp_min,2 ), +SENSOR_ATTR_RW (temp1_min, temp_min,0 ), +SENSOR_ATTR_RW (temp2_min, temp_min,1 ), +SENSOR_ATTR_RW (temp3_min, temp_min,2 ), };static struct sensor_device_attribute temp_max[] = { -SENSOR_ATTR (temp1_max,S_IRUGO |S_IWUSR , - show_temp_max, set_temp_max,0 ), -SENSOR_ATTR (temp2_max,S_IRUGO |S_IWUSR , - show_temp_max, set_temp_max,1 ), -SENSOR_ATTR (temp3_max,S_IRUGO |S_IWUSR , - show_temp_max, set_temp_max,2 ), +SENSOR_ATTR_RW (temp1_max, temp_max,0 ), +SENSOR_ATTR_RW (temp2_max, temp_max,1 ), +SENSOR_ATTR_RW (temp3_max, temp_max,2 ), };static struct sensor_device_attribute temp_crit[] = { -SENSOR_ATTR (temp1_crit,S_IRUGO |S_IWUSR , - show_temp_crit, set_temp_crit,0 ), -SENSOR_ATTR (temp2_crit,S_IRUGO |S_IWUSR , - show_temp_crit, set_temp_crit,1 ), -SENSOR_ATTR (temp3_crit,S_IRUGO |S_IWUSR , - show_temp_crit, set_temp_crit,2 ), +SENSOR_ATTR_RW (temp1_crit, temp_crit,0 ), +SENSOR_ATTR_RW (temp2_crit, temp_crit,1 ), +SENSOR_ATTR_RW (temp3_crit, temp_crit,2 ), }; static ssize_t alarms_temp_show(struct device *dev,
@@ -1021,8 +999,9 @@ static DEVICE_ATTR_RO(alarms_temp);* 12.3.2) that show_temp_alarm() reads (via data->temp_alarms) */ -static ssize_t show_temp_min_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t temp_min_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -1030,8 +1009,9 @@ static ssize_t show_temp_min_alarm(struct device *dev,return sprintf (buf,"%u\n" , !!(data->temp_status[nr] &CHAN_ALM_MIN )); } -static ssize_t show_temp_max_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t temp_max_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -1039,8 +1019,9 @@ static ssize_t show_temp_max_alarm(struct device *dev,return sprintf (buf,"%u\n" , !!(data->temp_status[nr] &CHAN_ALM_MAX )); } -static ssize_t show_temp_crit_alarm (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t temp_crit_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -1049,26 +1030,26 @@ static ssize_t show_temp_crit_alarm(struct device *dev, }static struct sensor_device_attribute temp_min_alarm[] = { -SENSOR_ATTR (temp1_min_alarm,S_IRUGO , show_temp_min_alarm,NULL ,0 ), -SENSOR_ATTR (temp2_min_alarm,S_IRUGO , show_temp_min_alarm,NULL ,1 ), -SENSOR_ATTR (temp3_min_alarm,S_IRUGO , show_temp_min_alarm,NULL ,2 ), +SENSOR_ATTR_RO (temp1_min_alarm, temp_min_alarm,0 ), +SENSOR_ATTR_RO (temp2_min_alarm, temp_min_alarm,1 ), +SENSOR_ATTR_RO (temp3_min_alarm, temp_min_alarm,2 ), };static struct sensor_device_attribute temp_max_alarm[] = { -SENSOR_ATTR (temp1_max_alarm,S_IRUGO , show_temp_max_alarm,NULL ,0 ), -SENSOR_ATTR (temp2_max_alarm,S_IRUGO , show_temp_max_alarm,NULL ,1 ), -SENSOR_ATTR (temp3_max_alarm,S_IRUGO , show_temp_max_alarm,NULL ,2 ), +SENSOR_ATTR_RO (temp1_max_alarm, temp_max_alarm,0 ), +SENSOR_ATTR_RO (temp2_max_alarm, temp_max_alarm,1 ), +SENSOR_ATTR_RO (temp3_max_alarm, temp_max_alarm,2 ), };static struct sensor_device_attribute temp_crit_alarm[] = { -SENSOR_ATTR (temp1_crit_alarm,S_IRUGO , show_temp_crit_alarm,NULL ,0 ), -SENSOR_ATTR (temp2_crit_alarm,S_IRUGO , show_temp_crit_alarm,NULL ,1 ), -SENSOR_ATTR (temp3_crit_alarm,S_IRUGO , show_temp_crit_alarm,NULL ,2 ), +SENSOR_ATTR_RO (temp1_crit_alarm, temp_crit_alarm,0 ), +SENSOR_ATTR_RO (temp2_crit_alarm, temp_crit_alarm,1 ), +SENSOR_ATTR_RO (temp3_crit_alarm, temp_crit_alarm,2 ), };#define TEMP_FAULT 0x40/* open diode */ -static ssize_t show_temp_fault (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t temp_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87360_data *data =pc87360_update_device (dev);unsigned nr =to_sensor_dev_attr (devattr)->index;
@@ -1076,9 +1057,9 @@ static ssize_t show_temp_fault(struct device *dev,return sprintf (buf,"%u\n" , !!(data->temp_status[nr] &TEMP_FAULT )); }static struct sensor_device_attribute temp_fault[] = { -SENSOR_ATTR (temp1_fault,S_IRUGO , show_temp_fault,NULL ,0 ), -SENSOR_ATTR (temp2_fault,S_IRUGO , show_temp_fault,NULL ,1 ), -SENSOR_ATTR (temp3_fault,S_IRUGO , show_temp_fault,NULL ,2 ), +SENSOR_ATTR_RO (temp1_fault, temp_fault,0 ), +SENSOR_ATTR_RO (temp2_fault, temp_fault,1 ), +SENSOR_ATTR_RO (temp3_fault, temp_fault,2 ), };#define TEMP_UNIT_ATTRS (X ) \
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 13/30 hwmon: (pc87427) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/pc87427.c | 317 ++++++++++++++++++++++-------------------------- 1 file changed, 146 insertions(+), 171 deletions(-)
drivers/hwmon/pc87427.c +146 -171
@@ -384,8 +384,8 @@ static struct pc87427_data *pc87427_update_device(struct device *dev)return data; } -static ssize_t show_fan_input (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_input_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -393,8 +393,8 @@ static ssize_t show_fan_input(struct device *dev, struct device_attributereturn sprintf (buf,"%lu\n" ,fan_from_reg (data->fan[nr])); } -static ssize_t show_fan_min (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_min_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -402,8 +402,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attributereturn sprintf (buf,"%lu\n" ,fan_from_reg (data->fan_min[nr])); } -static ssize_t show_fan_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -412,8 +412,8 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute & FAN_STATUS_LOSPD)); } -static ssize_t show_fan_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -422,8 +422,9 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute & FAN_STATUS_STALL)); } -static ssize_t set_fan_min (struct device *dev,struct device_attribute - *devattr,const char *buf,size_t count) +static ssize_t fan_min_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct pc87427_data *data =dev_get_drvdata (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -449,49 +450,41 @@ static ssize_t set_fan_min(struct device *dev, struct device_attributereturn count; } -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 1); -static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 2); -static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 3); -static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 4); -static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 5); -static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 6); -static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 7); - -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7); + +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2); +static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3); +static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4); +static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5); +static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6); +static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7);static struct attribute *pc87427_attributes_fan[8 ][5 ] = { {
@@ -568,8 +561,8 @@ static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode)outb (data->pwm_enable[nr], iobase +PC87427_REG_PWM_ENABLE ); } -static ssize_t show_pwm_enable (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t pwm_enable_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -581,8 +574,9 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attributereturn sprintf (buf,"%d\n" , pwm_enable); } -static ssize_t set_pwm_enable (struct device *dev,struct device_attribute - *devattr,const char *buf,size_t count) +static ssize_t pwm_enable_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct pc87427_data *data =dev_get_drvdata (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -602,8 +596,8 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attributereturn count; } -static ssize_t show_pwm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t pwm_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -611,8 +605,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attributereturn sprintf (buf,"%d\n" , (int )data->pwm[nr]); } -static ssize_t set_pwm (struct device *dev,struct device_attribute - *devattr,const char *buf,size_t count) +static ssize_t pwm_store (struct device *dev,struct device_attribute *devattr, +const char *buf,size_t count) {struct pc87427_data *data =dev_get_drvdata (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -657,19 +651,15 @@ static ssize_t set_pwm(struct device *dev, struct device_attributereturn count; } -static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 0); -static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 1); -static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 2); -static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 3); +static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1); +static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2); +static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); +static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2); +static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3);static struct attribute *pc87427_attributes_pwm[4 ][3 ] = { {
@@ -698,8 +688,8 @@ static const struct attribute_group pc87427_group_pwm[4] = { { .attrs = pc87427_attributes_pwm[3] }, }; -static ssize_t show_temp_input (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_input_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -707,8 +697,8 @@ static ssize_t show_temp_input(struct device *dev, struct device_attributereturn sprintf (buf,"%ld\n" ,temp_from_reg (data->temp[nr])); } -static ssize_t show_temp_min (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_min_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -716,8 +706,8 @@ static ssize_t show_temp_min(struct device *dev, struct device_attributereturn sprintf (buf,"%ld\n" ,temp_from_reg8 (data->temp_min[nr])); } -static ssize_t show_temp_max (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_max_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -725,8 +715,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attributereturn sprintf (buf,"%ld\n" ,temp_from_reg8 (data->temp_max[nr])); } -static ssize_t show_temp_crit (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_crit_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -734,8 +724,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attributereturn sprintf (buf,"%ld\n" ,temp_from_reg8 (data->temp_crit[nr])); } -static ssize_t show_temp_type (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_type_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -743,8 +733,9 @@ static ssize_t show_temp_type(struct device *dev, struct device_attributereturn sprintf (buf,"%u\n" ,temp_type_from_reg (data->temp_type[nr])); } -static ssize_t show_temp_min_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_min_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -753,8 +744,9 @@ static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_LOWFLG)); } -static ssize_t show_temp_max_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_max_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -763,8 +755,9 @@ static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_HIGHFLG)); } -static ssize_t show_temp_crit_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_crit_alarm_show (struct device *dev, +struct device_attribute *devattr, +char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -773,8 +766,8 @@ static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_CRITFLG)); } -static ssize_t show_temp_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct pc87427_data *data =pc87427_update_device (dev);int nr =to_sensor_dev_attr (devattr)->index;
@@ -783,86 +776,68 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute & TEMP_STATUS_SENSERR)); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5);static struct attribute *pc87427_attributes_temp[6 ][10 ] = { {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 14/30 hwmon: (powr1220) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/powr1220.c | 144 +++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 92 deletions(-)
drivers/hwmon/powr1220.c +52 -92
@@ -177,8 +177,9 @@ static int powr1220_read_adc(struct device *dev, int ch_num) }/* Shows the voltage associated with the specified ADC channel */ -static ssize_t powr1220_show_voltage (struct device *dev, -struct device_attribute *dev_attr,char *buf) +static ssize_t powr1220_voltage_show (struct device *dev, +struct device_attribute *dev_attr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);int adc_val =powr1220_read_adc (dev, attr->index);
@@ -190,8 +191,8 @@ static ssize_t powr1220_show_voltage(struct device *dev, }/* Shows the maximum setting associated with the specified ADC channel */ -static ssize_t powr1220_show_max (struct device *dev, -struct device_attribute *dev_attr,char *buf) +static ssize_t powr1220_max_show (struct device *dev, +struct device_attribute *dev_attr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);struct powr1220_data *data =dev_get_drvdata (dev);
@@ -200,100 +201,59 @@ static ssize_t powr1220_show_max(struct device *dev, }/* Shows the label associated with the specified ADC channel */ -static ssize_t powr1220_show_label (struct device *dev, -struct device_attribute *dev_attr,char *buf) +static ssize_t powr1220_label_show (struct device *dev, +struct device_attribute *dev_attr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (dev_attr);return sprintf (buf,"%s\n" , input_names[attr->index]); } -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON1); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON2); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON3); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON4); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON5); -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON6); -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON7); -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON8); -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON9); -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON10); -static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON11); -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, powr1220_show_voltage, NULL, - VMON12); -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, powr1220_show_voltage, NULL, - VCCA); -static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, powr1220_show_voltage, NULL, - VCCINP); - -static SENSOR_DEVICE_ATTR(in0_highest, S_IRUGO, powr1220_show_max, NULL, - VMON1); -static SENSOR_DEVICE_ATTR(in1_highest, S_IRUGO, powr1220_show_max, NULL, - VMON2); -static SENSOR_DEVICE_ATTR(in2_highest, S_IRUGO, powr1220_show_max, NULL, - VMON3); -static SENSOR_DEVICE_ATTR(in3_highest, S_IRUGO, powr1220_show_max, NULL, - VMON4); -static SENSOR_DEVICE_ATTR(in4_highest, S_IRUGO, powr1220_show_max, NULL, - VMON5); -static SENSOR_DEVICE_ATTR(in5_highest, S_IRUGO, powr1220_show_max, NULL, - VMON6); -static SENSOR_DEVICE_ATTR(in6_highest, S_IRUGO, powr1220_show_max, NULL, - VMON7); -static SENSOR_DEVICE_ATTR(in7_highest, S_IRUGO, powr1220_show_max, NULL, - VMON8); -static SENSOR_DEVICE_ATTR(in8_highest, S_IRUGO, powr1220_show_max, NULL, - VMON9); -static SENSOR_DEVICE_ATTR(in9_highest, S_IRUGO, powr1220_show_max, NULL, - VMON10); -static SENSOR_DEVICE_ATTR(in10_highest, S_IRUGO, powr1220_show_max, NULL, - VMON11); -static SENSOR_DEVICE_ATTR(in11_highest, S_IRUGO, powr1220_show_max, NULL, - VMON12); -static SENSOR_DEVICE_ATTR(in12_highest, S_IRUGO, powr1220_show_max, NULL, - VCCA); -static SENSOR_DEVICE_ATTR(in13_highest, S_IRUGO, powr1220_show_max, NULL, - VCCINP); - -static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, powr1220_show_label, NULL, - VMON1); -static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, powr1220_show_label, NULL, - VMON2); -static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, powr1220_show_label, NULL, - VMON3); -static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, powr1220_show_label, NULL, - VMON4); -static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, powr1220_show_label, NULL, - VMON5); -static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, powr1220_show_label, NULL, - VMON6); -static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, powr1220_show_label, NULL, - VMON7); -static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, powr1220_show_label, NULL, - VMON8); -static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, powr1220_show_label, NULL, - VMON9); -static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, powr1220_show_label, NULL, - VMON10); -static SENSOR_DEVICE_ATTR(in10_label, S_IRUGO, powr1220_show_label, NULL, - VMON11); -static SENSOR_DEVICE_ATTR(in11_label, S_IRUGO, powr1220_show_label, NULL, - VMON12); -static SENSOR_DEVICE_ATTR(in12_label, S_IRUGO, powr1220_show_label, NULL, - VCCA); -static SENSOR_DEVICE_ATTR(in13_label, S_IRUGO, powr1220_show_label, NULL, - VCCINP); +static SENSOR_DEVICE_ATTR_RO(in0_input, powr1220_voltage, VMON1); +static SENSOR_DEVICE_ATTR_RO(in1_input, powr1220_voltage, VMON2); +static SENSOR_DEVICE_ATTR_RO(in2_input, powr1220_voltage, VMON3); +static SENSOR_DEVICE_ATTR_RO(in3_input, powr1220_voltage, VMON4); +static SENSOR_DEVICE_ATTR_RO(in4_input, powr1220_voltage, VMON5); +static SENSOR_DEVICE_ATTR_RO(in5_input, powr1220_voltage, VMON6); +static SENSOR_DEVICE_ATTR_RO(in6_input, powr1220_voltage, VMON7); +static SENSOR_DEVICE_ATTR_RO(in7_input, powr1220_voltage, VMON8); +static SENSOR_DEVICE_ATTR_RO(in8_input, powr1220_voltage, VMON9); +static SENSOR_DEVICE_ATTR_RO(in9_input, powr1220_voltage, VMON10); +static SENSOR_DEVICE_ATTR_RO(in10_input, powr1220_voltage, VMON11); +static SENSOR_DEVICE_ATTR_RO(in11_input, powr1220_voltage, VMON12); +static SENSOR_DEVICE_ATTR_RO(in12_input, powr1220_voltage, VCCA); +static SENSOR_DEVICE_ATTR_RO(in13_input, powr1220_voltage, VCCINP); + +static SENSOR_DEVICE_ATTR_RO(in0_highest, powr1220_max, VMON1); +static SENSOR_DEVICE_ATTR_RO(in1_highest, powr1220_max, VMON2); +static SENSOR_DEVICE_ATTR_RO(in2_highest, powr1220_max, VMON3); +static SENSOR_DEVICE_ATTR_RO(in3_highest, powr1220_max, VMON4); +static SENSOR_DEVICE_ATTR_RO(in4_highest, powr1220_max, VMON5); +static SENSOR_DEVICE_ATTR_RO(in5_highest, powr1220_max, VMON6); +static SENSOR_DEVICE_ATTR_RO(in6_highest, powr1220_max, VMON7); +static SENSOR_DEVICE_ATTR_RO(in7_highest, powr1220_max, VMON8); +static SENSOR_DEVICE_ATTR_RO(in8_highest, powr1220_max, VMON9); +static SENSOR_DEVICE_ATTR_RO(in9_highest, powr1220_max, VMON10); +static SENSOR_DEVICE_ATTR_RO(in10_highest, powr1220_max, VMON11); +static SENSOR_DEVICE_ATTR_RO(in11_highest, powr1220_max, VMON12); +static SENSOR_DEVICE_ATTR_RO(in12_highest, powr1220_max, VCCA); +static SENSOR_DEVICE_ATTR_RO(in13_highest, powr1220_max, VCCINP); + +static SENSOR_DEVICE_ATTR_RO(in0_label, powr1220_label, VMON1); +static SENSOR_DEVICE_ATTR_RO(in1_label, powr1220_label, VMON2); +static SENSOR_DEVICE_ATTR_RO(in2_label, powr1220_label, VMON3); +static SENSOR_DEVICE_ATTR_RO(in3_label, powr1220_label, VMON4); +static SENSOR_DEVICE_ATTR_RO(in4_label, powr1220_label, VMON5); +static SENSOR_DEVICE_ATTR_RO(in5_label, powr1220_label, VMON6); +static SENSOR_DEVICE_ATTR_RO(in6_label, powr1220_label, VMON7); +static SENSOR_DEVICE_ATTR_RO(in7_label, powr1220_label, VMON8); +static SENSOR_DEVICE_ATTR_RO(in8_label, powr1220_label, VMON9); +static SENSOR_DEVICE_ATTR_RO(in9_label, powr1220_label, VMON10); +static SENSOR_DEVICE_ATTR_RO(in10_label, powr1220_label, VMON11); +static SENSOR_DEVICE_ATTR_RO(in11_label, powr1220_label, VMON12); +static SENSOR_DEVICE_ATTR_RO(in12_label, powr1220_label, VCCA); +static SENSOR_DEVICE_ATTR_RO(in13_label, powr1220_label, VCCINP);static struct attribute *powr1220_attrs[] = { &sensor_dev_attr_in0_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 15/30 hwmon: (sch5627) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/sch5627.c | 146 ++++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 73 deletions(-)
drivers/hwmon/sch5627.c +73 -73
@@ -211,8 +211,8 @@ static ssize_t name_show(struct device *dev, struct device_attribute *devattr,return snprintf (buf,PAGE_SIZE ,"%s\n" ,DEVNAME ); } -static ssize_t show_temp (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =sch5627_update_device (dev);
@@ -225,8 +225,8 @@ static ssize_t show_temp(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_temp_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =sch5627_update_device (dev);
@@ -237,8 +237,8 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , data->temp[attr->index] ==0 ); } -static ssize_t show_temp_max (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_max_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =dev_get_drvdata (dev);
@@ -248,8 +248,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_temp_crit (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_crit_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =dev_get_drvdata (dev);
@@ -259,8 +259,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_fan (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =sch5627_update_device (dev);
@@ -276,8 +276,8 @@ static ssize_t show_fan(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_fan_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =sch5627_update_device (dev);
@@ -289,8 +289,8 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute data->fan[attr->index] == 0xffff); } -static ssize_t show_fan_min (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_min_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =dev_get_drvdata (dev);
@@ -301,8 +301,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_in (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t in_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5627_data *data =sch5627_update_device (dev);
@@ -317,8 +317,8 @@ static ssize_t show_in(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_in_label (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t in_label_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -327,61 +327,61 @@ static ssize_t show_in_label(struct device *dev, struct device_attribute }static DEVICE_ATTR_RO (name); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_temp, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_fault, S_IRUGO, show_temp_fault, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_fault, S_IRUGO, show_temp_fault, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_max, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_max, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan_min, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan_min, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO, show_fan_min, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_min, S_IRUGO, show_fan_min, NULL, 3); - -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 4); -static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_in_label, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_in_label, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_in_label, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_in_label, NULL, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_input, temp, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_input, temp, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_fault, temp_fault, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_fault, temp_fault, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_max, temp_max, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_max, temp_max, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_crit, temp_crit, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_crit, temp_crit, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3); +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); +static SENSOR_DEVICE_ATTR_RO(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_min, fan_min, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_min, fan_min, 3); + +static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); +static SENSOR_DEVICE_ATTR_RO(in0_label, in_label, 0); +static SENSOR_DEVICE_ATTR_RO(in1_label, in_label, 1); +static SENSOR_DEVICE_ATTR_RO(in2_label, in_label, 2); +static SENSOR_DEVICE_ATTR_RO(in3_label, in_label, 3);static struct attribute *sch5627_attributes[] = { &dev_attr_name.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 16/30 hwmon: (sch5636) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/sch5636.c | 202 ++++++++++++++++++++++++------------------------ 1 file changed, 101 insertions(+), 101 deletions(-)
drivers/hwmon/sch5636.c +101 -101
@@ -170,14 +170,14 @@ static int reg_to_rpm(u16 reg)return 5400540 / reg; } -static ssize_t show_name (struct device *dev,struct device_attribute *devattr, -char *buf) +static ssize_t name_show (struct device *dev,struct device_attribute *devattr, +char *buf) {return snprintf (buf,PAGE_SIZE ,"%s\n" ,DEVNAME ); } -static ssize_t show_in_value (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t in_value_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -192,8 +192,8 @@ static ssize_t show_in_value(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_in_label (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t in_label_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -201,8 +201,8 @@ static ssize_t show_in_label(struct device *dev, struct device_attribute SCH5636_IN_LABELS[attr->index]); } -static ssize_t show_temp_value (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_value_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -215,8 +215,8 @@ static ssize_t show_temp_value(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_temp_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -229,8 +229,8 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_temp_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -243,8 +243,8 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_fan_value (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_value_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -260,8 +260,8 @@ static ssize_t show_fan_value(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_fan_fault (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_fault_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -274,8 +274,8 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attributereturn snprintf (buf,PAGE_SIZE ,"%d\n" , val); } -static ssize_t show_fan_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct sch5636_data *data =sch5636_update_device (dev);
@@ -289,95 +289,95 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute }static struct sensor_device_attribute sch5636_attr[] = { -SENSOR_ATTR (name,0444 , show_name,NULL ,0 ), -SENSOR_ATTR (in0_input,0444 , show_in_value,NULL ,0 ), -SENSOR_ATTR (in0_label,0444 , show_in_label,NULL ,0 ), -SENSOR_ATTR (in1_input,0444 , show_in_value,NULL ,1 ), -SENSOR_ATTR (in1_label,0444 , show_in_label,NULL ,1 ), -SENSOR_ATTR (in2_input,0444 , show_in_value,NULL ,2 ), -SENSOR_ATTR (in2_label,0444 , show_in_label,NULL ,2 ), -SENSOR_ATTR (in3_input,0444 , show_in_value,NULL ,3 ), -SENSOR_ATTR (in3_label,0444 , show_in_label,NULL ,3 ), -SENSOR_ATTR (in4_input,0444 , show_in_value,NULL ,4 ), -SENSOR_ATTR (in4_label,0444 , show_in_label,NULL ,4 ), +SENSOR_ATTR_RO (name, name,0 ), +SENSOR_ATTR_RO (in0_input, in_value,0 ), +SENSOR_ATTR_RO (in0_label, in_label,0 ), +SENSOR_ATTR_RO (in1_input, in_value,1 ), +SENSOR_ATTR_RO (in1_label, in_label,1 ), +SENSOR_ATTR_RO (in2_input, in_value,2 ), +SENSOR_ATTR_RO (in2_label, in_label,2 ), +SENSOR_ATTR_RO (in3_input, in_value,3 ), +SENSOR_ATTR_RO (in3_label, in_label,3 ), +SENSOR_ATTR_RO (in4_input, in_value,4 ), +SENSOR_ATTR_RO (in4_label, in_label,4 ), };static struct sensor_device_attribute sch5636_temp_attr[] = { -SENSOR_ATTR (temp1_input,0444 , show_temp_value,NULL ,0 ), -SENSOR_ATTR (temp1_fault,0444 , show_temp_fault,NULL ,0 ), -SENSOR_ATTR (temp1_alarm,0444 , show_temp_alarm,NULL ,0 ), -SENSOR_ATTR (temp2_input,0444 , show_temp_value,NULL ,1 ), -SENSOR_ATTR (temp2_fault,0444 , show_temp_fault,NULL ,1 ), -SENSOR_ATTR (temp2_alarm,0444 , show_temp_alarm,NULL ,1 ), -SENSOR_ATTR (temp3_input,0444 , show_temp_value,NULL ,2 ), -SENSOR_ATTR (temp3_fault,0444 , show_temp_fault,NULL ,2 ), -SENSOR_ATTR (temp3_alarm,0444 , show_temp_alarm,NULL ,2 ), -SENSOR_ATTR (temp4_input,0444 , show_temp_value,NULL ,3 ), -SENSOR_ATTR (temp4_fault,0444 , show_temp_fault,NULL ,3 ), -SENSOR_ATTR (temp4_alarm,0444 , show_temp_alarm,NULL ,3 ), -SENSOR_ATTR (temp5_input,0444 , show_temp_value,NULL ,4 ), -SENSOR_ATTR (temp5_fault,0444 , show_temp_fault,NULL ,4 ), -SENSOR_ATTR (temp5_alarm,0444 , show_temp_alarm,NULL ,4 ), -SENSOR_ATTR (temp6_input,0444 , show_temp_value,NULL ,5 ), -SENSOR_ATTR (temp6_fault,0444 , show_temp_fault,NULL ,5 ), -SENSOR_ATTR (temp6_alarm,0444 , show_temp_alarm,NULL ,5 ), -SENSOR_ATTR (temp7_input,0444 , show_temp_value,NULL ,6 ), -SENSOR_ATTR (temp7_fault,0444 , show_temp_fault,NULL ,6 ), -SENSOR_ATTR (temp7_alarm,0444 , show_temp_alarm,NULL ,6 ), -SENSOR_ATTR (temp8_input,0444 , show_temp_value,NULL ,7 ), -SENSOR_ATTR (temp8_fault,0444 , show_temp_fault,NULL ,7 ), -SENSOR_ATTR (temp8_alarm,0444 , show_temp_alarm,NULL ,7 ), -SENSOR_ATTR (temp9_input,0444 , show_temp_value,NULL ,8 ), -SENSOR_ATTR (temp9_fault,0444 , show_temp_fault,NULL ,8 ), -SENSOR_ATTR (temp9_alarm,0444 , show_temp_alarm,NULL ,8 ), -SENSOR_ATTR (temp10_input,0444 , show_temp_value,NULL ,9 ), -SENSOR_ATTR (temp10_fault,0444 , show_temp_fault,NULL ,9 ), -SENSOR_ATTR (temp10_alarm,0444 , show_temp_alarm,NULL ,9 ), -SENSOR_ATTR (temp11_input,0444 , show_temp_value,NULL ,10 ), -SENSOR_ATTR (temp11_fault,0444 , show_temp_fault,NULL ,10 ), -SENSOR_ATTR (temp11_alarm,0444 , show_temp_alarm,NULL ,10 ), -SENSOR_ATTR (temp12_input,0444 , show_temp_value,NULL ,11 ), -SENSOR_ATTR (temp12_fault,0444 , show_temp_fault,NULL ,11 ), -SENSOR_ATTR (temp12_alarm,0444 , show_temp_alarm,NULL ,11 ), -SENSOR_ATTR (temp13_input,0444 , show_temp_value,NULL ,12 ), -SENSOR_ATTR (temp13_fault,0444 , show_temp_fault,NULL ,12 ), -SENSOR_ATTR (temp13_alarm,0444 , show_temp_alarm,NULL ,12 ), -SENSOR_ATTR (temp14_input,0444 , show_temp_value,NULL ,13 ), -SENSOR_ATTR (temp14_fault,0444 , show_temp_fault,NULL ,13 ), -SENSOR_ATTR (temp14_alarm,0444 , show_temp_alarm,NULL ,13 ), -SENSOR_ATTR (temp15_input,0444 , show_temp_value,NULL ,14 ), -SENSOR_ATTR (temp15_fault,0444 , show_temp_fault,NULL ,14 ), -SENSOR_ATTR (temp15_alarm,0444 , show_temp_alarm,NULL ,14 ), -SENSOR_ATTR (temp16_input,0444 , show_temp_value,NULL ,15 ), -SENSOR_ATTR (temp16_fault,0444 , show_temp_fault,NULL ,15 ), -SENSOR_ATTR (temp16_alarm,0444 , show_temp_alarm,NULL ,15 ), +SENSOR_ATTR_RO (temp1_input, temp_value,0 ), +SENSOR_ATTR_RO (temp1_fault, temp_fault,0 ), +SENSOR_ATTR_RO (temp1_alarm, temp_alarm,0 ), +SENSOR_ATTR_RO (temp2_input, temp_value,1 ), +SENSOR_ATTR_RO (temp2_fault, temp_fault,1 ), +SENSOR_ATTR_RO (temp2_alarm, temp_alarm,1 ), +SENSOR_ATTR_RO (temp3_input, temp_value,2 ), +SENSOR_ATTR_RO (temp3_fault, temp_fault,2 ), +SENSOR_ATTR_RO (temp3_alarm, temp_alarm,2 ), +SENSOR_ATTR_RO (temp4_input, temp_value,3 ), +SENSOR_ATTR_RO (temp4_fault, temp_fault,3 ), +SENSOR_ATTR_RO (temp4_alarm, temp_alarm,3 ), +SENSOR_ATTR_RO (temp5_input, temp_value,4 ), +SENSOR_ATTR_RO (temp5_fault, temp_fault,4 ), +SENSOR_ATTR_RO (temp5_alarm, temp_alarm,4 ), +SENSOR_ATTR_RO (temp6_input, temp_value,5 ), +SENSOR_ATTR_RO (temp6_fault, temp_fault,5 ), +SENSOR_ATTR_RO (temp6_alarm, temp_alarm,5 ), +SENSOR_ATTR_RO (temp7_input, temp_value,6 ), +SENSOR_ATTR_RO (temp7_fault, temp_fault,6 ), +SENSOR_ATTR_RO (temp7_alarm, temp_alarm,6 ), +SENSOR_ATTR_RO (temp8_input, temp_value,7 ), +SENSOR_ATTR_RO (temp8_fault, temp_fault,7 ), +SENSOR_ATTR_RO (temp8_alarm, temp_alarm,7 ), +SENSOR_ATTR_RO (temp9_input, temp_value,8 ), +SENSOR_ATTR_RO (temp9_fault, temp_fault,8 ), +SENSOR_ATTR_RO (temp9_alarm, temp_alarm,8 ), +SENSOR_ATTR_RO (temp10_input, temp_value,9 ), +SENSOR_ATTR_RO (temp10_fault, temp_fault,9 ), +SENSOR_ATTR_RO (temp10_alarm, temp_alarm,9 ), +SENSOR_ATTR_RO (temp11_input, temp_value,10 ), +SENSOR_ATTR_RO (temp11_fault, temp_fault,10 ), +SENSOR_ATTR_RO (temp11_alarm, temp_alarm,10 ), +SENSOR_ATTR_RO (temp12_input, temp_value,11 ), +SENSOR_ATTR_RO (temp12_fault, temp_fault,11 ), +SENSOR_ATTR_RO (temp12_alarm, temp_alarm,11 ), +SENSOR_ATTR_RO (temp13_input, temp_value,12 ), +SENSOR_ATTR_RO (temp13_fault, temp_fault,12 ), +SENSOR_ATTR_RO (temp13_alarm, temp_alarm,12 ), +SENSOR_ATTR_RO (temp14_input, temp_value,13 ), +SENSOR_ATTR_RO (temp14_fault, temp_fault,13 ), +SENSOR_ATTR_RO (temp14_alarm, temp_alarm,13 ), +SENSOR_ATTR_RO (temp15_input, temp_value,14 ), +SENSOR_ATTR_RO (temp15_fault, temp_fault,14 ), +SENSOR_ATTR_RO (temp15_alarm, temp_alarm,14 ), +SENSOR_ATTR_RO (temp16_input, temp_value,15 ), +SENSOR_ATTR_RO (temp16_fault, temp_fault,15 ), +SENSOR_ATTR_RO (temp16_alarm, temp_alarm,15 ), };static struct sensor_device_attribute sch5636_fan_attr[] = { -SENSOR_ATTR (fan1_input,0444 , show_fan_value,NULL ,0 ), -SENSOR_ATTR (fan1_fault,0444 , show_fan_fault,NULL ,0 ), -SENSOR_ATTR (fan1_alarm,0444 , show_fan_alarm,NULL ,0 ), -SENSOR_ATTR (fan2_input,0444 , show_fan_value,NULL ,1 ), -SENSOR_ATTR (fan2_fault,0444 , show_fan_fault,NULL ,1 ), -SENSOR_ATTR (fan2_alarm,0444 , show_fan_alarm,NULL ,1 ), -SENSOR_ATTR (fan3_input,0444 , show_fan_value,NULL ,2 ), -SENSOR_ATTR (fan3_fault,0444 , show_fan_fault,NULL ,2 ), -SENSOR_ATTR (fan3_alarm,0444 , show_fan_alarm,NULL ,2 ), -SENSOR_ATTR (fan4_input,0444 , show_fan_value,NULL ,3 ), -SENSOR_ATTR (fan4_fault,0444 , show_fan_fault,NULL ,3 ), -SENSOR_ATTR (fan4_alarm,0444 , show_fan_alarm,NULL ,3 ), -SENSOR_ATTR (fan5_input,0444 , show_fan_value,NULL ,4 ), -SENSOR_ATTR (fan5_fault,0444 , show_fan_fault,NULL ,4 ), -SENSOR_ATTR (fan5_alarm,0444 , show_fan_alarm,NULL ,4 ), -SENSOR_ATTR (fan6_input,0444 , show_fan_value,NULL ,5 ), -SENSOR_ATTR (fan6_fault,0444 , show_fan_fault,NULL ,5 ), -SENSOR_ATTR (fan6_alarm,0444 , show_fan_alarm,NULL ,5 ), -SENSOR_ATTR (fan7_input,0444 , show_fan_value,NULL ,6 ), -SENSOR_ATTR (fan7_fault,0444 , show_fan_fault,NULL ,6 ), -SENSOR_ATTR (fan7_alarm,0444 , show_fan_alarm,NULL ,6 ), -SENSOR_ATTR (fan8_input,0444 , show_fan_value,NULL ,7 ), -SENSOR_ATTR (fan8_fault,0444 , show_fan_fault,NULL ,7 ), -SENSOR_ATTR (fan8_alarm,0444 , show_fan_alarm,NULL ,7 ), +SENSOR_ATTR_RO (fan1_input, fan_value,0 ), +SENSOR_ATTR_RO (fan1_fault, fan_fault,0 ), +SENSOR_ATTR_RO (fan1_alarm, fan_alarm,0 ), +SENSOR_ATTR_RO (fan2_input, fan_value,1 ), +SENSOR_ATTR_RO (fan2_fault, fan_fault,1 ), +SENSOR_ATTR_RO (fan2_alarm, fan_alarm,1 ), +SENSOR_ATTR_RO (fan3_input, fan_value,2 ), +SENSOR_ATTR_RO (fan3_fault, fan_fault,2 ), +SENSOR_ATTR_RO (fan3_alarm, fan_alarm,2 ), +SENSOR_ATTR_RO (fan4_input, fan_value,3 ), +SENSOR_ATTR_RO (fan4_fault, fan_fault,3 ), +SENSOR_ATTR_RO (fan4_alarm, fan_alarm,3 ), +SENSOR_ATTR_RO (fan5_input, fan_value,4 ), +SENSOR_ATTR_RO (fan5_fault, fan_fault,4 ), +SENSOR_ATTR_RO (fan5_alarm, fan_alarm,4 ), +SENSOR_ATTR_RO (fan6_input, fan_value,5 ), +SENSOR_ATTR_RO (fan6_fault, fan_fault,5 ), +SENSOR_ATTR_RO (fan6_alarm, fan_alarm,5 ), +SENSOR_ATTR_RO (fan7_input, fan_value,6 ), +SENSOR_ATTR_RO (fan7_fault, fan_fault,6 ), +SENSOR_ATTR_RO (fan7_alarm, fan_alarm,6 ), +SENSOR_ATTR_RO (fan8_input, fan_value,7 ), +SENSOR_ATTR_RO (fan8_fault, fan_fault,7 ), +SENSOR_ATTR_RO (fan8_alarm, fan_alarm,7 ), };static int sch5636_remove (struct platform_device *pdev)
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 17/30 hwmon: (scmi-hwmon) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/scmi-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/scmi-hwmon.c +1 -1
@@ -57,7 +57,7 @@ scmi_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_types type, sensor = *(scmi_sensors->info[type] + channel);if (sensor) -return S_IRUGO ; +return 0444 ;return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 18/30 hwmon: (scpi-hwmon) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/scpi-hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/scpi-hwmon.c +2 -2
@@ -226,11 +226,11 @@ static int scpi_hwmon_probe(struct platform_device *pdev) sensor->scale = scale[sensor->info.class]; - sensor->dev_attr_input.attr.mode =S_IRUGO ; + sensor->dev_attr_input.attr.mode =0444 ; sensor->dev_attr_input.show = scpi_show_sensor; sensor->dev_attr_input.attr.name = sensor->input; - sensor->dev_attr_label.attr.mode =S_IRUGO ; + sensor->dev_attr_label.attr.mode =0444 ; sensor->dev_attr_label.show = scpi_show_label; sensor->dev_attr_label.attr.name = sensor->label;
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 19/30 hwmon: (sht15) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/sht15.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-)
drivers/hwmon/sht15.c +14 -20
@@ -677,9 +677,8 @@ static inline int sht15_calc_humid(struct sht15_data *data)* and heater_enable sysfs attributes. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht15_show_status (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t sht15_status_show (struct device *dev, +struct device_attribute *attr,char *buf) {int ret;struct sht15_data *data =dev_get_drvdata (dev);
@@ -700,7 +699,7 @@ static ssize_t sht15_show_status(struct device *dev,* Will be called on write access to heater_enable sysfs attribute. * Returns number of bytes actually decoded, negative errno on error. */ -static ssize_t sht15_store_heater (struct device *dev, +static ssize_t sht15_status_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -734,9 +733,8 @@ static ssize_t sht15_store_heater(struct device *dev,* Will be called on read access to temp1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht15_show_temp (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t sht15_temp_show (struct device *dev, +struct device_attribute *attr,char *buf) {int ret;struct sht15_data *data =dev_get_drvdata (dev);
@@ -757,9 +755,8 @@ static ssize_t sht15_show_temp(struct device *dev,* Will be called on read access to humidity1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht15_show_humidity (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t sht15_humidity_show (struct device *dev, +struct device_attribute *attr,char *buf) {int ret;struct sht15_data *data =dev_get_drvdata (dev);
@@ -777,16 +774,13 @@ static ssize_t name_show(struct device *dev,return sprintf (buf,"%s\n" , pdev->name); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, - sht15_show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, - sht15_show_humidity, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, sht15_show_status, NULL, - SHT15_STATUS_LOW_BATTERY); -static SENSOR_DEVICE_ATTR(humidity1_fault, S_IRUGO, sht15_show_status, NULL, - SHT15_STATUS_LOW_BATTERY); -static SENSOR_DEVICE_ATTR(heater_enable, S_IRUGO | S_IWUSR, sht15_show_status, - sht15_store_heater, SHT15_STATUS_HEATER); +static SENSOR_DEVICE_ATTR_RO(temp1_input, sht15_temp, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_input, sht15_humidity, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, sht15_status, + SHT15_STATUS_LOW_BATTERY); +static SENSOR_DEVICE_ATTR_RO(humidity1_fault, sht15_status, + SHT15_STATUS_LOW_BATTERY); +static SENSOR_DEVICE_ATTR_RW(heater_enable, sht15_status, SHT15_STATUS_HEATER);static DEVICE_ATTR_RO (name);static struct attribute *sht15_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 20/30 hwmon: (sht21) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/sht21.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/hwmon/sht21.c +7 -10
@@ -135,9 +135,9 @@ static int sht21_update_measurements(struct device *dev)* Will be called on read access to temp1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht21_show_temperature (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t sht21_temperature_show (struct device *dev, +struct device_attribute *attr, +char *buf) {struct sht21 *sht21 =dev_get_drvdata (dev);int ret;
@@ -157,9 +157,8 @@ static ssize_t sht21_show_temperature(struct device *dev,* Will be called on read access to humidity1_input sysfs attribute. * Returns number of bytes written into buffer, negative errno on error. */ -static ssize_t sht21_show_humidity (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t sht21_humidity_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct sht21 *sht21 =dev_get_drvdata (dev);int ret;
@@ -251,10 +250,8 @@ static ssize_t eic_show(struct device *dev, }/* sysfs attributes */ -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, sht21_show_temperature, - NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, sht21_show_humidity, - NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, sht21_temperature, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_input, sht21_humidity, 0);static DEVICE_ATTR_RO (eic);static struct attribute *sht21_attrs[] = {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 21/30 hwmon: (sht3x) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/sht3x.c | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-)
drivers/hwmon/sht3x.c +16 -34
@@ -629,40 +629,22 @@ static ssize_t update_interval_store(struct device *dev,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,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 22/30 hwmon: (smsc47b397) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/smsc47b397.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/hwmon/smsc47b397.c +12 -12
@@ -164,18 +164,18 @@ static int temp_from_reg(u8 reg)return (s8 )reg *1000 ; } -static ssize_t show_temp (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t temp_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct smsc47b397_data *data =smsc47b397_update_device (dev);return sprintf (buf,"%d\n" ,temp_from_reg (data->temp[attr->index])); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3);/* * FAN: 1 RPM/bit
@@ -188,17 +188,17 @@ static int fan_from_reg(u16 reg)return 90000 *60 / reg; } -static ssize_t show_fan (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t fan_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct smsc47b397_data *data =smsc47b397_update_device (dev);return sprintf (buf,"%d\n" ,fan_from_reg (data->fan[attr->index])); } -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3);static struct attribute *smsc47b397_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 23/30 hwmon: (stts751) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/stts751.c | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/hwmon/stts751.c +32 -32
@@ -382,8 +382,8 @@ static int stts751_update(struct stts751_priv *priv)return 0 ; } -static ssize_t show_max_alarm (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t max_alarm_show (struct device *dev, +struct device_attribute *attr,char *buf) {int ret;struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -399,8 +399,8 @@ static ssize_t show_max_alarm(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->max_alert); } -static ssize_t show_min_alarm (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t min_alarm_show (struct device *dev, +struct device_attribute *attr,char *buf) {int ret;struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -416,7 +416,7 @@ static ssize_t show_min_alarm(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->min_alert); } -static ssize_t show_input (struct device *dev,struct device_attribute *attr, +static ssize_t input_show (struct device *dev,struct device_attribute *attr,char *buf) {int ret;
@@ -431,7 +431,7 @@ static ssize_t show_input(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->temp); } -static ssize_t show_therm (struct device *dev,struct device_attribute *attr, +static ssize_t therm_show (struct device *dev,struct device_attribute *attr,char *buf) {struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -439,8 +439,8 @@ static ssize_t show_therm(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->therm); } -static ssize_t set_therm (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t therm_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int ret;long temp;
@@ -473,7 +473,7 @@ static ssize_t set_therm(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t show_hyst (struct device *dev,struct device_attribute *attr, +static ssize_t hyst_show (struct device *dev,struct device_attribute *attr,char *buf) {struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -481,8 +481,8 @@ static ssize_t show_hyst(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->hyst); } -static ssize_t set_hyst (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t hyst_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int ret;long temp;
@@ -506,7 +506,7 @@ static ssize_t set_hyst(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t show_therm_trip (struct device *dev, +static ssize_t therm_trip_show (struct device *dev,struct device_attribute *attr,char *buf) {int ret;
@@ -521,7 +521,7 @@ static ssize_t show_therm_trip(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->therm_trip); } -static ssize_t show_max (struct device *dev,struct device_attribute *attr, +static ssize_t max_show (struct device *dev,struct device_attribute *attr,char *buf) {struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -529,8 +529,8 @@ static ssize_t show_max(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->event_max); } -static ssize_t set_max (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t max_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int ret;long temp;
@@ -555,7 +555,7 @@ static ssize_t set_max(struct device *dev, struct device_attribute *attr,return ret; } -static ssize_t show_min (struct device *dev,struct device_attribute *attr, +static ssize_t min_show (struct device *dev,struct device_attribute *attr,char *buf) {struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -563,8 +563,8 @@ static ssize_t show_min(struct device *dev, struct device_attribute *attr,return snprintf (buf,PAGE_SIZE ,"%d\n" , priv->event_min); } -static ssize_t set_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t min_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int ret;long temp;
@@ -589,8 +589,8 @@ static ssize_t set_min(struct device *dev, struct device_attribute *attr,return ret; } -static ssize_t show_interval (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t interval_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct stts751_priv *priv =dev_get_drvdata (dev);
@@ -598,8 +598,9 @@ static ssize_t show_interval(struct device *dev, struct device_attribute *attr, stts751_intervals[priv->interval]); } -static ssize_t set_interval (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t interval_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {unsigned long val;int idx;
@@ -746,16 +747,15 @@ static int stts751_read_chip_config(struct stts751_priv *priv)return 0 ; } -static SENSOR_DEVICE_ATTR(temp1_input, 0444, show_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_min, 0644, show_min, set_min, 0); -static SENSOR_DEVICE_ATTR(temp1_max, 0644, show_max, set_max, 0); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, 0444, show_min_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, 0444, show_max_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_crit, 0644, show_therm, set_therm, 0); -static SENSOR_DEVICE_ATTR(temp1_crit_hyst, 0644, show_hyst, set_hyst, 0); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, 0444, show_therm_trip, NULL, 0); -static SENSOR_DEVICE_ATTR(update_interval, 0644, - show_interval, set_interval, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, input, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_min, min, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_max, max, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, min_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, max_alarm, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, therm, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_crit_hyst, hyst, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, therm_trip, 0); +static SENSOR_DEVICE_ATTR_RW(update_interval, interval, 0);static struct attribute *stts751_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 24/30 hwmon: (tc654) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/tc654.c | 60 +++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 33 deletions(-)
drivers/hwmon/tc654.c +27 -33
@@ -200,7 +200,7 @@ static struct tc654_data *tc654_update_client(struct device *dev)* sysfs attributes */ -static ssize_t show_fan (struct device *dev,struct device_attribute *da, +static ssize_t fan_show (struct device *dev,struct device_attribute *da,char *buf) {int nr =to_sensor_dev_attr (da)->index;
@@ -218,7 +218,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *da,return sprintf (buf,"%d\n" , val); } -static ssize_t show_fan_min (struct device *dev,struct device_attribute *da, +static ssize_t fan_min_show (struct device *dev,struct device_attribute *da,char *buf) {int nr =to_sensor_dev_attr (da)->index;
@@ -231,8 +231,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute *da, TC654_FAN_FAULT_FROM_REG(data->fan_fault[nr])); } -static ssize_t set_fan_min (struct device *dev,struct device_attribute *da, -const char *buf,size_t count) +static ssize_t fan_min_store (struct device *dev,struct device_attribute *da, +const char *buf,size_t count) {int nr =to_sensor_dev_attr (da)->index;struct tc654_data *data =dev_get_drvdata (dev);
@@ -255,7 +255,7 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *da,return ret <0 ? ret : count; } -static ssize_t show_fan_alarm (struct device *dev,struct device_attribute *da, +static ssize_t fan_alarm_show (struct device *dev,struct device_attribute *da,char *buf) {int nr =to_sensor_dev_attr (da)->index;
@@ -275,8 +275,8 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute *da,static const u8 TC654_FAN_PULSE_SHIFT [] = {1 ,3 }; -static ssize_t show_fan_pulses (struct device *dev,struct device_attribute *da, -char *buf) +static ssize_t fan_pulses_show (struct device *dev, +struct device_attribute *da,char *buf) {int nr =to_sensor_dev_attr (da)->index;struct tc654_data *data =tc654_update_client (dev);
@@ -289,8 +289,9 @@ static ssize_t show_fan_pulses(struct device *dev, struct device_attribute *da,return sprintf (buf,"%d\n" , val); } -static ssize_t set_fan_pulses (struct device *dev,struct device_attribute *da, -const char *buf,size_t count) +static ssize_t fan_pulses_store (struct device *dev, +struct device_attribute *da,const char *buf, +size_t count) {int nr =to_sensor_dev_attr (da)->index;struct tc654_data *data =dev_get_drvdata (dev);
@@ -329,8 +330,8 @@ static ssize_t set_fan_pulses(struct device *dev, struct device_attribute *da,return ret <0 ? ret : count; } -static ssize_t show_pwm_mode (struct device *dev, -struct device_attribute *da,char *buf) +static ssize_t pwm_mode_show (struct device *dev,struct device_attribute *da, +char *buf) {struct tc654_data *data =tc654_update_client (dev);
@@ -340,9 +341,8 @@ static ssize_t show_pwm_mode(struct device *dev,return sprintf (buf,"%d\n" , !!(data->config &TC654_REG_CONFIG_DUTYC )); } -static ssize_t set_pwm_mode (struct device *dev, -struct device_attribute *da, -const char *buf,size_t count) +static ssize_t pwm_mode_store (struct device *dev,struct device_attribute *da, +const char *buf,size_t count) {struct tc654_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -371,7 +371,7 @@ static ssize_t set_pwm_mode(struct device *dev,static const int tc654_pwm_map[16 ] = {77 ,88 ,102 ,112 ,124 ,136 ,148 ,160 ,172 ,184 ,196 ,207 ,219 ,231 ,243 ,255 }; -static ssize_t show_pwm (struct device *dev,struct device_attribute *da, +static ssize_t pwm_show (struct device *dev,struct device_attribute *da,char *buf) {struct tc654_data *data =tc654_update_client (dev);
@@ -388,8 +388,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *da,return sprintf (buf,"%d\n" , pwm); } -static ssize_t set_pwm (struct device *dev,struct device_attribute *da, -const char *buf,size_t count) +static ssize_t pwm_store (struct device *dev,struct device_attribute *da, +const char *buf,size_t count) {struct tc654_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -423,22 +423,16 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *da,return ret <0 ? ret : count; } -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, - set_fan_min, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min, - set_fan_min, 1); -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_pulses, S_IWUSR | S_IRUGO, show_fan_pulses, - set_fan_pulses, 0); -static SENSOR_DEVICE_ATTR(fan2_pulses, S_IWUSR | S_IRUGO, show_fan_pulses, - set_fan_pulses, 1); -static SENSOR_DEVICE_ATTR(pwm1_mode, S_IWUSR | S_IRUGO, - show_pwm_mode, set_pwm_mode, 0); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, - set_pwm, 0); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1); +static SENSOR_DEVICE_ATTR_RW(fan1_pulses, fan_pulses, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_pulses, fan_pulses, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_mode, pwm_mode, 0); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);/* Driver data */ static struct attribute *tc654_attrs[] = {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 25/30 hwmon: (tc74) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/tc74.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/tc74.c +2 -2
@@ -86,7 +86,7 @@ static int tc74_update_device(struct device *dev)return ret; } -static ssize_t show_temp_input (struct device *dev, +static ssize_t temp_input_show (struct device *dev,struct device_attribute *attr,char *buf) {struct tc74_data *data =dev_get_drvdata (dev);
@@ -98,7 +98,7 @@ static ssize_t show_temp_input(struct device *dev,return sprintf (buf,"%d\n" , data->temp_input *1000 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);static struct attribute *tc74_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 26/30 hwmon: (tmp102) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/tmp102.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/tmp102.c +2 -2
@@ -141,10 +141,10 @@ static umode_t tmp102_is_visible(const void *data, enum hwmon_sensor_types type,switch (attr) {case hwmon_temp_input: -return S_IRUGO ; +return 0444 ;case hwmon_temp_max_hyst:case hwmon_temp_max: -return S_IRUGO |S_IWUSR ; +return 0644 ;default :return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 27/30 hwmon: (tmp103) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/tmp103.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/hwmon/tmp103.c +8 -12
@@ -61,9 +61,8 @@ static inline u8 tmp103_mc_to_reg(int val)return DIV_ROUND_CLOSEST (val,1000 ); } -static ssize_t tmp103_show_temp (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t tmp103_temp_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct sensor_device_attribute *sda =to_sensor_dev_attr (attr);struct regmap *regmap =dev_get_drvdata (dev);
@@ -77,9 +76,9 @@ static ssize_t tmp103_show_temp(struct device *dev,return sprintf (buf,"%d\n" ,tmp103_reg_to_mc (regval)); } -static ssize_t tmp103_set_temp (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t tmp103_temp_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {struct sensor_device_attribute *sda =to_sensor_dev_attr (attr);struct regmap *regmap =dev_get_drvdata (dev);
@@ -94,14 +93,11 @@ static ssize_t tmp103_set_temp(struct device *dev,return ret ? ret : count; } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, tmp103_show_temp, NULL , - TMP103_TEMP_REG); +static SENSOR_DEVICE_ATTR_RO(temp1_input, tmp103_temp, TMP103_TEMP_REG); -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, tmp103_show_temp, - tmp103_set_temp, TMP103_TLOW_REG); +static SENSOR_DEVICE_ATTR_RW(temp1_min, tmp103_temp, TMP103_TLOW_REG); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, tmp103_show_temp, - tmp103_set_temp, TMP103_THIGH_REG); +static SENSOR_DEVICE_ATTR_RW(temp1_max, tmp103_temp, TMP103_THIGH_REG);static struct attribute *tmp103_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 28/30 hwmon: (tmp421) Replace S_<PERMS> with octal values
In reply to Guenter RoeckReplace S_<PERMS> 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.
--- drivers/hwmon/tmp421.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/tmp421.c +2 -2
@@ -187,9 +187,9 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type,case hwmon_temp_fault:if (channel ==0 )return 0 ; -return S_IRUGO ; +return 0444 ;case hwmon_temp_input: -return S_IRUGO ; +return 0444 ;default :return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 29/30 hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/vexpress-hwmon.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/hwmon/vexpress-hwmon.c +10 -15
@@ -92,9 +92,8 @@ struct vexpress_hwmon_type { };#if !defined(CONFIG_REGULATOR_VEXPRESS ) -static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_volt[] = { &dev_attr_in1_label.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
@@ -113,9 +112,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_volt = { };#endif -static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(curr1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(curr1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_amp[] = { &dev_attr_curr1_label.attr, &sensor_dev_attr_curr1_input.dev_attr.attr,
@@ -133,9 +131,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_amp = { }, }; -static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(temp1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(temp1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_temp[] = { &dev_attr_temp1_label.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
@@ -153,9 +150,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_temp = { }, }; -static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1); +static DEVICE_ATTR(power1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(power1_input, vexpress_hwmon_u32, 1);static struct attribute *vexpress_hwmon_attrs_power[] = { &dev_attr_power1_label.attr, &sensor_dev_attr_power1_input.dev_attr.attr,
@@ -173,9 +169,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_power = { }, }; -static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, - NULL, 1); +static DEVICE_ATTR(energy1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(energy1_input, vexpress_hwmon_u64, 1);static struct attribute *vexpress_hwmon_attrs_energy[] = { &dev_attr_energy1_label.attr, &sensor_dev_attr_energy1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 30/30 hwmon: (via-cputemp) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckUse SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
--- drivers/hwmon/via-cputemp.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/hwmon/via-cputemp.c +7 -8
@@ -60,8 +60,8 @@ struct via_cputemp_data {* Sysfs stuff */ -static ssize_t show_name (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t name_show (struct device *dev,struct device_attribute *devattr, +char *buf) {int ret;struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -74,8 +74,8 @@ static ssize_t show_name(struct device *dev, struct device_attributereturn ret; } -static ssize_t show_temp (struct device *dev, -struct device_attribute *devattr,char *buf) +static ssize_t temp_show (struct device *dev,struct device_attribute *devattr, +char *buf) {struct via_cputemp_data *data =dev_get_drvdata (dev);u32 eax, edx;
@@ -102,10 +102,9 @@ static ssize_t cpu0_vid_show(struct device *dev,return sprintf (buf,"%d\n" ,vid_from_reg (~edx &0x7f , data->vrm)); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, - SHOW_TEMP); -static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, SHOW_TEMP); +static SENSOR_DEVICE_ATTR_RO(temp1_label, name, SHOW_LABEL); +static SENSOR_DEVICE_ATTR_RO(name, name, SHOW_NAME);static struct attribute *via_cputemp_attributes[] = { &sensor_dev_attr_name.dev_attr.attr,
Signature · 1 line
2.7.4
Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckQuoted 3 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies.
s/readbility/readability/
Quoted 11 lines
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.
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
Not related to this patch, just thought of asking. If the intention is to avoid using S_<PERMS> macros and have direct values for readability, shouldn't you consider the ones as return values mainly in is_visible callbacks ?
Anyways,
--
Regards,
Sudeep
Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Guenter RoeckQuoted 9 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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/.
Quoted 7 lines
This patch does not introduce functional changes. It was verified by compiling the old and new files and comparing text and data sizes.
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Are you going to take the patch via your tree?
Best regards,
Liviu
Quoted 71 lines
--- drivers/hwmon/vexpress-hwmon.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)drivers/hwmon/vexpress-hwmon.c +10
-15@@ -92,9 +92,8 @@ struct vexpress_hwmon_type { };#if !defined(CONFIG_REGULATOR_VEXPRESS ) -static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_volt[] = { &dev_attr_in1_label.attr, &sensor_dev_attr_in1_input.dev_attr.attr,@@ -113,9 +112,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_volt = { };#endif -static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(curr1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(curr1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_amp[] = { &dev_attr_curr1_label.attr, &sensor_dev_attr_curr1_input.dev_attr.attr,@@ -133,9 +131,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_amp = { }, }; -static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(temp1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(temp1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_temp[] = { &dev_attr_temp1_label.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,@@ -153,9 +150,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_temp = { }, }; -static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1); +static DEVICE_ATTR(power1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(power1_input, vexpress_hwmon_u32, 1);static struct attribute *vexpress_hwmon_attrs_power[] = { &dev_attr_power1_label.attr, &sensor_dev_attr_power1_input.dev_attr.attr,@@ -173,9 +169,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_power = { }, }; -static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, - NULL, 1); +static DEVICE_ATTR(energy1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(energy1_input, vexpress_hwmon_u64, 1);static struct attribute *vexpress_hwmon_attrs_energy[] = { &dev_attr_energy1_label.attr, &sensor_dev_attr_energy1_input.dev_attr.attr,Signature · 1 line
2.7.4
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Guenter Roeck
maintainerRe: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 13 lines · Liviu Dudau
Quoted 12 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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.
Quoted 9 lines
Quoted 4 lines
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Cc Lorenzo Pieralisi <[email protected]>Signed-off-by Guenter Roeck <[email protected]>Acked-by Liviu Dudau <[email protected]>Are you going to take the patch via your tree?
Yes.
Thanks,
Guenter
Quoted 84 lines
Best regards,
LiviuQuoted 71 lines
--- drivers/hwmon/vexpress-hwmon.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)drivers/hwmon/vexpress-hwmon.c +10
-15@@ -92,9 +92,8 @@ struct vexpress_hwmon_type { };#if !defined(CONFIG_REGULATOR_VEXPRESS ) -static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_volt[] = { &dev_attr_in1_label.attr, &sensor_dev_attr_in1_input.dev_attr.attr,@@ -113,9 +112,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_volt = { };#endif -static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(curr1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(curr1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_amp[] = { &dev_attr_curr1_label.attr, &sensor_dev_attr_curr1_input.dev_attr.attr,@@ -133,9 +131,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_amp = { }, }; -static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1000); +static DEVICE_ATTR(temp1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(temp1_input, vexpress_hwmon_u32, 1000);static struct attribute *vexpress_hwmon_attrs_temp[] = { &dev_attr_temp1_label.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,@@ -153,9 +150,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_temp = { }, }; -static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, - NULL, 1); +static DEVICE_ATTR(power1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(power1_input, vexpress_hwmon_u32, 1);static struct attribute *vexpress_hwmon_attrs_power[] = { &dev_attr_power1_label.attr, &sensor_dev_attr_power1_input.dev_attr.attr,@@ -173,9 +169,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_power = { }, }; -static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); -static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, - NULL, 1); +static DEVICE_ATTR(energy1_label, 0444, vexpress_hwmon_label_show, NULL); +static SENSOR_DEVICE_ATTR_RO(energy1_input, vexpress_hwmon_u64, 1);static struct attribute *vexpress_hwmon_attrs_energy[] = { &dev_attr_energy1_label.attr, &sensor_dev_attr_energy1_input.dev_attr.attr,Signature · 1 line
2.7.4Signature · 8 lines
==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯
Guenter Roeck
maintainerRe: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
In reply to Sudeep HollaQuoted 7 lines · Sudeep Holla
Quoted 3 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies.
s/readbility/readability/
Nice catch ...
Quoted 9 lines
Quoted 9 lines
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.
Quoted 8 lines
Quoted 2 lines
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Not related to this patch, just thought of asking. If the intention is to avoid using S_<PERMS> macros and have direct values for readability, shouldn't you consider the ones as return values mainly in
is_visiblecallbacks ?
Not sure I understand. Can you clarify ?
Thanks,
Guenter
Quoted 7 lines
Anyways,
Acked-by Sudeep Holla <[email protected]>--
Regards,
Sudeep
Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 22 lines · Guenter Roeck
Quoted 7 lines · Sudeep Holla
Quoted 3 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies.
s/readbility/readability/
Nice catch ...
Quoted 12 lines
Quoted 11 lines
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.
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>
Quoted 8 lines
Quoted 5 lines
Not related to this patch, just thought of asking. If the intention is to avoid using S_<PERMS> macros and have direct values for readability, shouldn't you consider the ones as return values mainly in
is_visiblecallbacks ?Not sure I understand. Can you clarify ?
Sorry for not being clear, I was referring to these:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq
drivers/hwmon/lm75.c: return S_IRUGO;drivers/hwmon/lm75.c: return S_IRUGO | S_IWUSR;drivers/hwmon/lm90.c: return S_IRUGO;drivers/hwmon/lm90.c: return S_IRUGO | S_IWUSR;drivers/hwmon/lm90.c: return S_IRUGO | S_IWUSR;drivers/hwmon/lm95241.c: return S_IRUGO;drivers/hwmon/lm95241.c: return S_IRUGO | S_IWUSR;drivers/hwmon/lm95245.c: return S_IRUGO;drivers/hwmon/lm95245.c: return S_IRUGO | S_IWUSR;drivers/hwmon/lm95245.c: return S_IRUGO | S_IWUSR;drivers/hwmon/ltc4245.c: return S_IRUGO;drivers/hwmon/max31790.c: return S_IRUGO;drivers/hwmon/max31790.c: return S_IRUGO | S_IWUSR;drivers/hwmon/nct7904.c: return S_IRUGO;drivers/hwmon/nct7904.c: return S_IRUGO;drivers/hwmon/nct7904.c: return S_IRUGO | S_IWUSR;drivers/hwmon/scmi-hwmon.c: return S_IRUGO;drivers/hwmon/tmp102.c: return S_IRUGO;drivers/hwmon/tmp102.c: return S_IRUGO | S_IWUSR;drivers/hwmon/tmp421.c: return S_IRUGO;
--
Regards,
Sudeep
Guenter Roeck
maintainerRe: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 47 lines · Sudeep Holla
Quoted 22 lines · Guenter Roeck
Quoted 7 lines · Sudeep Holla
Quoted 3 lines · Guenter Roeck
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, and to reduce the chance of inconsistencies.
s/readbility/readability/
Nice catch ...
Quoted 12 lines
Quoted 11 lines
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.
Cc Liviu Dudau <[email protected]>Cc Sudeep Holla <[email protected]>Quoted 8 lines
Quoted 5 lines
Not related to this patch, just thought of asking. If the intention is to avoid using S_<PERMS> macros and have direct values for readability, shouldn't you consider the ones as return values mainly in
is_visiblecallbacks ?Not sure I understand. Can you clarify ?
Sorry for not being clear, I was referring to these:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq
drivers/hwmon/lm75.c: returnS_IRUGO;drivers/hwmon/lm75.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/lm90.c: returnS_IRUGO;drivers/hwmon/lm90.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/lm90.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/lm95241.c: returnS_IRUGO;drivers/hwmon/lm95241.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/lm95245.c: returnS_IRUGO;drivers/hwmon/lm95245.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/lm95245.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/ltc4245.c: returnS_IRUGO;drivers/hwmon/max31790.c: returnS_IRUGO;
Quoted 9 lines
drivers/hwmon/max31790.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/nct7904.c: returnS_IRUGO;drivers/hwmon/nct7904.c: returnS_IRUGO;drivers/hwmon/nct7904.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/scmi-hwmon.c: returnS_IRUGO;drivers/hwmon/tmp102.c: returnS_IRUGO;drivers/hwmon/tmp102.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/tmp421.c: returnS_IRUGO;
The series only includes auto-converted drivers, and the conversion focused on auto-converting SENSOR_ attributes. While it tried to convert various instances of the above, that was not the primary focus. I will likely submit one or more follow-up series to address remaining SENSOR_... attributes as well as any leftover S_<perms> definitions.
Guenter
Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 1 line · Guenter Roeck
On 1/21/19 1:38 AM, Sudeep Holla wrote:
[...]
Quoted 3 lines
Quoted 3 lines
Sorry for not being clear, I was referring to these:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq
[...]
Quoted 11 lines
Quoted 4 lines
drivers/hwmon/tmp102.c: returnS_IRUGO;drivers/hwmon/tmp102.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/tmp421.c: returnS_IRUGO;The series only includes auto-converted drivers, and the conversion focused on auto-converting
SENSOR_attributes. While it tried to convert various instances of the above, that was not the primary focus. I will likely submit one or more follow-up series to address remainingSENSOR_... attributes as well as any leftover S_<perms> definitions.
OK sounds good, just wanted to make sure I understood the intention for this right.
--
Regards,
Sudeep
Guenter Roeck
maintainerRe: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 23 lines · Sudeep Holla
Quoted 1 line · Guenter Roeck
On 1/21/19 1:38 AM, Sudeep Holla wrote:
[...]
Quoted 3 lines
Quoted 3 lines
Sorry for not being clear, I was referring to these:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq[...]
Quoted 11 lines
Quoted 4 lines
drivers/hwmon/tmp102.c: returnS_IRUGO;drivers/hwmon/tmp102.c: returnS_IRUGO|S_IWUSR;drivers/hwmon/tmp421.c: returnS_IRUGO;The series only includes auto-converted drivers, and the conversion focused on auto-converting
SENSOR_attributes. While it tried to convert various instances of the above, that was not the primary focus. I will likely submit one or more follow-up series to address remainingSENSOR_... attributes as well as any leftover S_<perms> definitions.
Quoted 3 lines
OK sounds good, just wanted to make sure I understood the intention for this right.
After having another look ... did you check the entire series of patches ? Because for me, in hwmon-next:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq $
Guenter
Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Quoted 3 lines · Guenter Roeck
Quoted 1 line · Sudeep Holla
On Mon, Jan 21, 2019 at 07:22:44AM -0800, Guenter Roeck wrote:
[...]
Quoted 5 lines
After having another look ... did you check the entire series of patches ? Because for me, in hwmon-next:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq $
No I didn't check applying the patches, just looked at the pattern in few patches and thought of asking you directly the details.
--
Regards,
Sudeep