Commit 8f9e87cd authored by Justin Thiessen's avatar Justin Thiessen Committed by Greg Kroah-Hartman

[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: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 9c0af1ad
...@@ -452,6 +452,14 @@ void adm1026_init_client(struct i2c_client *client) ...@@ -452,6 +452,14 @@ void adm1026_init_client(struct i2c_client *client)
client->id, value); client->id, value);
data->config1 = value; data->config1 = value;
adm1026_write_value(client, ADM1026_REG_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) void adm1026_print_gpio(struct i2c_client *client)
...@@ -459,8 +467,7 @@ void adm1026_print_gpio(struct i2c_client *client) ...@@ -459,8 +467,7 @@ void adm1026_print_gpio(struct i2c_client *client)
struct adm1026_data *data = i2c_get_clientdata(client); struct adm1026_data *data = i2c_get_clientdata(client);
int i; int i;
dev_dbg(&client->dev, "(%d): GPIO config is:", dev_dbg(&client->dev, "(%d): GPIO config is:", client->id);
client->id);
for (i = 0;i <= 7;++i) { for (i = 0;i <= 7;++i) {
if (data->config2 & (1 << i)) { if (data->config2 & (1 << i)) {
dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id, dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment