hwmon: (da9055-hwmon) 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. Cc: Support Opensource <support.opensource@diasemi.com> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
6db587b73f
commit
4b76a6c9b7
|
@ -140,8 +140,9 @@ static int da9055_disable_auto_mode(struct da9055 *da9055, int channel)
|
|||
return da9055_reg_update(da9055, DA9055_REG_ADC_CONT, 1 << channel, 0);
|
||||
}
|
||||
|
||||
static ssize_t da9055_read_auto_ch(struct device *dev,
|
||||
struct device_attribute *devattr, char *buf)
|
||||
static ssize_t da9055_auto_ch_show(struct device *dev,
|
||||
struct device_attribute *devattr,
|
||||
char *buf)
|
||||
{
|
||||
struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
|
||||
int ret, adc;
|
||||
|
@ -176,7 +177,7 @@ hwmon_err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t da9055_read_tjunc(struct device *dev,
|
||||
static ssize_t da9055_tjunc_show(struct device *dev,
|
||||
struct device_attribute *devattr, char *buf)
|
||||
{
|
||||
struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
|
||||
|
@ -199,34 +200,24 @@ static ssize_t da9055_read_tjunc(struct device *dev,
|
|||
+ 3076332, 10000));
|
||||
}
|
||||
|
||||
static ssize_t show_label(struct device *dev,
|
||||
static ssize_t label_show(struct device *dev,
|
||||
struct device_attribute *devattr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%s\n",
|
||||
input_names[to_sensor_dev_attr(devattr)->index]);
|
||||
}
|
||||
|
||||
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, da9055_read_auto_ch, NULL,
|
||||
DA9055_ADC_VSYS);
|
||||
static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL,
|
||||
DA9055_ADC_VSYS);
|
||||
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, da9055_read_auto_ch, NULL,
|
||||
DA9055_ADC_ADCIN1);
|
||||
static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL,
|
||||
DA9055_ADC_ADCIN1);
|
||||
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, da9055_read_auto_ch, NULL,
|
||||
DA9055_ADC_ADCIN2);
|
||||
static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL,
|
||||
DA9055_ADC_ADCIN2);
|
||||
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, da9055_read_auto_ch, NULL,
|
||||
DA9055_ADC_ADCIN3);
|
||||
static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL,
|
||||
DA9055_ADC_ADCIN3);
|
||||
static SENSOR_DEVICE_ATTR_RO(in0_input, da9055_auto_ch, DA9055_ADC_VSYS);
|
||||
static SENSOR_DEVICE_ATTR_RO(in0_label, label, DA9055_ADC_VSYS);
|
||||
static SENSOR_DEVICE_ATTR_RO(in1_input, da9055_auto_ch, DA9055_ADC_ADCIN1);
|
||||
static SENSOR_DEVICE_ATTR_RO(in1_label, label, DA9055_ADC_ADCIN1);
|
||||
static SENSOR_DEVICE_ATTR_RO(in2_input, da9055_auto_ch, DA9055_ADC_ADCIN2);
|
||||
static SENSOR_DEVICE_ATTR_RO(in2_label, label, DA9055_ADC_ADCIN2);
|
||||
static SENSOR_DEVICE_ATTR_RO(in3_input, da9055_auto_ch, DA9055_ADC_ADCIN3);
|
||||
static SENSOR_DEVICE_ATTR_RO(in3_label, label, DA9055_ADC_ADCIN3);
|
||||
|
||||
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, da9055_read_tjunc, NULL,
|
||||
DA9055_ADC_TJUNC);
|
||||
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
|
||||
DA9055_ADC_TJUNC);
|
||||
static SENSOR_DEVICE_ATTR_RO(temp1_input, da9055_tjunc, DA9055_ADC_TJUNC);
|
||||
static SENSOR_DEVICE_ATTR_RO(temp1_label, label, DA9055_ADC_TJUNC);
|
||||
|
||||
static struct attribute *da9055_attrs[] = {
|
||||
&sensor_dev_attr_in0_input.dev_attr.attr,
|
||||
|
|
Loading…
Reference in New Issue