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>,
	Rudolf Marek <r.marek@assembler.cz>
Subject: [PATCH 14/29] hwmon: (k8temp) Use permission specific SENSOR[_DEVICE]_ATTR variants
Date: Thu, 17 Jan 2019 13:13:34 -0800	[thread overview]
Message-ID: <1547759629-23007-15-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.

Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/k8temp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index e59f9113fb93..93a5d51f3c6d 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -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[] = {
-- 
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 ` Guenter Roeck [this message]
2019-01-17 21:13 ` [PATCH 15/29] hwmon: (lineage-pem) Use permission specific SENSOR[_DEVICE]_ATTR variants 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 ` [PATCH 27/29] hwmon: (ltc4151) " Guenter Roeck
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-15-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=r.marek@assembler.cz \
    /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).