linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 27/29] hwmon: (ltc4151) Use permission specific SENSOR[_DEVICE]_ATTR variants
Date: Thu, 17 Jan 2019 13:13:47 -0800	[thread overview]
Message-ID: <1547759629-23007-28-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1547759629-23007-1-git-send-email-linux@roeck-us.net>

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.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/ltc4151.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/hwmon/ltc4151.c b/drivers/hwmon/ltc4151.c
index b904cb547ffb..76c6fda76d95 100644
--- a/drivers/hwmon/ltc4151.c
+++ b/drivers/hwmon/ltc4151.c
@@ -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,
-- 
2.7.4


  parent reply	other threads:[~2019-01-17 21:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 21:13 [PATCH 00/29] hwmon: Use permission specific SENSOR[_DEVICE]_ATTR Guenter Roeck
2019-01-17 21:13 ` [PATCH 01/29] hwmon: (gl518sm) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 02/29] hwmon: (gl520sm) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 03/29] hwmon: (gpio-fan) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 04/29] hwmon: (hih6130) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 05/29] hwmon: (hwmon) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 06/29] hwmon: (i5500_temp) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 07/29] hwmon: (i5k_amb) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 08/29] hwmon: (ibmaem) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 09/29] hwmon: (ibmpex) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 10/29] hwmon: (iio_hwmon) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 11/29] hwmon: (ina209) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 12/29] hwmon: (ina3221) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 13/29] hwmon: (jc42) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 14/29] hwmon: (k8temp) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 15/29] hwmon: (lineage-pem) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 16/29] hwmon: (lm73) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 17/29] hwmon: (lm75) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 18/29] hwmon: (lm77) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 19/29] hwmon: (lm80) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 20/29] hwmon: (lm83) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 21/29] hwmon: (lm90) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 22/29] hwmon: (lm92) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` [PATCH 23/29] hwmon: (lm93) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 24/29] hwmon: (lm95241) Replace S_<PERMS> with octal values Guenter Roeck
2019-01-17 21:13 ` [PATCH 25/29] hwmon: (lm95245) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 26/29] hwmon: (ltc2990) Use permission specific SENSOR[_DEVICE]_ATTR variants Guenter Roeck
2019-01-17 21:13 ` Guenter Roeck [this message]
2019-01-17 21:13 ` [PATCH 28/29] hwmon: (ltc4222) " Guenter Roeck
2019-01-17 21:13 ` [PATCH 29/29] hwmon: (ltc4245) Replace S_<PERMS> with octal values Guenter Roeck

Reply instructions:

You may reply publicly 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=1547759629-23007-28-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).