[ patch ] de-macro-fy w83627hf.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All, Mark,

w83627hf.c has lots of macros which generate repetetive sysfs callback 
functions.

Attached patch replaces most of them, and upgrades several DEVICE_ATTR
declarations with SENSOR_DEVICE_ATTRs as needed to determine which
the callbacks need to determine which sensor-number is being accessed.

Patched driver works on my W83627HF equipped AMD-Barton MOBO.

If you have one of the other parts supported by this board, please test 
this patch
and let me know.  (ie Ack/Nack this and subsequent revisions)


WRT Submission:

1 - the patch is getting big, so Id like to hear whether its acceptable 
in one big lump.

 diffstat diff.hwmon-w83627hf-demacro-sysfs-callbacks
 w83627hf.c |  516 
++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 254 insertions(+), 262 deletions(-)

If I should break it up, Id probably do it on VIN, FAN, PWM, TEMP 
boundaries,
unless you have other thoughts.


2 - checkpatch complains about a few things - and fixing them would 
enlarge the patch,
and thus may qualify for separation (or ignoring)

line over 80 characters
#27: FILE: drivers/hwmon/w83627hf.c:422:
+static ssize_t show_in_input(struct device *dev, struct 
device_attribute *devattr, char *buf)

IIUC, Linus thinks this check is somewhat nazi-ish (his word), and I 
recall that some people
prefer to have the entire function-signature on a single line (grep 
friendly)

Macros with multiple statements should be enclosed in a do - while loop
#76: FILE: drivers/hwmon/w83627hf.c:471:
+#define vin_decl(offset)       \
+static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO,                 \

Ive stuffed repetetive declarations and initializations into macros,
and this warning is unavoidable for those uses.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.hwmon-w83627hf-demacro-sysfs-callbacks
Url: http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20070707/07883681/attachment.pl 


[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux