* Sensors patch 2.5.71
@ 2003-06-15 11:12 Margit Schubert-While
2003-06-16 18:41 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Margit Schubert-While @ 2003-06-15 11:12 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg KH
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
Patch for adm1021
This corrects temp reporting and a major error whereby
"alarms" and "die_code" were being put though the "TEMP" macro.
Compiled but don't have the hardware to test.
Greg, can you push ?
The lm85 patch that I sent also, of course, applies to 2.5.71 and can be pushed
as is.
Margit
[-- Attachment #2: sensorspatch2571 --]
[-- Type: application/octet-stream, Size: 1355 bytes --]
diff -Naur linux-2.5.71/drivers/i2c/chips/adm1021.c linux-2.5.71mw/drivers/i2c/chips/adm1021.c
--- linux-2.5.71/drivers/i2c/chips/adm1021.c 2003-06-14 21:17:56.000000000 +0200
+++ linux-2.5.71mw/drivers/i2c/chips/adm1021.c 2003-06-15 12:28:02.000000000 +0200
@@ -88,8 +88,8 @@
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
/* Conversions note: 1021 uses normal integer signed-byte format*/
-#define TEMP_FROM_REG(val) (val > 127 ? val-256 : val)
-#define TEMP_TO_REG(val) (SENSORS_LIMIT((val < 0 ? val+256 : val),0,255))
+#define TEMP_FROM_REG(val) (val > 127 ? (val-256)*1000 : val*1000)
+#define TEMP_TO_REG(val) (SENSORS_LIMIT((val < 0 ? (val/1000)+256 : val/1000),0,255))
/* Initial values */
@@ -172,8 +172,18 @@
show(remote_temp_max);
show(remote_temp_hyst);
show(remote_temp_input);
-show(alarms);
-show(die_code);
+
+#define show2(value) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+ struct i2c_client *client = to_i2c_client(dev); \
+ struct adm1021_data *data = i2c_get_clientdata(client); \
+ \
+ adm1021_update_client(client); \
+ return sprintf(buf, "%d\n", data->value); \
+}
+show2(alarms);
+show2(die_code);
#define set(value, reg) \
static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-16 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-15 11:12 Sensors patch 2.5.71 Margit Schubert-While
2003-06-16 18:41 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®