aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-09 14:57:11 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-03-15 01:39:22 -0400
commit60d2b378bb7ad1624d1332821da750d1eec50c53 (patch)
tree341cf5d5fdf8edfbfaddae1faffdbf4b24cf08fc /drivers/hwmon
parent0bae640088b5bd6c7a2a691ad20543d69c2b9b2c (diff)
hwmon/f71882fg: Make number of temps configurable
Make the temp sysattr array for the standard models a 2d array, which allows to use it for models with less temperatures too. This is a preparation patch for adding support for more different models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/f71882fg.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index ec29c611ed3e..bf939e1aa73f 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -325,7 +325,7 @@ static struct sensor_device_attribute_2 f71858fg_temp_attr[] = {
325}; 325};
326 326
327/* Temp attr for the standard models */ 327/* Temp attr for the standard models */
328static struct sensor_device_attribute_2 fxxxx_temp_attr[] = { 328static struct sensor_device_attribute_2 fxxxx_temp_attr[3][11] = { {
329 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1), 329 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1),
330 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, 330 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max,
331 store_temp_max, 0, 1), 331 store_temp_max, 0, 1),
@@ -346,6 +346,7 @@ static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
346 store_temp_beep, 0, 5), 346 store_temp_beep, 0, 5),
347 SENSOR_ATTR_2(temp1_type, S_IRUGO, show_temp_type, NULL, 0, 1), 347 SENSOR_ATTR_2(temp1_type, S_IRUGO, show_temp_type, NULL, 0, 1),
348 SENSOR_ATTR_2(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0, 1), 348 SENSOR_ATTR_2(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0, 1),
349}, {
349 SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 2), 350 SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 2),
350 SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_max, 351 SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_max,
351 store_temp_max, 0, 2), 352 store_temp_max, 0, 2),
@@ -364,6 +365,7 @@ static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
364 store_temp_beep, 0, 6), 365 store_temp_beep, 0, 6),
365 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2), 366 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2),
366 SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), 367 SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
368}, {
367 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3), 369 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3),
368 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, 370 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max,
369 store_temp_max, 0, 3), 371 store_temp_max, 0, 3),
@@ -382,7 +384,7 @@ static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
382 store_temp_beep, 0, 7), 384 store_temp_beep, 0, 7),
383 SENSOR_ATTR_2(temp3_type, S_IRUGO, show_temp_type, NULL, 0, 3), 385 SENSOR_ATTR_2(temp3_type, S_IRUGO, show_temp_type, NULL, 0, 3),
384 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3), 386 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3),
385}; 387} };
386 388
387/* Temp attr for the f8000 389/* Temp attr for the f8000
388 Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max) 390 Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max)
@@ -1919,6 +1921,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1919 struct f71882fg_data *data; 1921 struct f71882fg_data *data;
1920 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; 1922 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
1921 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; 1923 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3;
1924 int nr_temps = 3;
1922 u8 start_reg, reg; 1925 u8 start_reg, reg;
1923 1926
1924 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); 1927 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL);
@@ -1972,8 +1975,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1972 break; 1975 break;
1973 default: 1976 default:
1974 err = f71882fg_create_sysfs_files(pdev, 1977 err = f71882fg_create_sysfs_files(pdev,
1975 fxxxx_temp_attr, 1978 &fxxxx_temp_attr[0][0],
1976 ARRAY_SIZE(fxxxx_temp_attr)); 1979 ARRAY_SIZE(fxxxx_temp_attr[0]) * nr_temps);
1977 } 1980 }
1978 if (err) 1981 if (err)
1979 goto exit_unregister_sysfs; 1982 goto exit_unregister_sysfs;
@@ -2116,6 +2119,7 @@ static int f71882fg_remove(struct platform_device *pdev)
2116{ 2119{
2117 struct f71882fg_data *data = platform_get_drvdata(pdev); 2120 struct f71882fg_data *data = platform_get_drvdata(pdev);
2118 int i, nr_fans = (data->type == f71882fg) ? 4 : 3; 2121 int i, nr_fans = (data->type == f71882fg) ? 4 : 3;
2122 int nr_temps = 3;
2119 u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); 2123 u8 start_reg = f71882fg_read8(data, F71882FG_REG_START);
2120 2124
2121 if (data->hwmon_dev) 2125 if (data->hwmon_dev)
@@ -2142,8 +2146,8 @@ static int f71882fg_remove(struct platform_device *pdev)
2142 break; 2146 break;
2143 default: 2147 default:
2144 f71882fg_remove_sysfs_files(pdev, 2148 f71882fg_remove_sysfs_files(pdev,
2145 fxxxx_temp_attr, 2149 &fxxxx_temp_attr[0][0],
2146 ARRAY_SIZE(fxxxx_temp_attr)); 2150 ARRAY_SIZE(fxxxx_temp_attr[0]) * nr_temps);
2147 } 2151 }
2148 for (i = 0; i < F71882FG_MAX_INS; i++) { 2152 for (i = 0; i < F71882FG_MAX_INS; i++) {
2149 if (f71882fg_has_in[data->type][i]) { 2153 if (f71882fg_has_in[data->type][i]) {