From: greg@kroah.com (Greg KH)
To: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Cc: jthiessen@penguincomputing.com
Subject: [PATCH] I2C: adm1026.c fixes
Date: Thu, 19 May 2005 06:25:31 +0000 [thread overview]
Message-ID: <11059983953842@kroah.com> (raw)
In-Reply-To: <11059983952608@kroah.com>
ChangeSet 1.2329.2.4, 2005/01/14 14:42:28-08:00, jthiessen@penguincomputing.com
[PATCH] I2C: adm1026.c fixes
Ok, take 3 on the adm1026 patch.
In this patch:
(1) Code has been added which ensures that the fan divisor registers are
properly read into the data structure before fan minimum speeds are
determined. This prevents a possible divide by zero error. The line
which reads the hardware default fan divisor values has been reformatted
as suggested by Andreas Dilger to make the intent of the statement clearer.
(2) In a similar spirit, an unecessary carriage return from a "dev_dbg"
statement in the adm1026_print_gpio() function has been elminated,
shortening the statement to a single line and making the code easier
to read.
Signed-off-by: Justin Thiessen <jthiessen@penguincomputing.com
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/adm1026.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff -Nru a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
--- a/drivers/i2c/chips/adm1026.c 2005-01-17 13:20:53 -08:00
+++ b/drivers/i2c/chips/adm1026.c 2005-01-17 13:20:53 -08:00
@@ -452,6 +452,14 @@
client->id, value);
data->config1 = value;
adm1026_write_value(client, ADM1026_REG_CONFIG1, value);
+
+ /* initialize fan_div[] to hardware defaults */
+ value = adm1026_read_value(client, ADM1026_REG_FAN_DIV_0_3) |
+ (adm1026_read_value(client, ADM1026_REG_FAN_DIV_4_7) << 8);
+ for (i = 0;i <= 7;++i) {
+ data->fan_div[i] = DIV_FROM_REG(value & 0x03);
+ value >>= 2;
+ }
}
void adm1026_print_gpio(struct i2c_client *client)
@@ -459,8 +467,7 @@
struct adm1026_data *data = i2c_get_clientdata(client);
int i;
- dev_dbg(&client->dev, "(%d): GPIO config is:",
- client->id);
+ dev_dbg(&client->dev, "(%d): GPIO config is:", client->id);
for (i = 0;i <= 7;++i) {
if (data->config2 & (1 << i)) {
dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id,
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@Stimpy.netroedge.com
Cc: jthiessen@penguincomputing.com
Subject: [PATCH] I2C: adm1026.c fixes
Date: Mon, 17 Jan 2005 13:46:35 -0800 [thread overview]
Message-ID: <11059983953842@kroah.com> (raw)
In-Reply-To: <11059983952608@kroah.com>
ChangeSet 1.2329.2.4, 2005/01/14 14:42:28-08:00, jthiessen@penguincomputing.com
[PATCH] I2C: adm1026.c fixes
Ok, take 3 on the adm1026 patch.
In this patch:
(1) Code has been added which ensures that the fan divisor registers are
properly read into the data structure before fan minimum speeds are
determined. This prevents a possible divide by zero error. The line
which reads the hardware default fan divisor values has been reformatted
as suggested by Andreas Dilger to make the intent of the statement clearer.
(2) In a similar spirit, an unecessary carriage return from a "dev_dbg"
statement in the adm1026_print_gpio() function has been elminated,
shortening the statement to a single line and making the code easier
to read.
Signed-off-by: Justin Thiessen <jthiessen@penguincomputing.com
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/chips/adm1026.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff -Nru a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
--- a/drivers/i2c/chips/adm1026.c 2005-01-17 13:20:53 -08:00
+++ b/drivers/i2c/chips/adm1026.c 2005-01-17 13:20:53 -08:00
@@ -452,6 +452,14 @@
client->id, value);
data->config1 = value;
adm1026_write_value(client, ADM1026_REG_CONFIG1, value);
+
+ /* initialize fan_div[] to hardware defaults */
+ value = adm1026_read_value(client, ADM1026_REG_FAN_DIV_0_3) |
+ (adm1026_read_value(client, ADM1026_REG_FAN_DIV_4_7) << 8);
+ for (i = 0;i <= 7;++i) {
+ data->fan_div[i] = DIV_FROM_REG(value & 0x03);
+ value >>= 2;
+ }
}
void adm1026_print_gpio(struct i2c_client *client)
@@ -459,8 +467,7 @@
struct adm1026_data *data = i2c_get_clientdata(client);
int i;
- dev_dbg(&client->dev, "(%d): GPIO config is:",
- client->id);
+ dev_dbg(&client->dev, "(%d): GPIO config is:", client->id);
for (i = 0;i <= 7;++i) {
if (data->config2 & (1 << i)) {
dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id,
next prev parent reply other threads:[~2005-05-19 6:25 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-17 21:45 [BK PATCH] I2C fixes for 2.6.11-rc1 Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: add MODULE_DEVICE_TABLE to via686a.c driver Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C support for Intel ICH7 - 2.6.10 - resubmit Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: it87 fan update Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` Greg KH [this message]
2005-05-19 6:25 ` [PATCH] I2C: adm1026.c fixes Greg KH
2005-01-17 21:46 ` [PATCH] I2C: Fix bogus bitmask in lm63 debug message Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: Cleanups to the eeprom driver Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: fix it87 sensor driver stops CPU fan Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: add EMC6D100 support in lm85 driver Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C: Improve it87 super-i/o detection Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 21:46 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Greg KH
2005-05-19 6:25 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Greg KH
2005-01-17 21:46 ` [PATCH] I2C-MPC: Convert to platform_device driver Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-17 22:12 ` [BK PATCH] I2C fixes for 2.6.11-rc1 Greg KH
2005-05-19 6:25 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2005-05-19 6:25 [PATCH] I2C-MPC: use wait_event_interruptible_timeout Kumar Gala
2005-05-19 6:25 ` Kumar Gala
2005-05-19 6:25 ` Greg KH
2005-01-14 3:35 [PATCH] I2C-MPC: Convert to platform_device driver Kumar Gala
2005-05-19 6:25 ` Kumar Gala
2005-01-14 3:35 ` Kumar Gala
2005-01-14 18:42 ` Greg KH
2005-05-19 6:25 ` Greg KH
2005-01-14 18:42 ` Greg KH
2005-01-14 0:21 [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Kumar Gala
2005-05-19 6:25 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Kumar Gala
2005-01-14 0:21 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions Kumar Gala
2005-01-14 18:41 ` Greg KH
2005-05-19 6:25 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between Greg KH
2005-01-14 18:41 ` [PATCH] I2C-MPC: use wait_event_interruptible_timeout between transactions 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=11059983953842@kroah.com \
--to=greg@kroah.com \
--cc=jthiessen@penguincomputing.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 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.