All of lore.kernel.org
 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 02/10] hwmon: (wm831x-hwmon) Replace macros generating sensor attributes
Date: Tue, 27 Dec 2016 15:28:20 -0800	[thread overview]
Message-ID: <1482881308-13550-3-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1482881308-13550-1-git-send-email-linux@roeck-us.net>

Replace macros generating sensor attributes with explicit code to ease
conversion to SENSOR_DEVICE_ATTR_{RO,RW}.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/wm831x-hwmon.c | 48 ++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/hwmon/wm831x-hwmon.c b/drivers/hwmon/wm831x-hwmon.c
index a16cce72e4e2..46d32ae94167 100644
--- a/drivers/hwmon/wm831x-hwmon.c
+++ b/drivers/hwmon/wm831x-hwmon.c
@@ -79,25 +79,35 @@ static ssize_t show_label(struct device *dev,
 	return sprintf(buf, "%s\n", input_names[channel]);
 }
 
-#define WM831X_VOLTAGE(id, name) \
-	static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \
-				  NULL, name)
-
-#define WM831X_NAMED_VOLTAGE(id, name) \
-	WM831X_VOLTAGE(id, name); \
-	static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label,	\
-				  NULL, name)
-
-WM831X_VOLTAGE(0, WM831X_AUX_AUX1);
-WM831X_VOLTAGE(1, WM831X_AUX_AUX2);
-WM831X_VOLTAGE(2, WM831X_AUX_AUX3);
-WM831X_VOLTAGE(3, WM831X_AUX_AUX4);
-
-WM831X_NAMED_VOLTAGE(4, WM831X_AUX_SYSVDD);
-WM831X_NAMED_VOLTAGE(5, WM831X_AUX_USB);
-WM831X_NAMED_VOLTAGE(6, WM831X_AUX_BATT);
-WM831X_NAMED_VOLTAGE(7, WM831X_AUX_WALL);
-WM831X_NAMED_VOLTAGE(8, WM831X_AUX_BKUP_BATT);
+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_AUX1);
+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_AUX2);
+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_AUX3);
+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_AUX4);
+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_SYSVDD);
+static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_USB);
+static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_BATT);
+static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_WALL);
+static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, show_voltage, NULL,
+			  WM831X_AUX_BKUP_BATT);
+
+static SENSOR_DEVICE_ATTR(in4_label, S_IRUGO, show_label, NULL,
+			  WM831X_AUX_SYSVDD);
+static SENSOR_DEVICE_ATTR(in5_label, S_IRUGO, show_label, NULL,
+			  WM831X_AUX_USB);
+static SENSOR_DEVICE_ATTR(in6_label, S_IRUGO, show_label, NULL,
+			  WM831X_AUX_BATT);
+static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL,
+			  WM831X_AUX_WALL);
+static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL,
+			  WM831X_AUX_BKUP_BATT);
 
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_chip_temp, NULL,
 			  WM831X_AUX_CHIP_TEMP);
-- 
2.7.4

  parent reply	other threads:[~2016-12-27 23:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27 23:28 [PATCH 01/10] hwmon: Prepare for SENSOR_DEVICE_ATTR_{RO,RW,WO} conversion Guenter Roeck
2016-12-27 23:28 ` [PATCH 01/10] hwmon: Introduce SENSOR_DEVICE_ATTR_{RO,RW,WO} and variants Guenter Roeck
2016-12-27 23:28 ` Guenter Roeck [this message]
2016-12-27 23:28 ` [PATCH 03/10] hwmon: (it87) Prepare for auto-conversion to SENSOR_DEVICE_ATTR_{RO,RW} Guenter Roeck
2016-12-27 23:28 ` [PATCH 04/10] hwmon: (max1668) " Guenter Roeck
2016-12-27 23:28 ` [PATCH 05/10] hwmon: (f75375s) Replace function macro with explicit code Guenter Roeck
2016-12-27 23:28 ` [PATCH 06/10] hwmon: (ultra45_env) Replace macros generating sensor attributes Guenter Roeck
2016-12-27 23:28 ` [PATCH 07/10] hwmon: (w83l786ng) Replace function macros with explicit code Guenter Roeck
2016-12-27 23:28 ` [PATCH 08/10] hwmon: (w83791d) " Guenter Roeck
2016-12-27 23:28 ` [PATCH 09/10] hwmon: (w83627ehf) " Guenter Roeck
2016-12-27 23:28 ` [PATCH 10/10] hwmon: (adt7411) Replace macro generating sensor attributes 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=1482881308-13550-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.