aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2007-10-14 19:20:50 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-11-08 08:42:45 -0500
commit2ca2fcd124c00a5e733fb0206ef106fade9a76a4 (patch)
treea1e3b46c6e653d1fc66a281fe8bc8dc79ee60d53 /drivers
parentdf48ed804f44a040e990976b537efc1e133c74d8 (diff)
hwmon: (w83627hf) push nr+1 offset into *_REG_FAN macros and simplify
patch changes 2 macros to incorporate the +1, and drops the +1 from all the callers. This also allows a 'reroll' of an expanded loop, and adjusting indexes and loop limits on another. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/w83627hf.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 410f10687cc4..879d0a6544cc 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -170,8 +170,9 @@ superio_exit(void)
170#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ 170#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \
171 (0x550 + (nr) - 7)) 171 (0x550 + (nr) - 7))
172 172
173#define W83781D_REG_FAN_MIN(nr) (0x3a + (nr)) 173/* nr:0-2 for fans:1-3 */
174#define W83781D_REG_FAN(nr) (0x27 + (nr)) 174#define W83627HF_REG_FAN_MIN(nr) (0x3b + (nr))
175#define W83627HF_REG_FAN(nr) (0x28 + (nr))
175 176
176#define W83627HF_REG_TEMP2_CONFIG 0x152 177#define W83627HF_REG_TEMP2_CONFIG 0x152
177#define W83627HF_REG_TEMP3_CONFIG 0x252 178#define W83627HF_REG_TEMP3_CONFIG 0x252
@@ -582,7 +583,7 @@ store_fan_min(struct device *dev, struct device_attribute *devattr,
582 583
583 mutex_lock(&data->update_lock); 584 mutex_lock(&data->update_lock);
584 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); 585 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
585 w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), 586 w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr),
586 data->fan_min[nr]); 587 data->fan_min[nr]);
587 588
588 mutex_unlock(&data->update_lock); 589 mutex_unlock(&data->update_lock);
@@ -814,7 +815,7 @@ store_fan_div(struct device *dev, struct device_attribute *devattr,
814 815
815 /* Restore fan_min */ 816 /* Restore fan_min */
816 data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); 817 data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
817 w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]); 818 w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), data->fan_min[nr]);
818 819
819 mutex_unlock(&data->update_lock); 820 mutex_unlock(&data->update_lock);
820 return count; 821 return count;
@@ -1140,7 +1141,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
1140 struct w83627hf_sio_data *sio_data = dev->platform_data; 1141 struct w83627hf_sio_data *sio_data = dev->platform_data;
1141 struct w83627hf_data *data; 1142 struct w83627hf_data *data;
1142 struct resource *res; 1143 struct resource *res;
1143 int err; 1144 int err, i;
1144 1145
1145 static const char *names[] = { 1146 static const char *names[] = {
1146 "w83627hf", 1147 "w83627hf",
@@ -1174,9 +1175,9 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
1174 w83627hf_init_device(pdev); 1175 w83627hf_init_device(pdev);
1175 1176
1176 /* A few vars need to be filled upon startup */ 1177 /* A few vars need to be filled upon startup */
1177 data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); 1178 for (i = 0; i <= 2; i++)
1178 data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); 1179 data->fan_min[i] = w83627hf_read_value(
1179 data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); 1180 data, W83627HF_REG_FAN_MIN(i));
1180 w83627hf_update_fan_div(data); 1181 w83627hf_update_fan_div(data);
1181 1182
1182 /* Register common device attributes */ 1183 /* Register common device attributes */
@@ -1554,12 +1555,12 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
1554 w83627hf_read_value(data, 1555 w83627hf_read_value(data,
1555 W83781D_REG_IN_MAX(i)); 1556 W83781D_REG_IN_MAX(i));
1556 } 1557 }
1557 for (i = 1; i <= 3; i++) { 1558 for (i = 0; i <= 2; i++) {
1558 data->fan[i - 1] = 1559 data->fan[i] =
1559 w83627hf_read_value(data, W83781D_REG_FAN(i)); 1560 w83627hf_read_value(data, W83627HF_REG_FAN(i));
1560 data->fan_min[i - 1] = 1561 data->fan_min[i] =
1561 w83627hf_read_value(data, 1562 w83627hf_read_value(data,
1562 W83781D_REG_FAN_MIN(i)); 1563 W83627HF_REG_FAN_MIN(i));
1563 } 1564 }
1564 for (i = 0; i <= 2; i++) { 1565 for (i = 0; i <= 2; i++) {
1565 u8 tmp = w83627hf_read_value(data, 1566 u8 tmp = w83627hf_read_value(data,