public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] i2c driver changes for 2.5.72
Date: Wed, 18 Jun 2003 11:25:09 -0700	[thread overview]
Message-ID: <10559607093836@kroah.com> (raw)
In-Reply-To: <10559607081420@kroah.com>

ChangeSet 1.1318.3.6, 2003/06/16 11:40:37-07:00, margitsw@t-online.de

[PATCH] I2C: Sensors patch for adm1021

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.


 drivers/i2c/chips/adm1021.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)


diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c	Wed Jun 18 11:19:25 2003
+++ b/drivers/i2c/chips/adm1021.c	Wed Jun 18 11:19:25 2003
@@ -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)	\


  reply	other threads:[~2003-06-18 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-18 18:24 [BK PATCH] i2c driver changes for 2.5.72 Greg KH
2003-06-18 18:25 ` [PATCH] " Greg KH
2003-06-18 18:25   ` Greg KH
2003-06-18 18:25     ` Greg KH
2003-06-18 18:25       ` Greg KH
2003-06-18 18:25         ` Greg KH
2003-06-18 18:25           ` Greg KH [this message]
2003-06-18 18:25             ` Greg KH
2003-06-18 18:25               ` Greg KH

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=10559607093836@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@stimpy.netroedge.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox