From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI and I2C fixes for 2.6.8
Date: Mon, 23 Aug 2004 11:34:48 -0700 [thread overview]
Message-ID: <10932860883372@kroah.com> (raw)
In-Reply-To: <10932860884122@kroah.com>
ChangeSet 1.1807.56.34, 2004/08/09 10:45:27-07:00, khali@linux-fr.org
[PATCH] I2C: update the lm83 driver
This is an update to the Linux 2.6 lm83 hardware monitoring driver.
* Follow the sysfs interface naming conventions.
* Fix the "force" module parameter.
* Fix limit settings checks.
* Driver is no longer tagged experimental.
These changes are the result of me finally succeeding in getting my LM83
evaluation board to work. If there are norms and standards about how
evaluation boards can be wired, I guess I did not respect any of them,
but it works ;)
Signed-off-by: Jean Delvare <khali at linux-fr dot org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/Kconfig | 2 +-
drivers/i2c/chips/lm83.c | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig 2004-08-23 11:03:23 -07:00
+++ b/drivers/i2c/chips/Kconfig 2004-08-23 11:03:23 -07:00
@@ -149,7 +149,7 @@
config SENSORS_LM83
tristate "National Semiconductor LM83"
- depends on I2C && EXPERIMENTAL
+ depends on I2C
select I2C_SENSOR
help
If you say yes here you get support for National Semiconductor
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c 2004-08-23 11:03:23 -07:00
+++ b/drivers/i2c/chips/lm83.c 2004-08-23 11:03:23 -07:00
@@ -83,8 +83,10 @@
* The LM83 uses signed 8-bit values.
*/
-#define TEMP_FROM_REG(val) ((val > 127 ? val-256 : val) * 1000)
-#define TEMP_TO_REG(val) ((val < 0 ? val+256 : val) / 1000)
+#define TEMP_FROM_REG(val) (((val) > 127 ? (val)-0xFF : (val)) * 1000)
+#define TEMP_TO_REG(val) ((val) <= -50000 ? -50 + 0xFF : (val) >= 127000 ? 127 : \
+ (val) > -500 ? ((val)+500) / 1000 : \
+ ((val)-500) / 1000 + 0xFF)
static const u8 LM83_REG_R_TEMP[] = {
LM83_REG_R_LOCAL_TEMP,
@@ -178,7 +180,7 @@
{ \
struct i2c_client *client = to_i2c_client(dev); \
struct lm83_data *data = i2c_get_clientdata(client); \
- data->value = TEMP_TO_REG(simple_strtoul(buf, NULL, 10)); \
+ data->value = TEMP_TO_REG(simple_strtol(buf, NULL, 10)); \
i2c_smbus_write_byte_data(client, reg, data->value); \
return count; \
}
@@ -206,8 +208,11 @@
set_temp_high3);
static DEVICE_ATTR(temp4_max, S_IWUSR | S_IRUGO, show_temp_high4,
set_temp_high4);
-static DEVICE_ATTR(temp_crit, S_IWUSR | S_IRUGO, show_temp_crit,
+static DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL);
+static DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL);
+static DEVICE_ATTR(temp3_crit, S_IWUSR | S_IRUGO, show_temp_crit,
set_temp_crit);
+static DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL);
static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
/*
@@ -259,6 +264,11 @@
* means that the driver was loaded with the force parameter and a
* given kind of chip is requested, so both the detection and the
* identification steps are skipped. */
+
+ /* Default to an LM83 if forced */
+ if (kind == 0)
+ kind = lm83;
+
if (kind < 0) { /* detection */
if (((i2c_smbus_read_byte_data(new_client, LM83_REG_R_STATUS1)
& 0xA8) != 0x00) ||
@@ -322,7 +332,10 @@
device_create_file(&new_client->dev, &dev_attr_temp2_max);
device_create_file(&new_client->dev, &dev_attr_temp3_max);
device_create_file(&new_client->dev, &dev_attr_temp4_max);
- device_create_file(&new_client->dev, &dev_attr_temp_crit);
+ device_create_file(&new_client->dev, &dev_attr_temp1_crit);
+ device_create_file(&new_client->dev, &dev_attr_temp2_crit);
+ device_create_file(&new_client->dev, &dev_attr_temp3_crit);
+ device_create_file(&new_client->dev, &dev_attr_temp4_crit);
device_create_file(&new_client->dev, &dev_attr_alarms);
return 0;
next prev parent reply other threads:[~2004-08-23 19:04 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-23 18:33 [BK PATCH] PCI and I2C fixes for 2.6.8 Greg KH
2004-08-23 18:34 ` [PATCH] " Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH [this message]
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-23 18:34 ` Greg KH
2004-08-24 8:42 ` Karol Kozimor
2004-08-23 19:30 ` Dave Jones
2004-08-23 19:47 ` Greg KH
2004-08-24 16:56 ` [BK PATCH] " Jean Delvare
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=10932860883372@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox