RE: [PATCH 22/30] hwmon: (da9055-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guenter, 

On 10 December 2018 22:09, Guenter Roeck wrote:

> Subject: [PATCH 22/30] 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@xxxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---

Thanks, 
Same again.

Acked-by: Steve Twiss <stwiss.opensource@xxxxxxxxxxx>

... with the patch [01/10] hwmon: Introduce SENSOR_DEVICE_ATTR_{RO,RW,WO} and variants
https://patchwork.kernel.org/patch/9489915/ 

Regards,
Steve


>  drivers/hwmon/da9055-hwmon.c | 41 ++++++++++++++++-------------------------
>  1 file changed, 16 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
> index f6e159cabe23..4de6de683908 100644
> --- a/drivers/hwmon/da9055-hwmon.c
> +++ b/drivers/hwmon/da9055-hwmon.c
> @@ -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 @@ static ssize_t da9055_read_auto_ch(struct device *dev,
>  	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(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(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_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,
> --
> 2.7.4




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux