All of lore.kernel.org
 help / color / mirror / Atom feed
From: jcromie@divsol.com (Jim Cromie)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [patch pc87360 reroll 5/6] refactor SENSOR-DEVICE-ATTR
Date: Thu, 04 Aug 2005 02:28:39 +0000	[thread overview]
Message-ID: <42F16113.1020207@divsol.com> (raw)

Jim Cromie wrote:

> refactor SENSOR_DEVICE_ATTR into declaration = initialization-expression
>    __SENSOR_DEVICE_ATTR() expands to init-expr
>
> this imitates  __ATTR in include/linux/device.h,
> but is needed cuz of new .index member ( otherwize __ATTR would suffice)
>

$ diffstat 05-pc87360-hwmon-sysfs-array-init.patch
 hwmon-sysfs.h |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


Signed-off-by:  Jim Cromie <jcromie@divsol.com>
-------------- next part --------------
diff -ruNp -X exclude-diffs gc-4/include/linux/hwmon-sysfs.h gc-5/include/linux/hwmon-sysfs.h
--- gc-4/include/linux/hwmon-sysfs.h	2005-08-01 19:31:23.000000000 -0600
+++ gc-5/include/linux/hwmon-sysfs.h	2005-08-03 17:13:28.000000000 -0600
@@ -27,12 +27,16 @@ struct sensor_device_attribute{
 #define to_sensor_dev_attr(_dev_attr) \
 	container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
 
-#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
-struct sensor_device_attribute sensor_dev_attr_##_name = {	\
-	.dev_attr =	__ATTR(_name,_mode,_show,_store),	\
+#define __SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
+{	.dev_attr =	__ATTR(_name,_mode,_show,_store),	\
 	.index =	_index,					\
 }
 
+#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
+struct sensor_device_attribute sensor_dev_attr_##_name  	\
+	= __SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)
+
+
 struct sensor_device_attribute_2 {
 	struct device_attribute dev_attr;
 	u8 index;
@@ -41,11 +45,15 @@ struct sensor_device_attribute_2 {
 #define to_sensor_dev_attr_2(_dev_attr) \
 	container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
 
-#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index)	\
-struct sensor_device_attribute_2 sensor_dev_attr_##_name = {	\
-	.dev_attr =	__ATTR(_name,_mode,_show,_store),	\
+#define __SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index)	\
+{	.dev_attr =	__ATTR(_name,_mode,_show,_store),	\
 	.index =	_index,					\
 	.nr =		_nr,					\
 }
 
+#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index)	\
+struct sensor_device_attribute_2 sensor_dev_attr_##_name 		\
+	= __SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index)
+
+
 #endif /* _LINUX_HWMON_SYSFS_H */

                 reply	other threads:[~2005-08-04  2:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=42F16113.1020207@divsol.com \
    --to=jcromie@divsol.com \
    --cc=lm-sensors@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.