Linux-Hwmon Archive on lore.kernel.org
 help / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: Re: [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Date: Fri, 18 Jan 2019 18:22:12 +0000
Message-ID: <20190118182212.GJ20661@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <1547831700-15865-30-git-send-email-linux@roeck-us.net>

On Fri, Jan 18, 2019 at 09:14:59AM -0800, Guenter Roeck wrote:
> 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: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Are you going to take the patch via your tree?

Best regards,
Liviu

> ---
>  drivers/hwmon/vexpress-hwmon.c | 25 ++++++++++---------------
>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/hwmon/vexpress-hwmon.c b/drivers/hwmon/vexpress-hwmon.c
> index 8ba419d343f8..0b84adb5e88e 100644
> --- a/drivers/hwmon/vexpress-hwmon.c
> +++ b/drivers/hwmon/vexpress-hwmon.c
> @@ -92,9 +92,8 @@ struct vexpress_hwmon_type {
>  };
>  
>  #if !defined(CONFIG_REGULATOR_VEXPRESS)
> -static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
> -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show,
> -		NULL, 1000);
> +static DEVICE_ATTR(in1_label, 0444, vexpress_hwmon_label_show, NULL);
> +static SENSOR_DEVICE_ATTR_RO(in1_input, vexpress_hwmon_u32, 1000);
>  static struct attribute *vexpress_hwmon_attrs_volt[] = {
>  	&dev_attr_in1_label.attr,
>  	&sensor_dev_attr_in1_input.dev_attr.attr,
> @@ -113,9 +112,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_volt = {
>  };
>  #endif
>  
> -static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
> -static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show,
> -		NULL, 1000);
> +static DEVICE_ATTR(curr1_label, 0444, vexpress_hwmon_label_show, NULL);
> +static SENSOR_DEVICE_ATTR_RO(curr1_input, vexpress_hwmon_u32, 1000);
>  static struct attribute *vexpress_hwmon_attrs_amp[] = {
>  	&dev_attr_curr1_label.attr,
>  	&sensor_dev_attr_curr1_input.dev_attr.attr,
> @@ -133,9 +131,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_amp = {
>  	},
>  };
>  
> -static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
> -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show,
> -		NULL, 1000);
> +static DEVICE_ATTR(temp1_label, 0444, vexpress_hwmon_label_show, NULL);
> +static SENSOR_DEVICE_ATTR_RO(temp1_input, vexpress_hwmon_u32, 1000);
>  static struct attribute *vexpress_hwmon_attrs_temp[] = {
>  	&dev_attr_temp1_label.attr,
>  	&sensor_dev_attr_temp1_input.dev_attr.attr,
> @@ -153,9 +150,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_temp = {
>  	},
>  };
>  
> -static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
> -static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show,
> -		NULL, 1);
> +static DEVICE_ATTR(power1_label, 0444, vexpress_hwmon_label_show, NULL);
> +static SENSOR_DEVICE_ATTR_RO(power1_input, vexpress_hwmon_u32, 1);
>  static struct attribute *vexpress_hwmon_attrs_power[] = {
>  	&dev_attr_power1_label.attr,
>  	&sensor_dev_attr_power1_input.dev_attr.attr,
> @@ -173,9 +169,8 @@ static struct vexpress_hwmon_type vexpress_hwmon_power = {
>  	},
>  };
>  
> -static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
> -static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show,
> -		NULL, 1);
> +static DEVICE_ATTR(energy1_label, 0444, vexpress_hwmon_label_show, NULL);
> +static SENSOR_DEVICE_ATTR_RO(energy1_input, vexpress_hwmon_u64, 1);
>  static struct attribute *vexpress_hwmon_attrs_energy[] = {
>  	&dev_attr_energy1_label.attr,
>  	&sensor_dev_attr_energy1_input.dev_attr.attr,
> -- 
> 2.7.4
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

  parent reply index

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 17:14 [PATCH 00/30] hwmon: Use permission specific SENSOR[_DEVICE]_ATTR Guenter Roeck
2019-01-18 17:14 ` [PATCH 01/30] hwmon: (ltc4261) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 17:14 ` [PATCH 02/30] hwmon: (max16065) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 03/30] hwmon: (max1619) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 04/30] hwmon: (max31722) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 05/30] hwmon: (max31790) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-18 17:14 ` [PATCH 06/30] hwmon: (max6639) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 17:14 ` [PATCH 07/30] hwmon: (max6642) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 08/30] hwmon: (max6650) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 09/30] hwmon: (mc13783-adc) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 10/30] hwmon: (nct7904) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-18 17:14 ` [PATCH 11/30] hwmon: (nsa320-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 17:14 ` [PATCH 12/30] hwmon: (pc87360) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 13/30] hwmon: (pc87427) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 14/30] hwmon: (powr1220) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 15/30] hwmon: (sch5627) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 16/30] hwmon: (sch5636) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 17/30] hwmon: (scmi-hwmon) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-18 17:14 ` [PATCH 18/30] hwmon: (scpi-hwmon) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 19/30] hwmon: (sht15) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 17:14 ` [PATCH 20/30] hwmon: (sht21) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 21/30] hwmon: (sht3x) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 22/30] hwmon: (smsc47b397) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 23/30] hwmon: (stts751) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 24/30] hwmon: (tc654) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 25/30] hwmon: (tc74) " Guenter Roeck
2019-01-18 17:14 ` [PATCH 26/30] hwmon: (tmp102) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-18 17:14 ` [PATCH 27/30] hwmon: (tmp103) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 17:14 ` [PATCH 28/30] hwmon: (tmp421) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-18 17:14 ` [PATCH 29/30] hwmon: (vexpress-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-18 18:21   ` Sudeep Holla
2019-01-18 18:58     ` Guenter Roeck
2019-01-21  9:38       ` Sudeep Holla
2019-01-21 15:22         ` Guenter Roeck
2019-01-21 15:28           ` Sudeep Holla
2019-01-22  0:45             ` Guenter Roeck
2019-01-22  9:55               ` Sudeep Holla
2019-01-18 18:22   ` Liviu Dudau [this message]
2019-01-18 18:55     ` Guenter Roeck
2019-01-18 17:15 ` [PATCH 30/30] hwmon: (via-cputemp) " Guenter Roeck

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190118182212.GJ20661@e110455-lin.cambridge.arm.com \
    --to=liviu.dudau@arm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox