hwmon: Use permission specific SENSOR[_DEVICE]_ATTR
Subsystems (5)
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 second of three patch sets with auto-converted drivers. The remaining patches will be submitted shortly.
Guenter Roeck
maintainerPATCH 1/29 hwmon: (gl518sm) 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/gl518sm.c | 120 ++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 61 deletions(-)
drivers/hwmon/gl518sm.c +59 -61
@@ -264,7 +264,7 @@ show(RAW, alarms, alarms);show (BOOL , beep_enable, beep_enable);show (BEEP_MASK , beep_mask, beep_mask); -static ssize_t show_fan_input (struct device *dev, +static ssize_t fan_input_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr =to_sensor_dev_attr (attr)->index;
@@ -273,8 +273,8 @@ static ssize_t show_fan_input(struct device *dev, DIV_FROM_REG(data->fan_div[nr]))); } -static ssize_t show_fan_min (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t fan_min_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr =to_sensor_dev_attr (attr)->index;struct gl518_data *data =gl518_update_device (dev);
@@ -282,8 +282,8 @@ static ssize_t show_fan_min(struct device *dev, DIV_FROM_REG(data->fan_div[nr]))); } -static ssize_t show_fan_div (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t fan_div_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr =to_sensor_dev_attr (attr)->index;struct gl518_data *data =gl518_update_device (dev);
@@ -350,8 +350,9 @@ set_high(IN, in_max3, voltage_max[3], GL518_REG_VIN3_LIMIT);set_bits (BOOL , beep_enable, beep_enable,GL518_REG_CONF ,0x04 ,2 );set (BEEP_MASK , beep_mask, beep_mask,GL518_REG_ALARM ); -static ssize_t set_fan_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_min_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {struct gl518_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -383,8 +384,9 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t set_fan_div (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_div_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {struct gl518_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -427,40 +429,36 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,return count; } -static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); -static DEVICE_ATTR(temp1_max, S_IWUSR|S_IRUGO, show_temp_max1, set_temp_max1); -static DEVICE_ATTR(temp1_max_hyst, S_IWUSR|S_IRUGO, - show_temp_hyst1, set_temp_hyst1); -static DEVICE_ATTR(fan1_auto, S_IWUSR|S_IRUGO, show_fan_auto1, set_fan_auto1); -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_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_div, S_IWUSR|S_IRUGO, - show_fan_div, set_fan_div, 0); -static SENSOR_DEVICE_ATTR(fan2_div, S_IWUSR|S_IRUGO, - show_fan_div, set_fan_div, 1); -static DEVICE_ATTR(in0_input, S_IRUGO, show_in_input0, NULL); -static DEVICE_ATTR(in1_input, S_IRUGO, show_in_input1, NULL); -static DEVICE_ATTR(in2_input, S_IRUGO, show_in_input2, NULL); -static DEVICE_ATTR(in3_input, S_IRUGO, show_in_input3, NULL); -static DEVICE_ATTR(in0_min, S_IWUSR|S_IRUGO, show_in_min0, set_in_min0); -static DEVICE_ATTR(in1_min, S_IWUSR|S_IRUGO, show_in_min1, set_in_min1); -static DEVICE_ATTR(in2_min, S_IWUSR|S_IRUGO, show_in_min2, set_in_min2); -static DEVICE_ATTR(in3_min, S_IWUSR|S_IRUGO, show_in_min3, set_in_min3); -static DEVICE_ATTR(in0_max, S_IWUSR|S_IRUGO, show_in_max0, set_in_max0); -static DEVICE_ATTR(in1_max, S_IWUSR|S_IRUGO, show_in_max1, set_in_max1); -static DEVICE_ATTR(in2_max, S_IWUSR|S_IRUGO, show_in_max2, set_in_max2); -static DEVICE_ATTR(in3_max, S_IWUSR|S_IRUGO, show_in_max3, set_in_max3); -static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); -static DEVICE_ATTR(beep_enable, S_IWUSR|S_IRUGO, - show_beep_enable, set_beep_enable); -static DEVICE_ATTR(beep_mask, S_IWUSR|S_IRUGO, - show_beep_mask, set_beep_mask); - -static ssize_t show_alarm (struct device *dev,struct device_attribute *attr, +static DEVICE_ATTR(temp1_input, 0444, show_temp_input1, NULL); +static DEVICE_ATTR(temp1_max, 0644, show_temp_max1, set_temp_max1); +static DEVICE_ATTR(temp1_max_hyst, 0644, + show_temp_hyst1, set_temp_hyst1); +static DEVICE_ATTR(fan1_auto, 0644, show_fan_auto1, set_fan_auto1); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 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_RW(fan1_div, fan_div, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1); +static DEVICE_ATTR(in0_input, 0444, show_in_input0, NULL); +static DEVICE_ATTR(in1_input, 0444, show_in_input1, NULL); +static DEVICE_ATTR(in2_input, 0444, show_in_input2, NULL); +static DEVICE_ATTR(in3_input, 0444, show_in_input3, NULL); +static DEVICE_ATTR(in0_min, 0644, show_in_min0, set_in_min0); +static DEVICE_ATTR(in1_min, 0644, show_in_min1, set_in_min1); +static DEVICE_ATTR(in2_min, 0644, show_in_min2, set_in_min2); +static DEVICE_ATTR(in3_min, 0644, show_in_min3, set_in_min3); +static DEVICE_ATTR(in0_max, 0644, show_in_max0, set_in_max0); +static DEVICE_ATTR(in1_max, 0644, show_in_max1, set_in_max1); +static DEVICE_ATTR(in2_max, 0644, show_in_max2, set_in_max2); +static DEVICE_ATTR(in3_max, 0644, show_in_max3, set_in_max3); +static DEVICE_ATTR(alarms, 0444, show_alarms, NULL); +static DEVICE_ATTR(beep_enable, 0644, + show_beep_enable, set_beep_enable); +static DEVICE_ATTR(beep_mask, 0644, + show_beep_mask, set_beep_mask); + +static ssize_t alarm_show (struct device *dev,struct device_attribute *attr,char *buf) {int bitnr =to_sensor_dev_attr (attr)->index;
@@ -468,24 +466,24 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%u\n" , (data->alarms >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 6); +static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 4); +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 5); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 6); -static ssize_t show_beep (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t beep_show (struct device *dev,struct device_attribute *attr, +char *buf) {int bitnr =to_sensor_dev_attr (attr)->index;struct gl518_data *data =gl518_update_device (dev);return sprintf (buf,"%u\n" , (data->beep_mask >> bitnr) &1 ); } -static ssize_t set_beep (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t beep_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {struct gl518_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -511,13 +509,13 @@ static ssize_t set_beep(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(in0_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 0); -static SENSOR_DEVICE_ATTR(in1_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 1); -static SENSOR_DEVICE_ATTR(in2_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 2); -static SENSOR_DEVICE_ATTR(in3_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 3); -static SENSOR_DEVICE_ATTR(temp1_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 4); -static SENSOR_DEVICE_ATTR(fan1_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 5); -static SENSOR_DEVICE_ATTR(fan2_beep, S_IRUGO|S_IWUSR, show_beep, set_beep, 6); +static SENSOR_DEVICE_ATTR_RW(in0_beep, beep, 0); +static SENSOR_DEVICE_ATTR_RW(in1_beep, beep, 1); +static SENSOR_DEVICE_ATTR_RW(in2_beep, beep, 2); +static SENSOR_DEVICE_ATTR_RW(in3_beep, beep, 3); +static SENSOR_DEVICE_ATTR_RW(temp1_beep, beep, 4); +static SENSOR_DEVICE_ATTR_RW(fan1_beep, beep, 5); +static SENSOR_DEVICE_ATTR_RW(fan2_beep, beep, 6);static struct attribute *gl518_attributes[] = { &dev_attr_in3_input.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 2/29 hwmon: (gl520sm) 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/gl520sm.c | 184 ++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 99 deletions(-)
drivers/hwmon/gl520sm.c +85 -99
@@ -216,8 +216,8 @@ static DEVICE_ATTR_RO(cpu0_vid);#define IN_CLAMP (val) clamp_val(val, 0, 255 * 19)#define IN_TO_REG (val) DIV_ROUND_CLOSEST(IN_CLAMP(val), 19) -static ssize_t get_in_input (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t in_input_show (struct device *dev, +struct device_attribute *attr,char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -229,8 +229,8 @@ static ssize_t get_in_input(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,IN_FROM_REG (r)); } -static ssize_t get_in_min (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t in_min_show (struct device *dev,struct device_attribute *attr, +char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -242,8 +242,8 @@ static ssize_t get_in_min(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,IN_FROM_REG (r)); } -static ssize_t get_in_max (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t in_max_show (struct device *dev,struct device_attribute *attr, +char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -255,8 +255,8 @@ static ssize_t get_in_max(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,IN_FROM_REG (r)); } -static ssize_t set_in_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t in_min_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -289,8 +289,8 @@ static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t set_in_max (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t in_max_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -323,31 +323,21 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, get_in_input, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, get_in_input, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, get_in_input, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, get_in_input, NULL, 3); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, get_in_input, NULL, 4); -static SENSOR_DEVICE_ATTR(in0_min, S_IRUGO | S_IWUSR, - get_in_min, set_in_min, 0); -static SENSOR_DEVICE_ATTR(in1_min, S_IRUGO | S_IWUSR, - get_in_min, set_in_min, 1); -static SENSOR_DEVICE_ATTR(in2_min, S_IRUGO | S_IWUSR, - get_in_min, set_in_min, 2); -static SENSOR_DEVICE_ATTR(in3_min, S_IRUGO | S_IWUSR, - get_in_min, set_in_min, 3); -static SENSOR_DEVICE_ATTR(in4_min, S_IRUGO | S_IWUSR, - get_in_min, set_in_min, 4); -static SENSOR_DEVICE_ATTR(in0_max, S_IRUGO | S_IWUSR, - get_in_max, set_in_max, 0); -static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO | S_IWUSR, - get_in_max, set_in_max, 1); -static SENSOR_DEVICE_ATTR(in2_max, S_IRUGO | S_IWUSR, - get_in_max, set_in_max, 2); -static SENSOR_DEVICE_ATTR(in3_max, S_IRUGO | S_IWUSR, - get_in_max, set_in_max, 3); -static SENSOR_DEVICE_ATTR(in4_max, S_IRUGO | S_IWUSR, - get_in_max, set_in_max, 4); +static SENSOR_DEVICE_ATTR_RO(in0_input, in_input, 0); +static SENSOR_DEVICE_ATTR_RO(in1_input, in_input, 1); +static SENSOR_DEVICE_ATTR_RO(in2_input, in_input, 2); +static SENSOR_DEVICE_ATTR_RO(in3_input, in_input, 3); +static SENSOR_DEVICE_ATTR_RO(in4_input, in_input, 4); +static SENSOR_DEVICE_ATTR_RW(in0_min, in_min, 0); +static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 1); +static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 2); +static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 3); +static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 4); +static SENSOR_DEVICE_ATTR_RW(in0_max, in_max, 0); +static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 1); +static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 2); +static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 3); +static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 4);#define DIV_FROM_REG (val) (1 << (val))#define FAN_FROM_REG (val, div) ((val) == 0 ? 0 : (480000 / ((val) << (div))))
@@ -359,8 +349,8 @@ static SENSOR_DEVICE_ATTR(in4_max, S_IRUGO | S_IWUSR, DIV_ROUND_CLOSEST(480000, \ FAN_CLAMP(val, div) << (div))) -static ssize_t get_fan_input (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t fan_input_show (struct device *dev, +struct device_attribute *attr,char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -369,8 +359,8 @@ static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr, data->fan_div[n])); } -static ssize_t get_fan_min (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t fan_min_show (struct device *dev,struct device_attribute *attr, +char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -379,8 +369,8 @@ static ssize_t get_fan_min(struct device *dev, struct device_attribute *attr, data->fan_div[n])); } -static ssize_t get_fan_div (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t fan_div_show (struct device *dev,struct device_attribute *attr, +char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -395,8 +385,9 @@ static ssize_t fan1_off_show(struct device *dev,return sprintf (buf,"%d\n" , data->fan_off); } -static ssize_t set_fan_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_min_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -434,8 +425,9 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t set_fan_div (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_div_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -508,24 +500,20 @@ static ssize_t fan1_off_store(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_fan_input, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, get_fan_input, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO | S_IWUSR, - get_fan_min, set_fan_min, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO | S_IWUSR, - get_fan_min, set_fan_min, 1); -static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, - get_fan_div, set_fan_div, 0); -static SENSOR_DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, - get_fan_div, set_fan_div, 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_RW(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1);static DEVICE_ATTR_RW (fan1_off);#define TEMP_FROM_REG (val) (((val) - 130) * 1000)#define TEMP_CLAMP (val) clamp_val(val, -130000, 125000)#define TEMP_TO_REG (val) (DIV_ROUND_CLOSEST(TEMP_CLAMP(val), 1000) + 130) -static ssize_t get_temp_input (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t temp_input_show (struct device *dev, +struct device_attribute *attr,char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -533,8 +521,8 @@ static ssize_t get_temp_input(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_input[n])); } -static ssize_t get_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) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -542,8 +530,8 @@ static ssize_t get_temp_max(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_max[n])); } -static ssize_t get_temp_max_hyst (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t temp_max_hyst_show (struct device *dev, +struct device_attribute *attr,char *buf) {int n =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -551,8 +539,9 @@ static ssize_t get_temp_max_hyst(struct device *dev,return sprintf (buf,"%d\n" ,TEMP_FROM_REG (data->temp_max_hyst[n])); } -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 gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -571,8 +560,9 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t set_temp_max_hyst (struct device *dev,struct device_attribute - *attr,const char *buf,size_t count) +static ssize_t temp_max_hyst_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -592,16 +582,12 @@ static ssize_t set_temp_max_hyst(struct device *dev, struct device_attributereturn count; } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, get_temp_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, get_temp_input, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, - get_temp_max, set_temp_max, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO | S_IWUSR, - get_temp_max, set_temp_max, 1); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, - get_temp_max_hyst, set_temp_max_hyst, 0); -static SENSOR_DEVICE_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR, - get_temp_max_hyst, set_temp_max_hyst, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 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_max_hyst, temp_max_hyst, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, temp_max_hyst, 1);static ssize_t alarms_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -674,8 +660,8 @@ static DEVICE_ATTR_RO(alarms);static DEVICE_ATTR_RW (beep_enable);static DEVICE_ATTR_RW (beep_mask); -static ssize_t get_alarm (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t alarm_show (struct device *dev,struct device_attribute *attr, +char *buf) {int bit_nr =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -683,18 +669,18 @@ static ssize_t get_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , (data->alarms >> bit_nr) &1 ); } -static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, get_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, get_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, get_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, get_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, get_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, get_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, get_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, get_alarm, NULL, 7); -static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, get_alarm, NULL, 7); +static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 4); +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 5); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 7); +static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 7); -static ssize_t get_beep (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t beep_show (struct device *dev,struct device_attribute *attr, +char *buf) {int bitnr =to_sensor_dev_attr (attr)->index;struct gl520_data *data =gl520_update_device (dev);
@@ -702,8 +688,8 @@ static ssize_t get_beep(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , (data->beep_mask >> bitnr) &1 ); } -static ssize_t set_beep (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t beep_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {struct gl520_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -729,15 +715,15 @@ static ssize_t set_beep(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(in0_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 0); -static SENSOR_DEVICE_ATTR(in1_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 1); -static SENSOR_DEVICE_ATTR(in2_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 2); -static SENSOR_DEVICE_ATTR(in3_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 3); -static SENSOR_DEVICE_ATTR(temp1_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 4); -static SENSOR_DEVICE_ATTR(fan1_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 5); -static SENSOR_DEVICE_ATTR(fan2_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 6); -static SENSOR_DEVICE_ATTR(temp2_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 7); -static SENSOR_DEVICE_ATTR(in4_beep, S_IRUGO | S_IWUSR, get_beep, set_beep, 7); +static SENSOR_DEVICE_ATTR_RW(in0_beep, beep, 0); +static SENSOR_DEVICE_ATTR_RW(in1_beep, beep, 1); +static SENSOR_DEVICE_ATTR_RW(in2_beep, beep, 2); +static SENSOR_DEVICE_ATTR_RW(in3_beep, beep, 3); +static SENSOR_DEVICE_ATTR_RW(temp1_beep, beep, 4); +static SENSOR_DEVICE_ATTR_RW(fan1_beep, beep, 5); +static SENSOR_DEVICE_ATTR_RW(fan2_beep, beep, 6); +static SENSOR_DEVICE_ATTR_RW(temp2_beep, beep, 7); +static SENSOR_DEVICE_ATTR_RW(in4_beep, beep, 7);static struct attribute *gl520_attributes[] = { &dev_attr_cpu0_vid.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 3/29 hwmon: (gpio-fan) 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/gpio-fan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/gpio-fan.c +1 -1
@@ -307,7 +307,7 @@ static DEVICE_ATTR_RO(pwm1_mode);static DEVICE_ATTR_RO (fan1_min);static DEVICE_ATTR_RO (fan1_max);static DEVICE_ATTR_RO (fan1_input); -static DEVICE_ATTR(fan1_target, S_IRUGO | S_IWUSR, fan1_input_show, set_rpm); +static DEVICE_ATTR(fan1_target, 0644, fan1_input_show, set_rpm);static umode_t gpio_fan_is_visible (struct kobject *kobj,struct attribute *attr,int index)
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 4/29 hwmon: (hih6130) 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/hih6130.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/hwmon/hih6130.c +4 -6
@@ -171,7 +171,7 @@ static int hih6130_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 hih6130_show_temperature (struct device *dev, +static ssize_t hih6130_temperature_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -193,7 +193,7 @@ static ssize_t hih6130_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 hih6130_show_humidity (struct device *dev, +static ssize_t hih6130_humidity_show (struct device *dev,struct device_attribute *attr,char *buf) {struct hih6130 *hih6130 =dev_get_drvdata (dev);
@@ -206,10 +206,8 @@ static ssize_t hih6130_show_humidity(struct device *dev, }/* sysfs attributes */ -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, hih6130_show_temperature, - NULL, 0); -static SENSOR_DEVICE_ATTR(humidity1_input, S_IRUGO, hih6130_show_humidity, - NULL, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_input, hih6130_temperature, 0); +static SENSOR_DEVICE_ATTR_RO(humidity1_input, hih6130_humidity, 0);static struct attribute *hih6130_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 5/29 hwmon: (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/hwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/hwmon.c +2 -2
@@ -278,10 +278,10 @@ static struct attribute *hwmon_genattr(struct device *dev,if (!mode)return ERR_PTR (-ENOENT ); -if ((mode &S_IRUGO ) && ((is_string && !ops->read_string) || +if ((mode &0444 ) && ((is_string && !ops->read_string) || (!is_string && !ops->read)))return ERR_PTR (-EINVAL ); -if ((mode &S_IWUGO ) && !ops->write) +if ((mode &0222 ) && !ops->write)return ERR_PTR (-EINVAL ); hattr =devm_kzalloc (dev,sizeof (*hattr),GFP_KERNEL );
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 6/29 hwmon: (i5500_temp) 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/i5500_temp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/hwmon/i5500_temp.c +7 -7
@@ -58,7 +58,7 @@ static ssize_t temp1_input_show(struct device *dev,return sprintf (buf,"%ld\n" , temp); } -static ssize_t show_thresh (struct device *dev, +static ssize_t thresh_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct pci_dev *pdev =to_pci_dev (dev->parent);
@@ -72,7 +72,7 @@ static ssize_t show_thresh(struct device *dev,return sprintf (buf,"%ld\n" , temp); } -static ssize_t show_alarm (struct device *dev, +static ssize_t alarm_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct pci_dev *pdev =to_pci_dev (dev->parent);
@@ -84,11 +84,11 @@ static ssize_t show_alarm(struct device *dev, }static DEVICE_ATTR_RO (temp1_input); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_thresh, NULL, 0xE2); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_thresh, NULL, 0xEC); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_thresh, NULL, 0xEE); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_crit, thresh, 0xE2); +static SENSOR_DEVICE_ATTR_RO(temp1_max_hyst, thresh, 0xEC); +static SENSOR_DEVICE_ATTR_RO(temp1_max, thresh, 0xEE); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 1);static struct attribute *i5500_temp_attrs[] = { &dev_attr_temp1_input.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 7/29 hwmon: (i5k_amb) 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/i5k_amb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/i5k_amb.c +6 -6
@@ -296,7 +296,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_label" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0444 ; iattr->s_attr.dev_attr.show = show_label; iattr->s_attr.index = k;sysfs_attr_init (&iattr->s_attr.dev_attr.attr);
@@ -311,7 +311,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_input" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0444 ; iattr->s_attr.dev_attr.show = show_amb_temp; iattr->s_attr.index = k;sysfs_attr_init (&iattr->s_attr.dev_attr.attr);
@@ -326,7 +326,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_min" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IWUSR |S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0644 ; iattr->s_attr.dev_attr.show = show_amb_min; iattr->s_attr.dev_attr.store = store_amb_min; iattr->s_attr.index = k;
@@ -342,7 +342,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_mid" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IWUSR |S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0644 ; iattr->s_attr.dev_attr.show = show_amb_mid; iattr->s_attr.dev_attr.store = store_amb_mid; iattr->s_attr.index = k;
@@ -358,7 +358,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_max" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IWUSR |S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0644 ; iattr->s_attr.dev_attr.show = show_amb_max; iattr->s_attr.dev_attr.store = store_amb_max; iattr->s_attr.index = k;
@@ -374,7 +374,7 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)snprintf (iattr->name,AMB_SYSFS_NAME_LEN ,"temp%d_alarm" , d); iattr->s_attr.dev_attr.attr.name = iattr->name; - iattr->s_attr.dev_attr.attr.mode =S_IRUGO ; + iattr->s_attr.dev_attr.attr.mode =0444 ; iattr->s_attr.dev_attr.show = show_amb_alarm; iattr->s_attr.index = k;sysfs_attr_init (&iattr->s_attr.dev_attr.attr);
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 8/29 hwmon: (ibmaem) 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/ibmaem.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/hwmon/ibmaem.c +7 -8
@@ -813,25 +813,24 @@ static void aem_bmc_gone(int iface)/* sysfs support functions */ /* AEM device name */ -static ssize_t show_name (struct device *dev,struct device_attribute *devattr, +static ssize_t name_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct aem_data *data =dev_get_drvdata (dev);return sprintf (buf,"%s%d\n" ,DRVNAME , data->ver_major); } -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(name, name, 0);/* AEM device version */ -static ssize_t show_version (struct device *dev, -struct device_attribute *devattr, -char *buf) +static ssize_t version_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct aem_data *data =dev_get_drvdata (dev);return sprintf (buf,"%d.%d\n" , data->ver_major, data->ver_minor); } -static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(version, version, 0);/* Display power use */ static ssize_t aem_show_power(struct device *dev,
@@ -931,7 +930,7 @@ static int aem_register_sensors(struct aem_data *data,while (ro->label) {sysfs_attr_init (&sensors->dev_attr.attr); sensors->dev_attr.attr.name = ro->label; - sensors->dev_attr.attr.mode =S_IRUGO ; + sensors->dev_attr.attr.mode =0444 ; sensors->dev_attr.show = ro->show; sensors->index = ro->index;
@@ -948,7 +947,7 @@ static int aem_register_sensors(struct aem_data *data,while (rw->label) {sysfs_attr_init (&sensors->dev_attr.attr); sensors->dev_attr.attr.name = rw->label; - sensors->dev_attr.attr.mode =S_IRUGO |S_IWUSR ; + sensors->dev_attr.attr.mode =0644 ; sensors->dev_attr.show = rw->show; sensors->dev_attr.store = rw->set; sensors->index = rw->index;
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 9/29 hwmon: (ibmpex) 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/ibmpex.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/hwmon/ibmpex.c +6 -8
@@ -269,12 +269,12 @@ static struct ibmpex_bmc_data *get_bmc_data(int iface)return NULL ; } -static ssize_t show_name (struct device *dev,struct device_attribute *devattr, +static ssize_t name_show (struct device *dev,struct device_attribute *devattr,char *buf) {return sprintf (buf,"%s\n" ,DRVNAME ); } -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); +static SENSOR_DEVICE_ATTR_RO(name, name, 0); static ssize_t ibmpex_show_sensor(struct device *dev, struct device_attribute *devattr,
@@ -289,10 +289,9 @@ static ssize_t ibmpex_show_sensor(struct device *dev, data->sensors[attr->index].values[attr->nr] * mult); } -static ssize_t ibmpex_reset_high_low (struct device *dev, +static ssize_t ibmpex_high_low_store (struct device *dev,struct device_attribute *devattr, -const char *buf, -size_t count) +const char *buf,size_t count) {struct ibmpex_bmc_data *data =dev_get_drvdata (dev);
@@ -301,8 +300,7 @@ static ssize_t ibmpex_reset_high_low(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(reset_high_low, S_IWUSR, NULL, - ibmpex_reset_high_low, 0); +static SENSOR_DEVICE_ATTR_WO(reset_high_low, ibmpex_high_low, 0);static int is_power_sensor (const char *sensor_id,int len) {
@@ -358,7 +356,7 @@ static int create_sensor(struct ibmpex_bmc_data *data, int type,sysfs_attr_init (&data->sensors[sensor].attr[func].dev_attr.attr); data->sensors[sensor].attr[func].dev_attr.attr.name = n; - data->sensors[sensor].attr[func].dev_attr.attr.mode =S_IRUGO ; + data->sensors[sensor].attr[func].dev_attr.attr.mode =0444 ; data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; data->sensors[sensor].attr[func].index = sensor; data->sensors[sensor].attr[func].nr = func;
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 10/29 hwmon: (iio_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/iio_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/iio_hwmon.c +1 -1
@@ -129,7 +129,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)return -ENOMEM ; a->dev_attr.show = iio_hwmon_read_val; - a->dev_attr.attr.mode =S_IRUGO ; + a->dev_attr.attr.mode =0444 ; a->index = i; st->attrs[i] = &a->dev_attr.attr; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 11/29 hwmon: (ina209) 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/ina209.c | 151 +++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 86 deletions(-)
drivers/hwmon/ina209.c +65 -86
@@ -230,9 +230,9 @@ static u16 ina209_reg_from_interval(u16 config, long interval)return (config &0xf807 ) | (adc <<3 ) | (adc <<7 ); } -static ssize_t ina209_set_interval (struct device *dev, -struct device_attribute *da, -const char *buf,size_t count) +static ssize_t ina209_interval_store (struct device *dev, +struct device_attribute *da, +const char *buf,size_t count) {struct ina209_data *data =ina209_update_device (dev);long val;
@@ -257,7 +257,7 @@ static ssize_t ina209_set_interval(struct device *dev,return count; } -static ssize_t ina209_show_interval (struct device *dev, +static ssize_t ina209_interval_show (struct device *dev,struct device_attribute *da,char *buf) {struct ina209_data *data =dev_get_drvdata (dev);
@@ -279,10 +279,9 @@ static u16 ina209_reset_history_regs[] = { INA209_POWER_PEAK }; -static ssize_t ina209_reset_history (struct device *dev, +static ssize_t ina209_history_store (struct device *dev,struct device_attribute *da, -const char *buf, -size_t count) +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);struct ina209_data *data =dev_get_drvdata (dev);
@@ -306,10 +305,9 @@ static ssize_t ina209_reset_history(struct device *dev,return count; } -static ssize_t ina209_set_value (struct device *dev, -struct device_attribute *da, -const char *buf, -size_t count) +static ssize_t ina209_value_store (struct device *dev, +struct device_attribute *da, +const char *buf,size_t count) {struct ina209_data *data =ina209_update_device (dev);struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -337,9 +335,8 @@ static ssize_t ina209_set_value(struct device *dev,return count; } -static ssize_t ina209_show_value (struct device *dev, -struct device_attribute *da, -char *buf) +static ssize_t ina209_value_show (struct device *dev, +struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);struct ina209_data *data =ina209_update_device (dev);
@@ -352,9 +349,8 @@ static ssize_t ina209_show_value(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%ld\n" , val); } -static ssize_t ina209_show_alarm (struct device *dev, -struct device_attribute *da, -char *buf) +static ssize_t ina209_alarm_show (struct device *dev, +struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);struct ina209_data *data =ina209_update_device (dev);
@@ -374,82 +370,65 @@ static ssize_t ina209_show_alarm(struct device *dev, }/* Shunt voltage, history, limits, alarms */ -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ina209_show_value, NULL, - INA209_SHUNT_VOLTAGE); -static SENSOR_DEVICE_ATTR(in0_input_highest, S_IRUGO, ina209_show_value, NULL, - INA209_SHUNT_VOLTAGE_POS_PEAK); -static SENSOR_DEVICE_ATTR(in0_input_lowest, S_IRUGO, ina209_show_value, NULL, - INA209_SHUNT_VOLTAGE_NEG_PEAK); -static SENSOR_DEVICE_ATTR(in0_reset_history, S_IWUSR, NULL, - ina209_reset_history, (1 << 0) | (1 << 1)); -static SENSOR_DEVICE_ATTR(in0_max, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_SHUNT_VOLTAGE_POS_WARN); -static SENSOR_DEVICE_ATTR(in0_min, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_SHUNT_VOLTAGE_NEG_WARN); -static SENSOR_DEVICE_ATTR(in0_crit_max, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_CRITICAL_DAC_POS); -static SENSOR_DEVICE_ATTR(in0_crit_min, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_CRITICAL_DAC_NEG); - -static SENSOR_DEVICE_ATTR(in0_min_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 11); -static SENSOR_DEVICE_ATTR(in0_max_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 12); -static SENSOR_DEVICE_ATTR(in0_crit_min_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 6); -static SENSOR_DEVICE_ATTR(in0_crit_max_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 7); +static SENSOR_DEVICE_ATTR_RO(in0_input, ina209_value, INA209_SHUNT_VOLTAGE); +static SENSOR_DEVICE_ATTR_RO(in0_input_highest, ina209_value, + INA209_SHUNT_VOLTAGE_POS_PEAK); +static SENSOR_DEVICE_ATTR_RO(in0_input_lowest, ina209_value, + INA209_SHUNT_VOLTAGE_NEG_PEAK); +static SENSOR_DEVICE_ATTR_WO(in0_reset_history, ina209_history, + (1 << 0) | (1 << 1)); +static SENSOR_DEVICE_ATTR_RW(in0_max, ina209_value, + INA209_SHUNT_VOLTAGE_POS_WARN); +static SENSOR_DEVICE_ATTR_RW(in0_min, ina209_value, + INA209_SHUNT_VOLTAGE_NEG_WARN); +static SENSOR_DEVICE_ATTR_RW(in0_crit_max, ina209_value, + INA209_CRITICAL_DAC_POS); +static SENSOR_DEVICE_ATTR_RW(in0_crit_min, ina209_value, + INA209_CRITICAL_DAC_NEG); + +static SENSOR_DEVICE_ATTR_RO(in0_min_alarm, ina209_alarm, 1 << 11); +static SENSOR_DEVICE_ATTR_RO(in0_max_alarm, ina209_alarm, 1 << 12); +static SENSOR_DEVICE_ATTR_RO(in0_crit_min_alarm, ina209_alarm, 1 << 6); +static SENSOR_DEVICE_ATTR_RO(in0_crit_max_alarm, ina209_alarm, 1 << 7);/* Bus voltage, history, limits, alarms */ -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ina209_show_value, NULL, - INA209_BUS_VOLTAGE); -static SENSOR_DEVICE_ATTR(in1_input_highest, S_IRUGO, ina209_show_value, NULL, - INA209_BUS_VOLTAGE_MAX_PEAK); -static SENSOR_DEVICE_ATTR(in1_input_lowest, S_IRUGO, ina209_show_value, NULL, - INA209_BUS_VOLTAGE_MIN_PEAK); -static SENSOR_DEVICE_ATTR(in1_reset_history, S_IWUSR, NULL, - ina209_reset_history, (1 << 2) | (1 << 3)); -static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_BUS_VOLTAGE_OVER_WARN); -static SENSOR_DEVICE_ATTR(in1_min, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_BUS_VOLTAGE_UNDER_WARN); -static SENSOR_DEVICE_ATTR(in1_crit_max, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_BUS_VOLTAGE_OVER_LIMIT); -static SENSOR_DEVICE_ATTR(in1_crit_min, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_BUS_VOLTAGE_UNDER_LIMIT); - -static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 14); -static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 15); -static SENSOR_DEVICE_ATTR(in1_crit_min_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 9); -static SENSOR_DEVICE_ATTR(in1_crit_max_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 10); +static SENSOR_DEVICE_ATTR_RO(in1_input, ina209_value, INA209_BUS_VOLTAGE); +static SENSOR_DEVICE_ATTR_RO(in1_input_highest, ina209_value, + INA209_BUS_VOLTAGE_MAX_PEAK); +static SENSOR_DEVICE_ATTR_RO(in1_input_lowest, ina209_value, + INA209_BUS_VOLTAGE_MIN_PEAK); +static SENSOR_DEVICE_ATTR_WO(in1_reset_history, ina209_history, + (1 << 2) | (1 << 3)); +static SENSOR_DEVICE_ATTR_RW(in1_max, ina209_value, + INA209_BUS_VOLTAGE_OVER_WARN); +static SENSOR_DEVICE_ATTR_RW(in1_min, ina209_value, + INA209_BUS_VOLTAGE_UNDER_WARN); +static SENSOR_DEVICE_ATTR_RW(in1_crit_max, ina209_value, + INA209_BUS_VOLTAGE_OVER_LIMIT); +static SENSOR_DEVICE_ATTR_RW(in1_crit_min, ina209_value, + INA209_BUS_VOLTAGE_UNDER_LIMIT); + +static SENSOR_DEVICE_ATTR_RO(in1_min_alarm, ina209_alarm, 1 << 14); +static SENSOR_DEVICE_ATTR_RO(in1_max_alarm, ina209_alarm, 1 << 15); +static SENSOR_DEVICE_ATTR_RO(in1_crit_min_alarm, ina209_alarm, 1 << 9); +static SENSOR_DEVICE_ATTR_RO(in1_crit_max_alarm, ina209_alarm, 1 << 10);/* Power */ -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ina209_show_value, NULL, - INA209_POWER); -static SENSOR_DEVICE_ATTR(power1_input_highest, S_IRUGO, ina209_show_value, - NULL, INA209_POWER_PEAK); -static SENSOR_DEVICE_ATTR(power1_reset_history, S_IWUSR, NULL, - ina209_reset_history, 1 << 4); -static SENSOR_DEVICE_ATTR(power1_max, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_POWER_WARN); -static SENSOR_DEVICE_ATTR(power1_crit, S_IRUGO | S_IWUSR, ina209_show_value, - ina209_set_value, INA209_POWER_OVER_LIMIT); - -static SENSOR_DEVICE_ATTR(power1_max_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 13); -static SENSOR_DEVICE_ATTR(power1_crit_alarm, S_IRUGO, ina209_show_alarm, NULL, - 1 << 8); +static SENSOR_DEVICE_ATTR_RO(power1_input, ina209_value, INA209_POWER); +static SENSOR_DEVICE_ATTR_RO(power1_input_highest, ina209_value, + INA209_POWER_PEAK); +static SENSOR_DEVICE_ATTR_WO(power1_reset_history, ina209_history, 1 << 4); +static SENSOR_DEVICE_ATTR_RW(power1_max, ina209_value, INA209_POWER_WARN); +static SENSOR_DEVICE_ATTR_RW(power1_crit, ina209_value, + INA209_POWER_OVER_LIMIT); + +static SENSOR_DEVICE_ATTR_RO(power1_max_alarm, ina209_alarm, 1 << 13); +static SENSOR_DEVICE_ATTR_RO(power1_crit_alarm, ina209_alarm, 1 << 8);/* Current */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ina209_show_value, NULL, - INA209_CURRENT); +static SENSOR_DEVICE_ATTR_RO(curr1_input, ina209_value, INA209_CURRENT); -static SENSOR_DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, - ina209_show_interval, ina209_set_interval, 0); +static SENSOR_DEVICE_ATTR_RW(update_interval, ina209_interval, 0);/* * Finally, construct an array of pointers to members of the above objects,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 12/29 hwmon: (ina3221) 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/ina3221.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/hwmon/ina3221.c +7 -10
@@ -499,7 +499,7 @@ static const struct hwmon_chip_info ina3221_chip_info = { };/* Extra attribute groups */ -static ssize_t ina3221_show_shunt (struct device *dev, +static ssize_t ina3221_shunt_show (struct device *dev,struct device_attribute *attr,char *buf) {struct sensor_device_attribute *sd_attr =to_sensor_dev_attr (attr);
@@ -510,9 +510,9 @@ static ssize_t ina3221_show_shunt(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , input->shunt_resistor); } -static ssize_t ina3221_set_shunt (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t ina3221_shunt_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {struct sensor_device_attribute *sd_attr =to_sensor_dev_attr (attr);struct ina3221_data *ina =dev_get_drvdata (dev);
@@ -533,12 +533,9 @@ static ssize_t ina3221_set_shunt(struct device *dev, }/* shunt resistance */ -static SENSOR_DEVICE_ATTR(shunt1_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL1); -static SENSOR_DEVICE_ATTR(shunt2_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL2); -static SENSOR_DEVICE_ATTR(shunt3_resistor, S_IRUGO | S_IWUSR, - ina3221_show_shunt, ina3221_set_shunt, INA3221_CHANNEL3); +static SENSOR_DEVICE_ATTR_RW(shunt1_resistor, ina3221_shunt, INA3221_CHANNEL1); +static SENSOR_DEVICE_ATTR_RW(shunt2_resistor, ina3221_shunt, INA3221_CHANNEL2); +static SENSOR_DEVICE_ATTR_RW(shunt3_resistor, ina3221_shunt, INA3221_CHANNEL3);static struct attribute *ina3221_attrs[] = { &sensor_dev_attr_shunt1_resistor.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 13/29 hwmon: (jc42) 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/jc42.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/jc42.c +4 -4
@@ -390,21 +390,21 @@ static umode_t jc42_is_visible(const void *_data, enum hwmon_sensor_types type, {const struct jc42_data *data = _data;unsigned int config = data->config; -umode_t mode =S_IRUGO ; +umode_t mode =0444 ;switch (attr) {case hwmon_temp_min:case hwmon_temp_max:if (!(config &JC42_CFG_EVENT_LOCK )) - mode |=S_IWUSR ; + mode |=0200 ;break ;case hwmon_temp_crit:if (!(config &JC42_CFG_TCRIT_LOCK )) - mode |=S_IWUSR ; + mode |=0200 ;break ;case hwmon_temp_crit_hyst:if (!(config & (JC42_CFG_EVENT_LOCK |JC42_CFG_TCRIT_LOCK ))) - mode |=S_IWUSR ; + mode |=0200 ;break ;case hwmon_temp_input:case hwmon_temp_max_hyst:
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 14/29 hwmon: (k8temp) 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/k8temp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/k8temp.c +6 -6
@@ -109,8 +109,8 @@ static ssize_t name_show(struct device *dev, struct device_attribute } -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_2 *attr =to_sensor_dev_attr_2 (devattr);
@@ -129,10 +129,10 @@ static ssize_t show_temp(struct device *dev,/* core, place */ -static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 0); -static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 1); -static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0); -static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); +static SENSOR_DEVICE_ATTR_2_RO(temp1_input, temp, 0, 0); +static SENSOR_DEVICE_ATTR_2_RO(temp2_input, temp, 0, 1); +static SENSOR_DEVICE_ATTR_2_RO(temp3_input, temp, 1, 0); +static SENSOR_DEVICE_ATTR_2_RO(temp4_input, temp, 1, 1);static DEVICE_ATTR_RO (name);static const struct pci_device_id k8temp_ids[] = {
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 15/29 hwmon: (lineage-pem) 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/lineage-pem.c | 77 +++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 44 deletions(-)
drivers/hwmon/lineage-pem.c +33 -44
@@ -282,8 +282,8 @@ static long pem_get_fan(u8 *data, int len, int index)* Show boolean, either a fault or an alarm. * .nr points to the register, .index is the bit mask to check */ -static ssize_t pem_show_bool (struct device *dev, -struct device_attribute *da,char *buf) +static ssize_t pem_bool_show (struct device *dev,struct device_attribute *da, +char *buf) {struct sensor_device_attribute_2 *attr =to_sensor_dev_attr_2 (da);struct pem_data *data =pem_update_device (dev);
@@ -296,7 +296,7 @@ static ssize_t pem_show_bool(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , !!status); } -static ssize_t pem_show_data (struct device *dev,struct device_attribute *da, +static ssize_t pem_data_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -312,7 +312,7 @@ static ssize_t pem_show_data(struct device *dev, struct device_attribute *da,return snprintf (buf,PAGE_SIZE ,"%ld\n" , value); } -static ssize_t pem_show_input (struct device *dev,struct device_attribute *da, +static ssize_t pem_input_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -328,7 +328,7 @@ static ssize_t pem_show_input(struct device *dev, struct device_attribute *da,return snprintf (buf,PAGE_SIZE ,"%ld\n" , value); } -static ssize_t pem_show_fan (struct device *dev,struct device_attribute *da, +static ssize_t pem_fan_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -345,53 +345,42 @@ static ssize_t pem_show_fan(struct device *dev, struct device_attribute *da, }/* Voltages */ -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, pem_show_data, NULL, - PEM_DATA_VOUT_LSB); -static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_VOUT_OUT_LIMIT); -static SENSOR_DEVICE_ATTR_2(in1_crit_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_OV_VOLT_SHUTDOWN); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, pem_show_input, NULL, - PEM_INPUT_VOLTAGE); -static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, - ALRM1_VIN_OUT_LIMIT | ALRM1_PRIMARY_FAULT); +static SENSOR_DEVICE_ATTR_RO(in1_input, pem_data, PEM_DATA_VOUT_LSB); +static SENSOR_DEVICE_ATTR_2_RO(in1_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_VOUT_OUT_LIMIT); +static SENSOR_DEVICE_ATTR_2_RO(in1_crit_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_OV_VOLT_SHUTDOWN); +static SENSOR_DEVICE_ATTR_RO(in2_input, pem_input, PEM_INPUT_VOLTAGE); +static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_VIN_OUT_LIMIT | ALRM1_PRIMARY_FAULT);/* Currents */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, pem_show_data, NULL, - PEM_DATA_CURRENT); -static SENSOR_DEVICE_ATTR_2(curr1_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_VIN_OVERCURRENT); +static SENSOR_DEVICE_ATTR_RO(curr1_input, pem_data, PEM_DATA_CURRENT); +static SENSOR_DEVICE_ATTR_2_RO(curr1_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_VIN_OVERCURRENT);/* Power */ -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, pem_show_input, NULL, - PEM_INPUT_POWER_LSB); -static SENSOR_DEVICE_ATTR_2(power1_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_POWER_LIMIT); +static SENSOR_DEVICE_ATTR_RO(power1_input, pem_input, PEM_INPUT_POWER_LSB); +static SENSOR_DEVICE_ATTR_2_RO(power1_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_POWER_LIMIT);/* Fans */ -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, pem_show_fan, NULL, - PEM_FAN_FAN1); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, pem_show_fan, NULL, - PEM_FAN_FAN2); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, pem_show_fan, NULL, - PEM_FAN_FAN3); -static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_2, ALRM2_FAN_FAULT); +static SENSOR_DEVICE_ATTR_RO(fan1_input, pem_fan, PEM_FAN_FAN1); +static SENSOR_DEVICE_ATTR_RO(fan2_input, pem_fan, PEM_FAN_FAN2); +static SENSOR_DEVICE_ATTR_RO(fan3_input, pem_fan, PEM_FAN_FAN3); +static SENSOR_DEVICE_ATTR_2_RO(fan1_alarm, pem_bool, PEM_DATA_ALARM_2, + ALRM2_FAN_FAULT);/* Temperatures */ -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, pem_show_data, NULL, - PEM_DATA_TEMP); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, pem_show_data, NULL, - PEM_DATA_TEMP_MAX); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, pem_show_data, NULL, - PEM_DATA_TEMP_CRIT); -static SENSOR_DEVICE_ATTR_2(temp1_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_TEMP_WARNING); -static SENSOR_DEVICE_ATTR_2(temp1_crit_alarm, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_1, ALRM1_TEMP_SHUTDOWN); -static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, pem_show_bool, NULL, - PEM_DATA_ALARM_2, ALRM2_TEMP_FAULT); +static SENSOR_DEVICE_ATTR_RO(temp1_input, pem_data, PEM_DATA_TEMP); +static SENSOR_DEVICE_ATTR_RO(temp1_max, pem_data, PEM_DATA_TEMP_MAX); +static SENSOR_DEVICE_ATTR_RO(temp1_crit, pem_data, PEM_DATA_TEMP_CRIT); +static SENSOR_DEVICE_ATTR_2_RO(temp1_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_TEMP_WARNING); +static SENSOR_DEVICE_ATTR_2_RO(temp1_crit_alarm, pem_bool, PEM_DATA_ALARM_1, + ALRM1_TEMP_SHUTDOWN); +static SENSOR_DEVICE_ATTR_2_RO(temp1_fault, pem_bool, PEM_DATA_ALARM_2, + ALRM2_TEMP_FAULT);static struct attribute *pem_attributes[] = { &sensor_dev_attr_in1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 16/29 hwmon: (lm73) 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/lm73.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
drivers/hwmon/lm73.c +15 -19
@@ -62,8 +62,8 @@ struct lm73_data {/*-----------------------------------------------------------------------*/ -static ssize_t set_temp (struct device *dev,struct device_attribute *da, -const char *buf,size_t count) +static ssize_t temp_store (struct device *dev,struct device_attribute *da, +const char *buf,size_t count) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);struct lm73_data *data =dev_get_drvdata (dev);
@@ -81,7 +81,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,return (err <0 ) ? err : count; } -static ssize_t show_temp (struct device *dev,struct device_attribute *da, +static ssize_t temp_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -98,8 +98,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,return scnprintf (buf,PAGE_SIZE ,"%d\n" , temp); } -static ssize_t set_convrate (struct device *dev,struct device_attribute *da, -const char *buf,size_t count) +static ssize_t convrate_store (struct device *dev,struct device_attribute *da, +const char *buf,size_t count) {struct lm73_data *data =dev_get_drvdata (dev);unsigned long convrate;
@@ -133,7 +133,7 @@ static ssize_t set_convrate(struct device *dev, struct device_attribute *da,return count; } -static ssize_t show_convrate (struct device *dev,struct device_attribute *da, +static ssize_t convrate_show (struct device *dev,struct device_attribute *da,char *buf) {struct lm73_data *data =dev_get_drvdata (dev);
@@ -143,7 +143,7 @@ static ssize_t show_convrate(struct device *dev, struct device_attribute *da,return scnprintf (buf,PAGE_SIZE ,"%hu\n" , lm73_convrates[res]); } -static ssize_t show_maxmin_alarm (struct device *dev, +static ssize_t maxmin_alarm_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -168,18 +168,14 @@ static ssize_t show_maxmin_alarm(struct device *dev,/* sysfs attributes for hwmon */ -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, - show_temp, set_temp, LM73_REG_MAX); -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, - show_temp, set_temp, LM73_REG_MIN); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, - show_temp, NULL, LM73_REG_INPUT); -static SENSOR_DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO, - show_convrate, set_convrate, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, - show_maxmin_alarm, NULL, LM73_CTRL_HI_SHIFT); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, - show_maxmin_alarm, NULL, LM73_CTRL_LO_SHIFT); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, LM73_REG_MAX); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, LM73_REG_MIN); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, LM73_REG_INPUT); +static SENSOR_DEVICE_ATTR_RW(update_interval, convrate, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, maxmin_alarm, + LM73_CTRL_HI_SHIFT); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, maxmin_alarm, + LM73_CTRL_LO_SHIFT);static struct attribute *lm73_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 17/29 hwmon: (lm75) 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/lm75.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/lm75.c +3 -3
@@ -176,16 +176,16 @@ static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type,case hwmon_chip:switch (attr) {case hwmon_chip_update_interval: -return S_IRUGO ; +return 0444 ; }break ;case hwmon_temp:switch (attr) {case hwmon_temp_input: -return S_IRUGO ; +return 0444 ;case hwmon_temp_max:case hwmon_temp_max_hyst: -return S_IRUGO |S_IWUSR ; +return 0644 ; }break ;default :
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 18/29 hwmon: (lm77) 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/lm77.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/hwmon/lm77.c +21 -24
@@ -137,7 +137,7 @@ static struct lm77_data *lm77_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);
@@ -146,7 +146,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,return sprintf (buf,"%d\n" , data->temp[attr->index]); } -static ssize_t show_temp_hyst (struct device *dev, +static ssize_t temp_hyst_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -160,8 +160,9 @@ static ssize_t show_temp_hyst(struct device *dev,return sprintf (buf,"%d\n" , temp); } -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 lm77_data *data =dev_get_drvdata (dev);
@@ -186,9 +187,9 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,* hysteresis is stored as a relative value on the chip, so it has to be * converted first. */ -static ssize_t set_temp_hyst (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t temp_hyst_store (struct device *dev, +struct device_attribute *devattr, +const char *buf,size_t count) {struct lm77_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -208,7 +209,7 @@ static ssize_t set_temp_hyst(struct device *dev,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;
@@ -216,22 +217,18 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%u\n" , (data->alarms >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_crit); -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_min); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_max); - -static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst, - set_temp_hyst, t_crit); -static SENSOR_DEVICE_ATTR(temp1_min_hyst, S_IRUGO, show_temp_hyst, NULL, t_min); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp_hyst, NULL, t_max); - -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp, t_crit); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, t_min); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, t_max); + +static SENSOR_DEVICE_ATTR_RW(temp1_crit_hyst, temp_hyst, t_crit); +static SENSOR_DEVICE_ATTR_RO(temp1_min_hyst, temp_hyst, t_min); +static SENSOR_DEVICE_ATTR_RO(temp1_max_hyst, temp_hyst, t_max); + +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 1);static struct attribute *lm77_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 19/29 hwmon: (lm80) 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/lm80.c | 138 ++++++++++++++++++++++----------------------------- 1 file changed, 59 insertions(+), 79 deletions(-)
drivers/hwmon/lm80.c +59 -79
@@ -269,7 +269,7 @@ static struct lm80_data *lm80_update_device(struct device *dev)* Sysfs stuff */ -static ssize_t show_in (struct device *dev,struct device_attribute *attr, +static ssize_t in_show (struct device *dev,struct device_attribute *attr,char *buf) {struct lm80_data *data =lm80_update_device (dev);
@@ -281,8 +281,8 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,IN_FROM_REG (data->in[nr][index])); } -static ssize_t set_in (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t in_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {struct lm80_data *data =dev_get_drvdata (dev);struct i2c_client *client = data->client;
@@ -303,7 +303,7 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr,return count; } -static ssize_t show_fan (struct device *dev,struct device_attribute *attr, +static ssize_t fan_show (struct device *dev,struct device_attribute *attr,char *buf) {int index =to_sensor_dev_attr_2 (attr)->index;
@@ -315,8 +315,8 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr, DIV_FROM_REG(data->fan_div[index]))); } -static ssize_t show_fan_div (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t fan_div_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr =to_sensor_dev_attr (attr)->index;struct lm80_data *data =lm80_update_device (dev);
@@ -325,8 +325,8 @@ static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,DIV_FROM_REG (data->fan_div[nr])); } -static ssize_t set_fan_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int index =to_sensor_dev_attr_2 (attr)->index;int nr =to_sensor_dev_attr_2 (attr)->nr;
@@ -352,8 +352,9 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,* least surprise; the user doesn't expect the fan minimum to change just * because the divisor changed. */ -static ssize_t set_fan_div (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_div_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {int nr =to_sensor_dev_attr (attr)->index;struct lm80_data *data =dev_get_drvdata (dev);
@@ -410,7 +411,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,return count; } -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);
@@ -420,8 +421,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 lm80_data *data =dev_get_drvdata (dev);
@@ -448,7 +450,7 @@ static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%u\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;
@@ -458,72 +460,50 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%u\n" , (data->alarms >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 0); -static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 1); -static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 2); -static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 3); -static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 4); -static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 5); -static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, - show_in, set_in, i_min, 6); -static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 0); -static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 1); -static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 2); -static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 3); -static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 4); -static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 5); -static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, - show_in, set_in, i_max, 6); -static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, show_in, NULL, i_input, 0); -static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_in, NULL, i_input, 1); -static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_in, NULL, i_input, 2); -static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, show_in, NULL, i_input, 3); -static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, show_in, NULL, i_input, 4); -static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, show_in, NULL, i_input, 5); -static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, show_in, NULL, i_input, 6); -static SENSOR_DEVICE_ATTR_2(fan1_min, S_IWUSR | S_IRUGO, - show_fan, set_fan_min, f_min, 0); -static SENSOR_DEVICE_ATTR_2(fan2_min, S_IWUSR | S_IRUGO, - show_fan, set_fan_min, f_min, 1); -static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, f_input, 0); -static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, f_input, 1); -static SENSOR_DEVICE_ATTR(fan1_div, S_IWUSR | S_IRUGO, - show_fan_div, set_fan_div, 0); -static SENSOR_DEVICE_ATTR(fan2_div, S_IWUSR | S_IRUGO, - show_fan_div, set_fan_div, 1); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_hot_max); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_hot_hyst); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_os_max); -static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp, - set_temp, t_os_hyst); +static SENSOR_DEVICE_ATTR_2_RW(in0_min, in, i_min, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_min, in, i_min, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_min, in, i_min, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_min, in, i_min, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_min, in, i_min, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_min, in, i_min, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_min, in, i_min, 6); +static SENSOR_DEVICE_ATTR_2_RW(in0_max, in, i_max, 0); +static SENSOR_DEVICE_ATTR_2_RW(in1_max, in, i_max, 1); +static SENSOR_DEVICE_ATTR_2_RW(in2_max, in, i_max, 2); +static SENSOR_DEVICE_ATTR_2_RW(in3_max, in, i_max, 3); +static SENSOR_DEVICE_ATTR_2_RW(in4_max, in, i_max, 4); +static SENSOR_DEVICE_ATTR_2_RW(in5_max, in, i_max, 5); +static SENSOR_DEVICE_ATTR_2_RW(in6_max, in, i_max, 6); +static SENSOR_DEVICE_ATTR_2_RO(in0_input, in, i_input, 0); +static SENSOR_DEVICE_ATTR_2_RO(in1_input, in, i_input, 1); +static SENSOR_DEVICE_ATTR_2_RO(in2_input, in, i_input, 2); +static SENSOR_DEVICE_ATTR_2_RO(in3_input, in, i_input, 3); +static SENSOR_DEVICE_ATTR_2_RO(in4_input, in, i_input, 4); +static SENSOR_DEVICE_ATTR_2_RO(in5_input, in, i_input, 5); +static SENSOR_DEVICE_ATTR_2_RO(in6_input, in, i_input, 6); +static SENSOR_DEVICE_ATTR_2_RW(fan1_min, fan, f_min, 0); +static SENSOR_DEVICE_ATTR_2_RW(fan2_min, fan, f_min, 1); +static SENSOR_DEVICE_ATTR_2_RO(fan1_input, fan, f_input, 0); +static SENSOR_DEVICE_ATTR_2_RO(fan2_input, fan, f_input, 1); +static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, t_hot_max); +static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp, t_hot_hyst); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp, t_os_max); +static SENSOR_DEVICE_ATTR_RW(temp1_crit_hyst, temp, t_os_hyst);static DEVICE_ATTR_RO (alarms); -static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 10); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 11); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 8); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 13); +static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 4); +static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm, 5); +static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 10); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 11); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 8); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 13);/* * Real code
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 20/29 hwmon: (lm83) 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/lm83.c | 62 ++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 33 deletions(-)
drivers/hwmon/lm83.c +29 -33
@@ -158,7 +158,7 @@ static struct lm83_data *lm83_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);
@@ -166,8 +166,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 lm83_data *data =dev_get_drvdata (dev);
@@ -195,8 +196,8 @@ static ssize_t alarms_show(struct device *dev, struct device_attribute *dummy,return sprintf (buf,"%d\n" , data->alarms); } -static ssize_t show_alarm (struct device *dev,struct device_attribute - *devattr,char *buf) +static ssize_t alarm_show (struct device *dev, +struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);struct lm83_data *data =lm83_update_device (dev);
@@ -205,36 +206,31 @@ static ssize_t show_alarm(struct device *dev, struct device_attributereturn sprintf (buf,"%d\n" , (data->alarms >> bitnr) &1 ); } -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(temp1_max, S_IWUSR | S_IRUGO, show_temp, - set_temp, 4); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp, - set_temp, 5); -static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_temp, - set_temp, 6); -static SENSOR_DEVICE_ATTR(temp4_max, S_IWUSR | S_IRUGO, show_temp, - set_temp, 7); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL, 8); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp, NULL, 8); -static SENSOR_DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp, - set_temp, 8); -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp, NULL, 8); +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_RW(temp1_max, temp, 4); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp, 5); +static SENSOR_DEVICE_ATTR_RW(temp3_max, temp, 6); +static SENSOR_DEVICE_ATTR_RW(temp4_max, temp, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp, 8); +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp, 8); +static SENSOR_DEVICE_ATTR_RW(temp3_crit, temp, 8); +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp, 8);/* Individual alarm files */ -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 8); -static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, show_alarm, NULL, 9); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_alarm, NULL, 10); -static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_alarm, NULL, 12); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 13); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 15); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, 8); +static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, alarm, 9); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, alarm, 10); +static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, alarm, 12); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 13); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 15);/* Raw alarm file for compatibility */ static DEVICE_ATTR_RO (alarms);
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 21/29 hwmon: (lm90) 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/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/lm90.c +6 -6
@@ -1266,17 +1266,17 @@ static umode_t lm90_temp_is_visible(const void *data, u32 attr, int channel)case hwmon_temp_emergency_alarm:case hwmon_temp_emergency_hyst:case hwmon_temp_fault: -return S_IRUGO ; +return 0444 ;case hwmon_temp_min:case hwmon_temp_max:case hwmon_temp_crit:case hwmon_temp_emergency:case hwmon_temp_offset: -return S_IRUGO |S_IWUSR ; +return 0644 ;case hwmon_temp_crit_hyst:if (channel ==0 ) -return S_IRUGO |S_IWUSR ; -return S_IRUGO ; +return 0644 ; +return 0444 ;default :return 0 ; }
@@ -1338,9 +1338,9 @@ static umode_t lm90_chip_is_visible(const void *data, u32 attr, int channel) {switch (attr) {case hwmon_chip_update_interval: -return S_IRUGO |S_IWUSR ; +return 0644 ;case hwmon_chip_alarms: -return S_IRUGO ; +return 0444 ;default :return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 22/29 hwmon: (lm92) 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/lm92.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-)
drivers/hwmon/lm92.c +18 -21
@@ -143,7 +143,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)return data; } -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);
@@ -152,8 +152,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 lm92_data *data =dev_get_drvdata (dev);
@@ -173,7 +174,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,return count; } -static ssize_t show_temp_hyst (struct device *dev, +static ssize_t temp_hyst_show (struct device *dev,struct device_attribute *devattr,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (devattr);
@@ -192,9 +193,9 @@ static ssize_t temp1_min_hyst_show(struct device *dev, + TEMP_FROM_REG(data->temp[t_hyst])); } -static ssize_t set_temp_hyst (struct device *dev, -struct device_attribute *devattr, -const char *buf,size_t count) +static ssize_t temp_hyst_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 lm92_data *data =dev_get_drvdata (dev);
@@ -224,7 +225,7 @@ static ssize_t alarms_show(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,ALARMS_FROM_REG (data->temp[t_input])); } -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;
@@ -232,21 +233,17 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" , (data->temp[t_input] >> bitnr) &1 ); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, t_input); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_crit); -static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst, - set_temp_hyst, t_crit); -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_min); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, t_input); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp, t_crit); +static SENSOR_DEVICE_ATTR_RW(temp1_crit_hyst, temp_hyst, t_crit); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp, t_min);static DEVICE_ATTR_RO (temp1_min_hyst); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, - t_max); -static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp_hyst, NULL, t_max); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, t_max); +static SENSOR_DEVICE_ATTR_RO(temp1_max_hyst, temp_hyst, t_max);static DEVICE_ATTR_RO (alarms); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 1);/* * Detection and registration
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 23/29 hwmon: (lm93) 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/lm93.c | 630 +++++++++++++++++++++------------------------------ 1 file changed, 256 insertions(+), 374 deletions(-)
drivers/hwmon/lm93.c +256 -374
@@ -1111,8 +1111,8 @@ static void lm93_update_client_min(struct lm93_data *data, }/* following are the sysfs callback functions */ -static ssize_t show_in (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t in_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1120,25 +1120,25 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,LM93_IN_FROM_REG (nr, data->block3[nr])); } -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 0); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 1); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 2); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 3); -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_in, NULL, 4); -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_in, NULL, 5); -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_in, NULL, 6); -static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_in, NULL, 7); -static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, show_in, NULL, 8); -static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, show_in, NULL, 9); -static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, show_in, NULL, 10); -static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, show_in, NULL, 11); -static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, show_in, NULL, 12); -static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, show_in, NULL, 13); -static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, show_in, NULL, 14); -static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in, NULL, 15); - -static ssize_t show_in_min (struct device *dev, -struct device_attribute *attr,char *buf) +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 0); +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 1); +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 2); +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 3); +static SENSOR_DEVICE_ATTR_RO(in5_input, in, 4); +static SENSOR_DEVICE_ATTR_RO(in6_input, in, 5); +static SENSOR_DEVICE_ATTR_RO(in7_input, in, 6); +static SENSOR_DEVICE_ATTR_RO(in8_input, in, 7); +static SENSOR_DEVICE_ATTR_RO(in9_input, in, 8); +static SENSOR_DEVICE_ATTR_RO(in10_input, in, 9); +static SENSOR_DEVICE_ATTR_RO(in11_input, in, 10); +static SENSOR_DEVICE_ATTR_RO(in12_input, in, 11); +static SENSOR_DEVICE_ATTR_RO(in13_input, in, 12); +static SENSOR_DEVICE_ATTR_RO(in14_input, in, 13); +static SENSOR_DEVICE_ATTR_RO(in15_input, in, 14); +static SENSOR_DEVICE_ATTR_RO(in16_input, in, 15); + +static ssize_t in_min_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1154,7 +1154,7 @@ static ssize_t show_in_min(struct device *dev,return sprintf (buf,"%ld\n" , rc); } -static ssize_t store_in_min (struct device *dev,struct device_attribute *attr, +static ssize_t in_min_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1185,41 +1185,25 @@ static ssize_t store_in_min(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 0); -static SENSOR_DEVICE_ATTR(in2_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 1); -static SENSOR_DEVICE_ATTR(in3_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 2); -static SENSOR_DEVICE_ATTR(in4_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 3); -static SENSOR_DEVICE_ATTR(in5_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 4); -static SENSOR_DEVICE_ATTR(in6_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 5); -static SENSOR_DEVICE_ATTR(in7_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 6); -static SENSOR_DEVICE_ATTR(in8_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 7); -static SENSOR_DEVICE_ATTR(in9_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 8); -static SENSOR_DEVICE_ATTR(in10_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 9); -static SENSOR_DEVICE_ATTR(in11_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 10); -static SENSOR_DEVICE_ATTR(in12_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 11); -static SENSOR_DEVICE_ATTR(in13_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 12); -static SENSOR_DEVICE_ATTR(in14_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 13); -static SENSOR_DEVICE_ATTR(in15_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 14); -static SENSOR_DEVICE_ATTR(in16_min, S_IWUSR | S_IRUGO, - show_in_min, store_in_min, 15); - -static ssize_t show_in_max (struct device *dev, -struct device_attribute *attr,char *buf) +static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 0); +static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 1); +static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 2); +static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 3); +static SENSOR_DEVICE_ATTR_RW(in5_min, in_min, 4); +static SENSOR_DEVICE_ATTR_RW(in6_min, in_min, 5); +static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 6); +static SENSOR_DEVICE_ATTR_RW(in8_min, in_min, 7); +static SENSOR_DEVICE_ATTR_RW(in9_min, in_min, 8); +static SENSOR_DEVICE_ATTR_RW(in10_min, in_min, 9); +static SENSOR_DEVICE_ATTR_RW(in11_min, in_min, 10); +static SENSOR_DEVICE_ATTR_RW(in12_min, in_min, 11); +static SENSOR_DEVICE_ATTR_RW(in13_min, in_min, 12); +static SENSOR_DEVICE_ATTR_RW(in14_min, in_min, 13); +static SENSOR_DEVICE_ATTR_RW(in15_min, in_min, 14); +static SENSOR_DEVICE_ATTR_RW(in16_min, in_min, 15); + +static ssize_t in_max_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1235,7 +1219,7 @@ static ssize_t show_in_max(struct device *dev,return sprintf (buf,"%ld\n" , rc); } -static ssize_t store_in_max (struct device *dev,struct device_attribute *attr, +static ssize_t in_max_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1266,61 +1250,46 @@ static ssize_t store_in_max(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(in1_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 0); -static SENSOR_DEVICE_ATTR(in2_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 1); -static SENSOR_DEVICE_ATTR(in3_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 2); -static SENSOR_DEVICE_ATTR(in4_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 3); -static SENSOR_DEVICE_ATTR(in5_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 4); -static SENSOR_DEVICE_ATTR(in6_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 5); -static SENSOR_DEVICE_ATTR(in7_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 6); -static SENSOR_DEVICE_ATTR(in8_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 7); -static SENSOR_DEVICE_ATTR(in9_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 8); -static SENSOR_DEVICE_ATTR(in10_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 9); -static SENSOR_DEVICE_ATTR(in11_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 10); -static SENSOR_DEVICE_ATTR(in12_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 11); -static SENSOR_DEVICE_ATTR(in13_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 12); -static SENSOR_DEVICE_ATTR(in14_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 13); -static SENSOR_DEVICE_ATTR(in15_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 14); -static SENSOR_DEVICE_ATTR(in16_max, S_IWUSR | S_IRUGO, - show_in_max, store_in_max, 15); - -static ssize_t show_temp (struct device *dev, -struct device_attribute *attr,char *buf) +static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 0); +static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 1); +static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 2); +static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 3); +static SENSOR_DEVICE_ATTR_RW(in5_max, in_max, 4); +static SENSOR_DEVICE_ATTR_RW(in6_max, in_max, 5); +static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 6); +static SENSOR_DEVICE_ATTR_RW(in8_max, in_max, 7); +static SENSOR_DEVICE_ATTR_RW(in9_max, in_max, 8); +static SENSOR_DEVICE_ATTR_RW(in10_max, in_max, 9); +static SENSOR_DEVICE_ATTR_RW(in11_max, in_max, 10); +static SENSOR_DEVICE_ATTR_RW(in12_max, in_max, 11); +static SENSOR_DEVICE_ATTR_RW(in13_max, in_max, 12); +static SENSOR_DEVICE_ATTR_RW(in14_max, in_max, 13); +static SENSOR_DEVICE_ATTR_RW(in15_max, in_max, 14); +static SENSOR_DEVICE_ATTR_RW(in16_max, in_max, 15); + +static ssize_t temp_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);return sprintf (buf,"%d\n" ,LM93_TEMP_FROM_REG (data->block2[nr])); } -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_RO(temp1_input, temp, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); -static ssize_t show_temp_min (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t temp_min_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);return sprintf (buf,"%d\n" ,LM93_TEMP_FROM_REG (data->temp_lim[nr].min)); } -static ssize_t store_temp_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_min_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1339,14 +1308,11 @@ static ssize_t store_temp_min(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, - show_temp_min, store_temp_min, 0); -static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, - show_temp_min, store_temp_min, 1); -static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, - show_temp_min, store_temp_min, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2); -static ssize_t show_temp_max (struct device *dev, +static ssize_t temp_max_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1354,8 +1320,9 @@ static ssize_t show_temp_max(struct device *dev,return sprintf (buf,"%d\n" ,LM93_TEMP_FROM_REG (data->temp_lim[nr].max)); } -static ssize_t store_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) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1374,24 +1341,21 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, - show_temp_max, store_temp_max, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, - show_temp_max, store_temp_max, 1); -static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, - show_temp_max, store_temp_max, 2); +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(temp3_max, temp_max, 2); -static ssize_t show_temp_auto_base (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t temp_auto_base_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);return sprintf (buf,"%d\n" ,LM93_TEMP_FROM_REG (data->block10.base[nr])); } -static ssize_t store_temp_auto_base (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_auto_base_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1410,14 +1374,11 @@ static ssize_t store_temp_auto_base(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(temp1_auto_base, S_IWUSR | S_IRUGO, - show_temp_auto_base, store_temp_auto_base, 0); -static SENSOR_DEVICE_ATTR(temp2_auto_base, S_IWUSR | S_IRUGO, - show_temp_auto_base, store_temp_auto_base, 1); -static SENSOR_DEVICE_ATTR(temp3_auto_base, S_IWUSR | S_IRUGO, - show_temp_auto_base, store_temp_auto_base, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_auto_base, temp_auto_base, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_auto_base, temp_auto_base, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_auto_base, temp_auto_base, 2); -static ssize_t show_temp_auto_boost (struct device *dev, +static ssize_t temp_auto_boost_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1425,7 +1386,7 @@ static ssize_t show_temp_auto_boost(struct device *dev,return sprintf (buf,"%d\n" ,LM93_TEMP_FROM_REG (data->boost[nr])); } -static ssize_t store_temp_auto_boost (struct device *dev, +static ssize_t temp_auto_boost_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -1446,14 +1407,11 @@ static ssize_t store_temp_auto_boost(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(temp1_auto_boost, S_IWUSR | S_IRUGO, - show_temp_auto_boost, store_temp_auto_boost, 0); -static SENSOR_DEVICE_ATTR(temp2_auto_boost, S_IWUSR | S_IRUGO, - show_temp_auto_boost, store_temp_auto_boost, 1); -static SENSOR_DEVICE_ATTR(temp3_auto_boost, S_IWUSR | S_IRUGO, - show_temp_auto_boost, store_temp_auto_boost, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_auto_boost, temp_auto_boost, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_auto_boost, temp_auto_boost, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_auto_boost, temp_auto_boost, 2); -static ssize_t show_temp_auto_boost_hyst (struct device *dev, +static ssize_t temp_auto_boost_hyst_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1464,7 +1422,7 @@ static ssize_t show_temp_auto_boost_hyst(struct device *dev, LM93_AUTO_BOOST_HYST_FROM_REGS(data, nr, mode)); } -static ssize_t store_temp_auto_boost_hyst (struct device *dev, +static ssize_t temp_auto_boost_hyst_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -1490,18 +1448,12 @@ static ssize_t store_temp_auto_boost_hyst(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(temp1_auto_boost_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_boost_hyst, - store_temp_auto_boost_hyst, 0); -static SENSOR_DEVICE_ATTR(temp2_auto_boost_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_boost_hyst, - store_temp_auto_boost_hyst, 1); -static SENSOR_DEVICE_ATTR(temp3_auto_boost_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_boost_hyst, - store_temp_auto_boost_hyst, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_auto_boost_hyst, temp_auto_boost_hyst, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_auto_boost_hyst, temp_auto_boost_hyst, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_auto_boost_hyst, temp_auto_boost_hyst, 2); -static ssize_t show_temp_auto_offset (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t temp_auto_offset_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct sensor_device_attribute_2 *s_attr =to_sensor_dev_attr_2 (attr);int nr = s_attr->index;
@@ -1513,9 +1465,9 @@ static ssize_t show_temp_auto_offset(struct device *dev, nr, mode)); } -static ssize_t store_temp_auto_offset (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_auto_offset_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {struct sensor_device_attribute_2 *s_attr =to_sensor_dev_attr_2 (attr);int nr = s_attr->index;
@@ -1542,81 +1494,46 @@ static ssize_t store_temp_auto_offset(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset1, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 0, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset2, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 1, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset3, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 2, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset4, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 3, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset5, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 4, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset6, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 5, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset7, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 6, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset8, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 7, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset9, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 8, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset10, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 9, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset11, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 10, 0); -static SENSOR_DEVICE_ATTR_2(temp1_auto_offset12, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 11, 0); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset1, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 0, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset2, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 1, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset3, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 2, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset4, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 3, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset5, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 4, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset6, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 5, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset7, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 6, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset8, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 7, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset9, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 8, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset10, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 9, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset11, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 10, 1); -static SENSOR_DEVICE_ATTR_2(temp2_auto_offset12, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 11, 1); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset1, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 0, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset2, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 1, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset3, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 2, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset4, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 3, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset5, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 4, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset6, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 5, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset7, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 6, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset8, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 7, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset9, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 8, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset10, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 9, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset11, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 10, 2); -static SENSOR_DEVICE_ATTR_2(temp3_auto_offset12, S_IWUSR | S_IRUGO, - show_temp_auto_offset, store_temp_auto_offset, 11, 2); - -static ssize_t show_temp_auto_pwm_min (struct device *dev, -struct device_attribute *attr,char *buf) +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset1, temp_auto_offset, 0, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset2, temp_auto_offset, 1, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset3, temp_auto_offset, 2, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset4, temp_auto_offset, 3, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset5, temp_auto_offset, 4, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset6, temp_auto_offset, 5, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset7, temp_auto_offset, 6, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset8, temp_auto_offset, 7, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset9, temp_auto_offset, 8, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset10, temp_auto_offset, 9, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset11, temp_auto_offset, 10, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp1_auto_offset12, temp_auto_offset, 11, 0); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset1, temp_auto_offset, 0, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset2, temp_auto_offset, 1, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset3, temp_auto_offset, 2, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset4, temp_auto_offset, 3, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset5, temp_auto_offset, 4, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset6, temp_auto_offset, 5, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset7, temp_auto_offset, 6, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset8, temp_auto_offset, 7, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset9, temp_auto_offset, 8, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset10, temp_auto_offset, 9, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset11, temp_auto_offset, 10, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp2_auto_offset12, temp_auto_offset, 11, 1); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset1, temp_auto_offset, 0, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset2, temp_auto_offset, 1, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset3, temp_auto_offset, 2, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset4, temp_auto_offset, 3, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset5, temp_auto_offset, 4, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset6, temp_auto_offset, 5, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset7, temp_auto_offset, 6, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset8, temp_auto_offset, 7, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset9, temp_auto_offset, 8, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset10, temp_auto_offset, 9, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset11, temp_auto_offset, 10, 2); +static SENSOR_DEVICE_ATTR_2_RW(temp3_auto_offset12, temp_auto_offset, 11, 2); + +static ssize_t temp_auto_pwm_min_show (struct device *dev, +struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;u8 reg, ctl4;
@@ -1627,9 +1544,9 @@ static ssize_t show_temp_auto_pwm_min(struct device *dev, LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ)); } -static ssize_t store_temp_auto_pwm_min (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_auto_pwm_min_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1655,18 +1572,13 @@ static ssize_t store_temp_auto_pwm_min(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(temp1_auto_pwm_min, S_IWUSR | S_IRUGO, - show_temp_auto_pwm_min, - store_temp_auto_pwm_min, 0); -static SENSOR_DEVICE_ATTR(temp2_auto_pwm_min, S_IWUSR | S_IRUGO, - show_temp_auto_pwm_min, - store_temp_auto_pwm_min, 1); -static SENSOR_DEVICE_ATTR(temp3_auto_pwm_min, S_IWUSR | S_IRUGO, - show_temp_auto_pwm_min, - store_temp_auto_pwm_min, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_auto_pwm_min, temp_auto_pwm_min, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_auto_pwm_min, temp_auto_pwm_min, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_auto_pwm_min, temp_auto_pwm_min, 2); -static ssize_t show_temp_auto_offset_hyst (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t temp_auto_offset_hyst_show (struct device *dev, +struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1675,9 +1587,9 @@ static ssize_t show_temp_auto_offset_hyst(struct device *dev, data->auto_pwm_min_hyst[nr / 2], mode)); } -static ssize_t store_temp_auto_offset_hyst (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t temp_auto_offset_hyst_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1703,18 +1615,12 @@ static ssize_t store_temp_auto_offset_hyst(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(temp1_auto_offset_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_offset_hyst, - store_temp_auto_offset_hyst, 0); -static SENSOR_DEVICE_ATTR(temp2_auto_offset_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_offset_hyst, - store_temp_auto_offset_hyst, 1); -static SENSOR_DEVICE_ATTR(temp3_auto_offset_hyst, S_IWUSR | S_IRUGO, - show_temp_auto_offset_hyst, - store_temp_auto_offset_hyst, 2); +static SENSOR_DEVICE_ATTR_RW(temp1_auto_offset_hyst, temp_auto_offset_hyst, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_auto_offset_hyst, temp_auto_offset_hyst, 1); +static SENSOR_DEVICE_ATTR_RW(temp3_auto_offset_hyst, temp_auto_offset_hyst, 2); -static ssize_t show_fan_input (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t fan_input_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct sensor_device_attribute *s_attr =to_sensor_dev_attr (attr);int nr = s_attr->index;
@@ -1723,13 +1629,13 @@ static ssize_t show_fan_input(struct device *dev,return sprintf (buf,"%d\n" ,LM93_FAN_FROM_REG (data->block5[nr])); } -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_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 ssize_t show_fan_min (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t fan_min_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1737,8 +1643,9 @@ static ssize_t show_fan_min(struct device *dev,return sprintf (buf,"%d\n" ,LM93_FAN_FROM_REG (data->block8[nr])); } -static ssize_t store_fan_min (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_min_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1757,14 +1664,10 @@ static ssize_t store_fan_min(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, - show_fan_min, store_fan_min, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, - show_fan_min, store_fan_min, 1); -static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, - show_fan_min, store_fan_min, 2); -static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, - show_fan_min, store_fan_min, 3); +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);/* * some tedious bit-twiddling here to deal with the register format:
@@ -1780,8 +1683,8 @@ static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO,* T4 T3 T2 T1 */ -static ssize_t show_fan_smart_tach (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t fan_smart_tach_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1819,9 +1722,9 @@ static void lm93_write_fan_smart_tach(struct i2c_client *client,lm93_write_byte (client,LM93_REG_SFC2 , data->sfc2); } -static ssize_t store_fan_smart_tach (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t fan_smart_tach_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1849,16 +1752,12 @@ static ssize_t store_fan_smart_tach(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(fan1_smart_tach, S_IWUSR | S_IRUGO, - show_fan_smart_tach, store_fan_smart_tach, 0); -static SENSOR_DEVICE_ATTR(fan2_smart_tach, S_IWUSR | S_IRUGO, - show_fan_smart_tach, store_fan_smart_tach, 1); -static SENSOR_DEVICE_ATTR(fan3_smart_tach, S_IWUSR | S_IRUGO, - show_fan_smart_tach, store_fan_smart_tach, 2); -static SENSOR_DEVICE_ATTR(fan4_smart_tach, S_IWUSR | S_IRUGO, - show_fan_smart_tach, store_fan_smart_tach, 3); +static SENSOR_DEVICE_ATTR_RW(fan1_smart_tach, fan_smart_tach, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_smart_tach, fan_smart_tach, 1); +static SENSOR_DEVICE_ATTR_RW(fan3_smart_tach, fan_smart_tach, 2); +static SENSOR_DEVICE_ATTR_RW(fan4_smart_tach, fan_smart_tach, 3); -static ssize_t show_pwm (struct device *dev,struct device_attribute *attr, +static ssize_t pwm_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -1876,8 +1775,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%ld\n" , rc); } -static ssize_t store_pwm (struct device *dev,struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t pwm_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -1904,11 +1803,11 @@ static ssize_t store_pwm(struct device *dev, struct device_attribute *attr,return count; } -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); -static ssize_t show_pwm_enable (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t pwm_enable_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -1923,7 +1822,7 @@ static ssize_t show_pwm_enable(struct device *dev,return sprintf (buf,"%ld\n" , rc); } -static ssize_t store_pwm_enable (struct device *dev, +static ssize_t pwm_enable_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -1961,13 +1860,11 @@ static ssize_t store_pwm_enable(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, store_pwm_enable, 0); -static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, store_pwm_enable, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1); -static ssize_t show_pwm_freq (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t pwm_freq_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2001,9 +1898,9 @@ static void lm93_disable_fan_smart_tach(struct i2c_client *client,lm93_write_byte (client,LM93_REG_SFC2 , data->sfc2); } -static ssize_t store_pwm_freq (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t pwm_freq_store (struct device *dev, +struct device_attribute *attr,const char *buf, +size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2028,22 +1925,21 @@ static ssize_t store_pwm_freq(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(pwm1_freq, S_IWUSR | S_IRUGO, - show_pwm_freq, store_pwm_freq, 0); -static SENSOR_DEVICE_ATTR(pwm2_freq, S_IWUSR | S_IRUGO, - show_pwm_freq, store_pwm_freq, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_freq, pwm_freq, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_freq, pwm_freq, 1); -static ssize_t show_pwm_auto_channels (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t pwm_auto_channels_show (struct device *dev, +struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);return sprintf (buf,"%d\n" , data->block9[nr][LM93_PWM_CTL1 ]); } -static ssize_t store_pwm_auto_channels (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t pwm_auto_channels_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2063,13 +1959,12 @@ static ssize_t store_pwm_auto_channels(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(pwm1_auto_channels, S_IWUSR | S_IRUGO, - show_pwm_auto_channels, store_pwm_auto_channels, 0); -static SENSOR_DEVICE_ATTR(pwm2_auto_channels, S_IWUSR | S_IRUGO, - show_pwm_auto_channels, store_pwm_auto_channels, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_auto_channels, pwm_auto_channels, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_auto_channels, pwm_auto_channels, 1); -static ssize_t show_pwm_auto_spinup_min (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t pwm_auto_spinup_min_show (struct device *dev, +struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2082,9 +1977,9 @@ static ssize_t show_pwm_auto_spinup_min(struct device *dev, LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ)); } -static ssize_t store_pwm_auto_spinup_min (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t pwm_auto_spinup_min_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2109,15 +2004,12 @@ static ssize_t store_pwm_auto_spinup_min(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(pwm1_auto_spinup_min, S_IWUSR | S_IRUGO, - show_pwm_auto_spinup_min, - store_pwm_auto_spinup_min, 0); -static SENSOR_DEVICE_ATTR(pwm2_auto_spinup_min, S_IWUSR | S_IRUGO, - show_pwm_auto_spinup_min, - store_pwm_auto_spinup_min, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_auto_spinup_min, pwm_auto_spinup_min, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_auto_spinup_min, pwm_auto_spinup_min, 1); -static ssize_t show_pwm_auto_spinup_time (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t pwm_auto_spinup_time_show (struct device *dev, +struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2125,9 +2017,9 @@ static ssize_t show_pwm_auto_spinup_time(struct device *dev, data->block9[nr][LM93_PWM_CTL3])); } -static ssize_t store_pwm_auto_spinup_time (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t pwm_auto_spinup_time_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2149,12 +2041,8 @@ static ssize_t store_pwm_auto_spinup_time(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(pwm1_auto_spinup_time, S_IWUSR | S_IRUGO, - show_pwm_auto_spinup_time, - store_pwm_auto_spinup_time, 0); -static SENSOR_DEVICE_ATTR(pwm2_auto_spinup_time, S_IWUSR | S_IRUGO, - show_pwm_auto_spinup_time, - store_pwm_auto_spinup_time, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1_auto_spinup_time, pwm_auto_spinup_time, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_auto_spinup_time, pwm_auto_spinup_time, 1);static ssize_t pwm_auto_prochot_ramp_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -2220,7 +2108,7 @@ static ssize_t pwm_auto_vrdhot_ramp_store(struct device *dev,static DEVICE_ATTR_RW (pwm_auto_vrdhot_ramp); -static ssize_t show_vid (struct device *dev,struct device_attribute *attr, +static ssize_t vid_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -2228,21 +2116,21 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr,return sprintf (buf,"%d\n" ,LM93_VID_FROM_REG (data->vid[nr])); } -static SENSOR_DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL, 0); -static SENSOR_DEVICE_ATTR(cpu1_vid, S_IRUGO, show_vid, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(cpu0_vid, vid, 0); +static SENSOR_DEVICE_ATTR_RO(cpu1_vid, vid, 1); -static ssize_t show_prochot (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t prochot_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);return sprintf (buf,"%d\n" , data->block4[nr].cur); } -static SENSOR_DEVICE_ATTR(prochot1, S_IRUGO, show_prochot, NULL, 0); -static SENSOR_DEVICE_ATTR(prochot2, S_IRUGO, show_prochot, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(prochot1, prochot, 0); +static SENSOR_DEVICE_ATTR_RO(prochot2, prochot, 1); -static ssize_t show_prochot_avg (struct device *dev, +static ssize_t prochot_avg_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -2250,10 +2138,10 @@ static ssize_t show_prochot_avg(struct device *dev,return sprintf (buf,"%d\n" , data->block4[nr].avg); } -static SENSOR_DEVICE_ATTR(prochot1_avg, S_IRUGO, show_prochot_avg, NULL, 0); -static SENSOR_DEVICE_ATTR(prochot2_avg, S_IRUGO, show_prochot_avg, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(prochot1_avg, prochot_avg, 0); +static SENSOR_DEVICE_ATTR_RO(prochot2_avg, prochot_avg, 1); -static ssize_t show_prochot_max (struct device *dev, +static ssize_t prochot_max_show (struct device *dev,struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;
@@ -2261,9 +2149,9 @@ static ssize_t show_prochot_max(struct device *dev,return sprintf (buf,"%d\n" , data->prochot_max[nr]); } -static ssize_t store_prochot_max (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t prochot_max_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2283,15 +2171,13 @@ static ssize_t store_prochot_max(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(prochot1_max, S_IWUSR | S_IRUGO, - show_prochot_max, store_prochot_max, 0); -static SENSOR_DEVICE_ATTR(prochot2_max, S_IWUSR | S_IRUGO, - show_prochot_max, store_prochot_max, 1); +static SENSOR_DEVICE_ATTR_RW(prochot1_max, prochot_max, 0); +static SENSOR_DEVICE_ATTR_RW(prochot2_max, prochot_max, 1);static const u8 prochot_override_mask[] = {0x80 ,0x40 }; -static ssize_t show_prochot_override (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t prochot_override_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2299,9 +2185,9 @@ static ssize_t show_prochot_override(struct device *dev, (data->prochot_override & prochot_override_mask[nr]) ? 1 : 0); } -static ssize_t store_prochot_override (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t prochot_override_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2324,13 +2210,11 @@ static ssize_t store_prochot_override(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(prochot1_override, S_IWUSR | S_IRUGO, - show_prochot_override, store_prochot_override, 0); -static SENSOR_DEVICE_ATTR(prochot2_override, S_IWUSR | S_IRUGO, - show_prochot_override, store_prochot_override, 1); +static SENSOR_DEVICE_ATTR_RW(prochot1_override, prochot_override, 0); +static SENSOR_DEVICE_ATTR_RW(prochot2_override, prochot_override, 1); -static ssize_t show_prochot_interval (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t prochot_interval_show (struct device *dev, +struct device_attribute *attr,char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2342,9 +2226,9 @@ static ssize_t show_prochot_interval(struct device *dev,return sprintf (buf,"%d\n" ,LM93_INTERVAL_FROM_REG (tmp)); } -static ssize_t store_prochot_interval (struct device *dev, -struct device_attribute *attr, -const char *buf,size_t count) +static ssize_t prochot_interval_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =dev_get_drvdata (dev);
@@ -2369,10 +2253,8 @@ static ssize_t store_prochot_interval(struct device *dev,return count; } -static SENSOR_DEVICE_ATTR(prochot1_interval, S_IWUSR | S_IRUGO, - show_prochot_interval, store_prochot_interval, 0); -static SENSOR_DEVICE_ATTR(prochot2_interval, S_IWUSR | S_IRUGO, - show_prochot_interval, store_prochot_interval, 1); +static SENSOR_DEVICE_ATTR_RW(prochot1_interval, prochot_interval, 0); +static SENSOR_DEVICE_ATTR_RW(prochot2_interval, prochot_interval, 1); static ssize_t prochot_override_duty_cycle_show(struct device *dev, struct device_attribute *attr,
@@ -2438,8 +2320,8 @@ static ssize_t prochot_short_store(struct device *dev,static DEVICE_ATTR_RW (prochot_short); -static ssize_t show_vrdhot (struct device *dev,struct device_attribute *attr, -char *buf) +static ssize_t vrdhot_show (struct device *dev,struct device_attribute *attr, +char *buf) {int nr = (to_sensor_dev_attr (attr))->index;struct lm93_data *data =lm93_update_device (dev);
@@ -2447,8 +2329,8 @@ static ssize_t show_vrdhot(struct device *dev, struct device_attribute *attr, data->block1.host_status_1 & (1 << (nr + 4)) ? 1 : 0); } -static SENSOR_DEVICE_ATTR(vrdhot1, S_IRUGO, show_vrdhot, NULL, 0); -static SENSOR_DEVICE_ATTR(vrdhot2, S_IRUGO, show_vrdhot, NULL, 1); +static SENSOR_DEVICE_ATTR_RO(vrdhot1, vrdhot, 0); +static SENSOR_DEVICE_ATTR_RO(vrdhot2, vrdhot, 1);static ssize_t gpio_show (struct device *dev,struct device_attribute *attr,char *buf)
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 24/29 hwmon: (lm95241) 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/lm95241.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/lm95241.c +4 -4
@@ -349,19 +349,19 @@ static umode_t lm95241_is_visible(const void *data,case hwmon_chip:switch (attr) {case hwmon_chip_update_interval: -return S_IRUGO |S_IWUSR ; +return 0644 ; }break ;case hwmon_temp:switch (attr) {case hwmon_temp_input: -return S_IRUGO ; +return 0444 ;case hwmon_temp_fault: -return S_IRUGO ; +return 0444 ;case hwmon_temp_min:case hwmon_temp_max:case hwmon_temp_type: -return S_IRUGO |S_IWUSR ; +return 0644 ; }break ;default :
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 25/29 hwmon: (lm95245) 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/lm95245.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/lm95245.c +4 -4
@@ -421,14 +421,14 @@ static umode_t lm95245_temp_is_visible(const void *data, u32 attr, int channel)case hwmon_temp_max_hyst:case hwmon_temp_crit_alarm:case hwmon_temp_fault: -return S_IRUGO ; +return 0444 ;case hwmon_temp_type:case hwmon_temp_max:case hwmon_temp_crit:case hwmon_temp_offset: -return S_IRUGO |S_IWUSR ; +return 0644 ;case hwmon_temp_crit_hyst: -return (channel ==0 ) ?S_IRUGO |S_IWUSR :S_IRUGO ; +return (channel ==0 ) ?0644 :0444 ;default :return 0 ; }
@@ -442,7 +442,7 @@ static umode_t lm95245_is_visible(const void *data,case hwmon_chip:switch (attr) {case hwmon_chip_update_interval: -return S_IRUGO |S_IWUSR ; +return 0644 ;default :return 0 ; }
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 26/29 hwmon: (ltc2990) 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/ltc2990.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-)
drivers/hwmon/ltc2990.c +11 -21
@@ -136,7 +136,7 @@ static int ltc2990_get_value(struct i2c_client *i2c, int index, int *result)return 0 ; } -static ssize_t ltc2990_show_value (struct device *dev, +static ssize_t ltc2990_value_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -170,26 +170,16 @@ static umode_t ltc2990_attrs_visible(struct kobject *kobj,return 0 ; } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_TEMP1); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_TEMP2); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_TEMP3); -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_CURR1); -static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_CURR2); -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_IN0); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_IN1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_IN2); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_IN3); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, ltc2990_show_value, NULL, - LTC2990_IN4); +static SENSOR_DEVICE_ATTR_RO(temp1_input, ltc2990_value, LTC2990_TEMP1); +static SENSOR_DEVICE_ATTR_RO(temp2_input, ltc2990_value, LTC2990_TEMP2); +static SENSOR_DEVICE_ATTR_RO(temp3_input, ltc2990_value, LTC2990_TEMP3); +static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc2990_value, LTC2990_CURR1); +static SENSOR_DEVICE_ATTR_RO(curr2_input, ltc2990_value, LTC2990_CURR2); +static SENSOR_DEVICE_ATTR_RO(in0_input, ltc2990_value, LTC2990_IN0); +static SENSOR_DEVICE_ATTR_RO(in1_input, ltc2990_value, LTC2990_IN1); +static SENSOR_DEVICE_ATTR_RO(in2_input, ltc2990_value, LTC2990_IN2); +static SENSOR_DEVICE_ATTR_RO(in3_input, ltc2990_value, LTC2990_IN3); +static SENSOR_DEVICE_ATTR_RO(in4_input, ltc2990_value, LTC2990_IN4);static struct attribute *ltc2990_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 27/29 hwmon: (ltc4151) 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/ltc4151.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/hwmon/ltc4151.c +4 -7
@@ -131,7 +131,7 @@ static int ltc4151_get_value(struct ltc4151_data *data, u8 reg)return val; } -static ssize_t ltc4151_show_value (struct device *dev, +static ssize_t ltc4151_value_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -148,14 +148,11 @@ static ssize_t ltc4151_show_value(struct device *dev,/* * Input voltages. */ -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4151_show_value, NULL, - LTC4151_VIN_H); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4151_show_value, NULL, - LTC4151_ADIN_H); +static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4151_value, LTC4151_VIN_H); +static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4151_value, LTC4151_ADIN_H);/* Currents (via sense resistor) */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4151_show_value, NULL, - LTC4151_SENSE_H); +static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4151_value, LTC4151_SENSE_H);/* * Finally, construct an array of pointers to members of the above objects,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 28/29 hwmon: (ltc4222) 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/ltc4222.c | 56 ++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 31 deletions(-)
drivers/hwmon/ltc4222.c +25 -31
@@ -94,7 +94,7 @@ static int ltc4222_get_value(struct device *dev, u8 reg)return val; } -static ssize_t ltc4222_show_value (struct device *dev, +static ssize_t ltc4222_value_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute *attr =to_sensor_dev_attr (da);
@@ -106,7 +106,7 @@ static ssize_t ltc4222_show_value(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%d\n" , value); } -static ssize_t ltc4222_show_bool (struct device *dev, +static ssize_t ltc4222_bool_show (struct device *dev,struct device_attribute *da,char *buf) {struct sensor_device_attribute_2 *attr =to_sensor_dev_attr_2 (da);
@@ -125,45 +125,39 @@ static ssize_t ltc4222_show_bool(struct device *dev, }/* Voltages */ -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_SOURCE1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_ADIN1); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_SOURCE2); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_ADIN2); +static SENSOR_DEVICE_ATTR_RO(in1_input, ltc4222_value, LTC4222_SOURCE1); +static SENSOR_DEVICE_ATTR_RO(in2_input, ltc4222_value, LTC4222_ADIN1); +static SENSOR_DEVICE_ATTR_RO(in3_input, ltc4222_value, LTC4222_SOURCE2); +static SENSOR_DEVICE_ATTR_RO(in4_input, ltc4222_value, LTC4222_ADIN2);/* * Voltage alarms * UV/OV faults are associated with the input voltage, and power bad and fet * faults are associated with the output voltage. */ -static SENSOR_DEVICE_ATTR_2(in1_min_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT1, FAULT_UV); -static SENSOR_DEVICE_ATTR_2(in1_max_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT1, FAULT_OV); -static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT1, FAULT_POWER_BAD | FAULT_FET_BAD); - -static SENSOR_DEVICE_ATTR_2(in3_min_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT2, FAULT_UV); -static SENSOR_DEVICE_ATTR_2(in3_max_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT2, FAULT_OV); -static SENSOR_DEVICE_ATTR_2(in4_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT2, FAULT_POWER_BAD | FAULT_FET_BAD); +static SENSOR_DEVICE_ATTR_2_RO(in1_min_alarm, ltc4222_bool, LTC4222_FAULT1, + FAULT_UV); +static SENSOR_DEVICE_ATTR_2_RO(in1_max_alarm, ltc4222_bool, LTC4222_FAULT1, + FAULT_OV); +static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, ltc4222_bool, LTC4222_FAULT1, + FAULT_POWER_BAD | FAULT_FET_BAD); + +static SENSOR_DEVICE_ATTR_2_RO(in3_min_alarm, ltc4222_bool, LTC4222_FAULT2, + FAULT_UV); +static SENSOR_DEVICE_ATTR_2_RO(in3_max_alarm, ltc4222_bool, LTC4222_FAULT2, + FAULT_OV); +static SENSOR_DEVICE_ATTR_2_RO(in4_alarm, ltc4222_bool, LTC4222_FAULT2, + FAULT_POWER_BAD | FAULT_FET_BAD);/* Current (via sense resistor) */ -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_SENSE1); -static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, ltc4222_show_value, NULL, - LTC4222_SENSE2); +static SENSOR_DEVICE_ATTR_RO(curr1_input, ltc4222_value, LTC4222_SENSE1); +static SENSOR_DEVICE_ATTR_RO(curr2_input, ltc4222_value, LTC4222_SENSE2);/* Overcurrent alarm */ -static SENSOR_DEVICE_ATTR_2(curr1_max_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT1, FAULT_OC); -static SENSOR_DEVICE_ATTR_2(curr2_max_alarm, S_IRUGO, ltc4222_show_bool, NULL, - LTC4222_FAULT2, FAULT_OC); +static SENSOR_DEVICE_ATTR_2_RO(curr1_max_alarm, ltc4222_bool, LTC4222_FAULT1, + FAULT_OC); +static SENSOR_DEVICE_ATTR_2_RO(curr2_max_alarm, ltc4222_bool, LTC4222_FAULT2, + FAULT_OC);static struct attribute *ltc4222_attrs[] = { &sensor_dev_attr_in1_input.dev_attr.attr,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH 29/29 hwmon: (ltc4245) 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/ltc4245.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/ltc4245.c +4 -4
@@ -362,11 +362,11 @@ static umode_t ltc4245_is_visible(const void *_data,case hwmon_in_input:if (channel >9 && !data->use_extra_gpios)return 0 ; -return S_IRUGO ; +return 0444 ;case hwmon_in_min_alarm:if (channel >8 )return 0 ; -return S_IRUGO ; +return 0444 ;default :return 0 ; }
@@ -374,14 +374,14 @@ static umode_t ltc4245_is_visible(const void *_data,switch (attr) {case hwmon_curr_input:case hwmon_curr_max_alarm: -return S_IRUGO ; +return 0444 ;default :return 0 ; }case hwmon_power:switch (attr) {case hwmon_power_input: -return S_IRUGO ; +return 0444 ;default :return 0 ; }
Signature · 1 line
2.7.4