All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@suse.de (Greg KH)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (11/11)
Date: Mon, 05 Sep 2005 23:47:28 +0000	[thread overview]
Message-ID: <11259567691080@kroah.com> (raw)

[PATCH] hwmon: hwmon vs i2c, second round (11/11)

Use the common vid_from_reg function in lm78 rather than
reimplementing it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 19f673eddb5a406be72989fb57b7f286772b8cf4
tree d552112cd0721467e6ff0a13f8eef7c3491c847c
parent d0f282706df877f8fd8869419e308d24eedb523b
author Jean Delvare <khali@linux-fr.org> Sun, 31 Jul 2005 22:12:09 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 05 Sep 2005 09:14:24 -0700

 drivers/hwmon/Kconfig |    1 +
 drivers/hwmon/lm78.c  |   10 ++--------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -207,6 +207,7 @@ config SENSORS_LM78
 	tristate "National Semiconductor LM78 and compatibles"
 	depends on HWMON && I2C && EXPERIMENTAL
 	select I2C_ISA
+	select HWMON_VID
 	help
 	  If you say yes here you get support for National Semiconductor LM78,
 	  LM78-J and LM79.
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -25,6 +25,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
 #include <linux/hwmon.h>
+#include <linux/hwmon-vid.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
@@ -106,13 +107,6 @@ static inline int TEMP_FROM_REG(s8 val)
 	return val * 1000;
 }
 
-/* VID: mV
-   REG: (see doc/vid) */
-static inline int VID_FROM_REG(u8 val)
-{
-	return val=0x1f ? 0 : val>=0x10 ? 5100-val*100 : 2050-val*50;
-}
-
 #define DIV_FROM_REG(val) (1 << (val))
 
 /* There are some complications in a module like this. First off, LM78 chips
@@ -457,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, sh
 static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct lm78_data *data = lm78_update_device(dev);
-	return sprintf(buf, "%d\n", VID_FROM_REG(data->vid));
+	return sprintf(buf, "%d\n", vid_from_reg(82, data->vid));
 }
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
 


             reply	other threads:[~2005-09-05 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-05 23:47 Greg KH [this message]
2005-09-05 23:47 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (01/11) Greg KH
2005-09-05 23:47 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (04/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (05/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (02/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (06/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (03/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (09/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (07/11) Greg KH
2005-09-05 23:48 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (08/11) Greg KH
2005-09-05 23:49 ` [lm-sensors] [PATCH] hwmon: hwmon vs i2c, second round (10/11) 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=11259567691080@kroah.com \
    --to=gregkh@suse.de \
    --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.