All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com (Jim Cromie)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] hwmon: Allow sensor attribute arrays
Date: Sat, 10 Dec 2005 16:01:00 +0000	[thread overview]
Message-ID: <439AFBBC.2000501@gmail.com> (raw)

Jean Delvare wrote:

>Hi Jim,
>
>Some times ago, you proposed a change to include/linux/hwmon-sysfs.h
>that would have made it easier to declare arrays of struct
>sensor_device_attribute. Back then we gave it up because other
>important changes to the pc87360 driver (which was your first target
>for that patch) needed to be done first, but I think it is now the
>right time to think of that patch again.
>
>I have made some cosmetic cleanups to it, and here it is again. I need
>it for a driver of mine. Could you please confirm you're still OK with
>it, and maybe propose a patch for the pc87360 driver?
>
>  
>
Brilliant!, erm Ack.
 (Im not sure if theres a formal procedure for this,
since youve already got my Signed-off-by;)

I'll rework my semi-recycled patch (sent separately) and resend.
BTW, Id not seen this msg until you responded to mine.
It must be an obvious zeitgeist if even I picked up on it ;)

>The size benefit when converting my own driver to use arrays of
>attributes is pretty impressive (from 12.0 kB down to 9.4kB in memory).
>The pc87360 driver should benefit at least as much and probably even
>more (in absolute amount of spared memory).
>
>Thanks.
>
>* * * * *
>
>This patch refactors SENSOR_DEVICE_ATTR macro.  First it creates a new
>macro SENSOR_ATTR() which expands to an initialization expression, then
>it uses that in SENSOR_DEVICE_ATTR, which declares and initializes a
>struct sensor_device_attribute.
>
>IOW, SENSOR_ATTR() imitates __ATTR() in include/linux/device.h.
>
>Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
>Signed-off-by: Jean Delvare <khali at linux-fr.org>
>---
> include/linux/hwmon-sysfs.h |   12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
>--- linux-2.6.15-rc2.orig/include/linux/hwmon-sysfs.h	2005-10-28 17:20:54.000000000 +0200
>+++ linux-2.6.15-rc2/include/linux/hwmon-sysfs.h	2005-11-21 21:44:14.000000000 +0100
>@@ -27,11 +27,13 @@
> #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),	\
>-	.index =	_index,					\
>-}
>+#define SENSOR_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_ATTR(_name, _mode, _show, _store, _index)
> 
> struct sensor_device_attribute_2 {
> 	struct device_attribute dev_attr;
>
>
>  
>



             reply	other threads:[~2005-12-10 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-10 16:01 Jim Cromie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-11-23 21:05 [lm-sensors] [PATCH] hwmon: Allow sensor attribute arrays Jean Delvare

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=439AFBBC.2000501@gmail.com \
    --to=jim.cromie@gmail.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.