From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] revisiting __SENSOR_DEVICE_ATTR() and array
Date: Sat, 24 Dec 2005 16:04:01 +0000 [thread overview]
Message-ID: <20051224170401.793153ac.khali@linux-fr.org> (raw)
In-Reply-To: <439A7911.5020904@gmail.com>
Hi Jim,
> Thanks for the review, heres the respin against rc5-mm3
> with corrections to the above.
Looks OK, except:
> diff -ruNp -X exclude-diffs ../linux-2.6.15-rc5-mm3-sk/include/linux/hwmon-sysfs.h adm/include/linux/hwmon-sysfs.h
> --- ../linux-2.6.15-rc5-mm3-sk/include/linux/hwmon-sysfs.h 2005-10-28 15:32:08.000000000 -0600
> +++ adm/include/linux/hwmon-sysfs.h 2005-12-19 05:12:15.000000000 -0700
> @@ -27,11 +27,13 @@ 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), \
> - .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;
This change is already provided by an earlier patch of mine - so you
shouldn't include it here.
> + for (i=0; i<16; i++) {
Same comment here as for pc87360.c: please try to respect the coding
style around.
> + /* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
You are reintroducing a comment which was removed some times ago.
> hmm, it has no maintainer listed. I hope someone can test it.
> Im CCg the authors named in the file, in case theyre not on lm-sensors.
I know they are, but they might not be paying attention to everthing so
an explicit Cc couldn't hurt.
> also, it looks like the following could also benefit some (I havent
> looked closely)
> adm1025,
> adm1031.
> adm9240 ,
> asb100,
> gl520sm.c
> lm{78,85} several *_fan_##ofset##_{min,max,div,input}
>
> A sligthly sloppy grep for DEVICE_ATTR or '##' shows 905 lines.
> in hwmon/*, some of them are junk, but others are legitimate opportunities
> to lose weight.
Yes, virtually every driver can benefit. Just like with Yani Ioannou's
"dynamic sysfs callbacks", the larger the driver, the more it benefits.
> Also. I noticed some repeated uses like this:
> ../../linux-2.6.14.3/drivers/hwmon/gl518sm.c:327:static
> DEVICE_ATTR(in3_input, S_IRUGO, show_in_input3, NULL);
>
> It suggests that DEVICE_ATTR needs a helper initialization macro
> just like SENSOR_ATTR, thoughts ?
It already exists, it's named __ATTR. I'm using it in my (not yet
published) f71805f driver.
Thanks,
--
Jean Delvare
prev parent reply other threads:[~2005-12-24 16:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-10 6:43 [lm-sensors] revisiting __SENSOR_DEVICE_ATTR() and array Jim Cromie
2005-12-10 10:21 ` Jean Delvare
2005-12-14 4:44 ` Jim Cromie
2005-12-16 4:39 ` Mark M. Hoffman
2005-12-16 17:28 ` Jim Cromie
2005-12-18 16:43 ` Jean Delvare
2005-12-18 17:33 ` Jean Delvare
2005-12-19 11:52 ` Jim Cromie
2005-12-19 16:52 ` Jim Cromie
2005-12-24 15:46 ` Jean Delvare
2005-12-24 16:04 ` Jean Delvare [this message]
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=20051224170401.793153ac.khali@linux-fr.org \
--to=khali@linux-fr.org \
--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.