From: Shawn Starr <shawn.starr@rogers.com>
To: Greg KH <greg@kroah.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>,
linux-kernel@vger.kernel.org, lm78@stimpy.netroedge.com
Subject: [PATCH 2.6.11-rc2] I2C: lm80 driver improvement - again...
Date: Sat, 29 Jan 2005 21:08:55 -0500 [thread overview]
Message-ID: <200501292108.56248.shawn.starr@rogers.com> (raw)
In-Reply-To: <20050129232537.GA14798@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Description: Cleanup some cluttered macros, add error checking for fan divisor value set.
Signed-off-by: Sytse Wielinga <s.b.wielinga@student.utwente.nl>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Shawn Starr <shawn.starr@rogers.com>
[-- Attachment #2: lm80-fixup-3.diff --]
[-- Type: text/plain, Size: 1817 bytes --]
Description: Cleanup some cluttered macros, add error checking for fan divisor value set.
Approved-by: Greg KH <greg@kroah.com>
Signed-off-by: Sytse Wielinga <s.b.wielinga@student.utwente.nl>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Shawn Starr <shawn.starr@rogers.com>
--- linux-2.6.11-rc2/drivers/i2c/chips/lm80.c 2005-01-26 02:04:38.000000000 -0500
+++ linux-2.6.11-rc2-fixes/drivers/i2c/chips/lm80.c 2005-01-26 12:31:26.000000000 -0500
@@ -99,10 +99,7 @@ static inline long TEMP_FROM_REG(u16 tem
#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val)<0?\
((val)-500)/1000:((val)+500)/1000,0,255)
-#define ALARMS_FROM_REG(val) (val)
-
#define DIV_FROM_REG(val) (1 << (val))
-#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
/*
* Client data (each client gets its own)
@@ -269,7 +266,17 @@ static ssize_t set_fan_div(struct device
DIV_FROM_REG(data->fan_div[nr]));
val = simple_strtoul(buf, NULL, 10);
- data->fan_div[nr] = DIV_TO_REG(val);
+
+ switch (val) {
+ case 1: data->fan_div[nr] = 0; break;
+ case 2: data->fan_div[nr] = 1; break;
+ case 4: data->fan_div[nr] = 2; break;
+ case 8: data->fan_div[nr] = 3; break;
+ default:
+ dev_err(&client->dev, "fan_div value %ld not "
+ "supported. Choose one of 1, 2, 4 or 8!\n", val);
+ return -EINVAL;
+ }
reg = (lm80_read_value(client, LM80_REG_FANDIV) & ~(3 << (2 * (nr + 1))))
| (data->fan_div[nr] << (2 * (nr + 1)));
@@ -327,7 +334,7 @@ set_temp(os_hyst, temp_os_hyst, LM80_REG
static ssize_t show_alarms(struct device *dev, char *buf)
{
struct lm80_data *data = lm80_update_device(dev);
- return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms));
+ return sprintf(buf, "%u\n", data->alarms);
}
static DEVICE_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min0, set_in_min0);
next prev parent reply other threads:[~2005-01-30 2:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-26 7:49 [PATCH 2.6.11-rc2] I2C: lm80 driver improvement (From Aurelien) Shawn Starr
2005-01-26 7:57 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement (From Aurelien) - Resubmit Shawn Starr
2005-01-26 16:42 ` Greg KH
2005-01-26 17:31 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement (From Aurelien) - Resubmit #2 Shawn Starr
2005-01-27 9:03 ` Greg KH
2005-01-27 16:56 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement - Shawn Starr
2005-01-29 23:25 ` Greg KH
2005-01-30 2:08 ` Shawn Starr [this message]
2005-02-01 8:12 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement - again Greg KH
2005-01-26 17:54 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement (From Aurelien) - Resubmit Aurélien Jarno
2005-01-26 14:05 ` [PATCH 2.6.11-rc2] I2C: lm80 driver improvement (From Aurelien) Sytse Wielinga
2005-01-26 14:20 ` Sytse Wielinga
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=200501292108.56248.shawn.starr@rogers.com \
--to=shawn.starr@rogers.com \
--cc=aurelien@aurel32.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm78@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