aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 0f60b058ff9d..222c7f4a1e3f 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -152,6 +152,28 @@ static const char f71882fg_has_beep[] = {
152 [f8000] = 0, 152 [f8000] = 0,
153}; 153};
154 154
155static const char f71882fg_nr_fans[] = {
156 [f71808e] = 3,
157 [f71858fg] = 3,
158 [f71862fg] = 3,
159 [f71869] = 3,
160 [f71882fg] = 4,
161 [f71889fg] = 3,
162 [f71889ed] = 3,
163 [f8000] = 3,
164};
165
166static const char f71882fg_nr_temps[] = {
167 [f71808e] = 2,
168 [f71858fg] = 3,
169 [f71862fg] = 3,
170 [f71869] = 3,
171 [f71882fg] = 3,
172 [f71889fg] = 3,
173 [f71889ed] = 3,
174 [f8000] = 3,
175};
176
155static struct platform_device *f71882fg_pdev; 177static struct platform_device *f71882fg_pdev;
156 178
157/* Super-I/O Function prototypes */ 179/* Super-I/O Function prototypes */
@@ -1071,9 +1093,9 @@ static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr)
1071static struct f71882fg_data *f71882fg_update_device(struct device *dev) 1093static struct f71882fg_data *f71882fg_update_device(struct device *dev)
1072{ 1094{
1073 struct f71882fg_data *data = dev_get_drvdata(dev); 1095 struct f71882fg_data *data = dev_get_drvdata(dev);
1096 int nr_fans = f71882fg_nr_fans[data->type];
1097 int nr_temps = f71882fg_nr_temps[data->type];
1074 int nr, reg, point; 1098 int nr, reg, point;
1075 int nr_fans = (data->type == f71882fg) ? 4 : 3;
1076 int nr_temps = (data->type == f71808e) ? 2 : 3;
1077 1099
1078 mutex_lock(&data->update_lock); 1100 mutex_lock(&data->update_lock);
1079 1101
@@ -2042,8 +2064,9 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2042{ 2064{
2043 struct f71882fg_data *data; 2065 struct f71882fg_data *data;
2044 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; 2066 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
2045 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; 2067 int nr_fans = f71882fg_nr_fans[sio_data->type];
2046 int nr_temps = (sio_data->type == f71808e) ? 2 : 3; 2068 int nr_temps = f71882fg_nr_temps[sio_data->type];
2069 int err, i;
2047 u8 start_reg, reg; 2070 u8 start_reg, reg;
2048 2071
2049 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); 2072 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL);
@@ -2276,8 +2299,9 @@ exit_free:
2276static int f71882fg_remove(struct platform_device *pdev) 2299static int f71882fg_remove(struct platform_device *pdev)
2277{ 2300{
2278 struct f71882fg_data *data = platform_get_drvdata(pdev); 2301 struct f71882fg_data *data = platform_get_drvdata(pdev);
2279 int i, nr_fans = (data->type == f71882fg) ? 4 : 3; 2302 int nr_fans = f71882fg_nr_fans[data->type];
2280 int nr_temps = (data->type == f71808e) ? 2 : 3; 2303 int nr_temps = f71882fg_nr_temps[data->type];
2304 int i;
2281 u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); 2305 u8 start_reg = f71882fg_read8(data, F71882FG_REG_START);
2282 2306
2283 if (data->hwmon_dev) 2307 if (data->hwmon_dev)