diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/hwmon/abituguru.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/hwmon/abituguru.c')
-rw-r--r-- | drivers/hwmon/abituguru.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 03694cc17a32..65a35cf5b3c5 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | abituguru.c Copyright (c) 2005-2006 Hans de Goede <j.w.r.degoede@hhs.nl> | 2 | abituguru.c Copyright (c) 2005-2006 Hans de Goede <hdegoede@redhat.com> |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -20,6 +20,9 @@ | |||
20 | the custom Abit uGuru chip found on Abit uGuru motherboards. Note: because | 20 | the custom Abit uGuru chip found on Abit uGuru motherboards. Note: because |
21 | of lack of specs the CPU/RAM voltage & frequency control is not supported! | 21 | of lack of specs the CPU/RAM voltage & frequency control is not supported! |
22 | */ | 22 | */ |
23 | |||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
23 | #include <linux/module.h> | 26 | #include <linux/module.h> |
24 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
25 | #include <linux/init.h> | 28 | #include <linux/init.h> |
@@ -220,6 +223,10 @@ struct abituguru_data { | |||
220 | u8 pwm_settings[ABIT_UGURU_MAX_PWMS][5]; | 223 | u8 pwm_settings[ABIT_UGURU_MAX_PWMS][5]; |
221 | }; | 224 | }; |
222 | 225 | ||
226 | static const char *never_happen = "This should never happen."; | ||
227 | static const char *report_this = | ||
228 | "Please report this to the abituguru maintainer (see MAINTAINERS)"; | ||
229 | |||
223 | /* wait till the uguru is in the specified state */ | 230 | /* wait till the uguru is in the specified state */ |
224 | static int abituguru_wait(struct abituguru_data *data, u8 state) | 231 | static int abituguru_wait(struct abituguru_data *data, u8 state) |
225 | { | 232 | { |
@@ -438,8 +445,7 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
438 | 445 | ||
439 | /* Test val is sane / usable for sensor type detection. */ | 446 | /* Test val is sane / usable for sensor type detection. */ |
440 | if ((val < 10u) || (val > 250u)) { | 447 | if ((val < 10u) || (val > 250u)) { |
441 | printk(KERN_WARNING ABIT_UGURU_NAME | 448 | pr_warn("bank1-sensor: %d reading (%d) too close to limits, " |
442 | ": bank1-sensor: %d reading (%d) too close to limits, " | ||
443 | "unable to determine sensor type, skipping sensor\n", | 449 | "unable to determine sensor type, skipping sensor\n", |
444 | (int)sensor_addr, (int)val); | 450 | (int)sensor_addr, (int)val); |
445 | /* assume no sensor is there for sensors for which we can't | 451 | /* assume no sensor is there for sensors for which we can't |
@@ -535,10 +541,8 @@ abituguru_detect_bank1_sensor_type_exit: | |||
535 | 3) == 3) | 541 | 3) == 3) |
536 | break; | 542 | break; |
537 | if (i == 3) { | 543 | if (i == 3) { |
538 | printk(KERN_ERR ABIT_UGURU_NAME | 544 | pr_err("Fatal error could not restore original settings. %s %s\n", |
539 | ": Fatal error could not restore original settings. " | 545 | never_happen, report_this); |
540 | "This should never happen please report this to the " | ||
541 | "abituguru maintainer (see MAINTAINERS)\n"); | ||
542 | return -ENODEV; | 546 | return -ENODEV; |
543 | } | 547 | } |
544 | return ret; | 548 | return ret; |
@@ -1268,14 +1272,12 @@ static int __devinit abituguru_probe(struct platform_device *pdev) | |||
1268 | } | 1272 | } |
1269 | /* Fail safe check, this should never happen! */ | 1273 | /* Fail safe check, this should never happen! */ |
1270 | if (sysfs_names_free < 0) { | 1274 | if (sysfs_names_free < 0) { |
1271 | printk(KERN_ERR ABIT_UGURU_NAME ": Fatal error ran out of " | 1275 | pr_err("Fatal error ran out of space for sysfs attr names. %s %s", |
1272 | "space for sysfs attr names. This should never " | 1276 | never_happen, report_this); |
1273 | "happen please report to the abituguru maintainer " | ||
1274 | "(see MAINTAINERS)\n"); | ||
1275 | res = -ENAMETOOLONG; | 1277 | res = -ENAMETOOLONG; |
1276 | goto abituguru_probe_error; | 1278 | goto abituguru_probe_error; |
1277 | } | 1279 | } |
1278 | printk(KERN_INFO ABIT_UGURU_NAME ": found Abit uGuru\n"); | 1280 | pr_info("found Abit uGuru\n"); |
1279 | 1281 | ||
1280 | /* Register sysfs hooks */ | 1282 | /* Register sysfs hooks */ |
1281 | for (i = 0; i < sysfs_attr_i; i++) | 1283 | for (i = 0; i < sysfs_attr_i; i++) |
@@ -1420,7 +1422,7 @@ static int __init abituguru_detect(void) | |||
1420 | at DATA and 0xAC, when this driver has already been loaded once | 1422 | at DATA and 0xAC, when this driver has already been loaded once |
1421 | DATA will hold 0x08. For most uGuru's CMD will hold 0xAC in either | 1423 | DATA will hold 0x08. For most uGuru's CMD will hold 0xAC in either |
1422 | scenario but some will hold 0x00. | 1424 | scenario but some will hold 0x00. |
1423 | Some uGuru's initally hold 0x09 at DATA and will only hold 0x08 | 1425 | Some uGuru's initially hold 0x09 at DATA and will only hold 0x08 |
1424 | after reading CMD first, so CMD must be read first! */ | 1426 | after reading CMD first, so CMD must be read first! */ |
1425 | u8 cmd_val = inb_p(ABIT_UGURU_BASE + ABIT_UGURU_CMD); | 1427 | u8 cmd_val = inb_p(ABIT_UGURU_BASE + ABIT_UGURU_CMD); |
1426 | u8 data_val = inb_p(ABIT_UGURU_BASE + ABIT_UGURU_DATA); | 1428 | u8 data_val = inb_p(ABIT_UGURU_BASE + ABIT_UGURU_DATA); |
@@ -1432,8 +1434,7 @@ static int __init abituguru_detect(void) | |||
1432 | "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val); | 1434 | "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val); |
1433 | 1435 | ||
1434 | if (force) { | 1436 | if (force) { |
1435 | printk(KERN_INFO ABIT_UGURU_NAME ": Assuming Abit uGuru is " | 1437 | pr_info("Assuming Abit uGuru is present because of \"force\" parameter\n"); |
1436 | "present because of \"force\" parameter\n"); | ||
1437 | return ABIT_UGURU_BASE; | 1438 | return ABIT_UGURU_BASE; |
1438 | } | 1439 | } |
1439 | 1440 | ||
@@ -1447,15 +1448,12 @@ static int __init abituguru_init(void) | |||
1447 | { | 1448 | { |
1448 | int address, err; | 1449 | int address, err; |
1449 | struct resource res = { .flags = IORESOURCE_IO }; | 1450 | struct resource res = { .flags = IORESOURCE_IO }; |
1450 | |||
1451 | #ifdef CONFIG_DMI | ||
1452 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1451 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1453 | 1452 | ||
1454 | /* safety check, refuse to load on non Abit motherboards */ | 1453 | /* safety check, refuse to load on non Abit motherboards */ |
1455 | if (!force && (!board_vendor || | 1454 | if (!force && (!board_vendor || |
1456 | strcmp(board_vendor, "http://www.abit.com.tw/"))) | 1455 | strcmp(board_vendor, "http://www.abit.com.tw/"))) |
1457 | return -ENODEV; | 1456 | return -ENODEV; |
1458 | #endif | ||
1459 | 1457 | ||
1460 | address = abituguru_detect(); | 1458 | address = abituguru_detect(); |
1461 | if (address < 0) | 1459 | if (address < 0) |
@@ -1467,8 +1465,7 @@ static int __init abituguru_init(void) | |||
1467 | 1465 | ||
1468 | abituguru_pdev = platform_device_alloc(ABIT_UGURU_NAME, address); | 1466 | abituguru_pdev = platform_device_alloc(ABIT_UGURU_NAME, address); |
1469 | if (!abituguru_pdev) { | 1467 | if (!abituguru_pdev) { |
1470 | printk(KERN_ERR ABIT_UGURU_NAME | 1468 | pr_err("Device allocation failed\n"); |
1471 | ": Device allocation failed\n"); | ||
1472 | err = -ENOMEM; | 1469 | err = -ENOMEM; |
1473 | goto exit_driver_unregister; | 1470 | goto exit_driver_unregister; |
1474 | } | 1471 | } |
@@ -1479,15 +1476,13 @@ static int __init abituguru_init(void) | |||
1479 | 1476 | ||
1480 | err = platform_device_add_resources(abituguru_pdev, &res, 1); | 1477 | err = platform_device_add_resources(abituguru_pdev, &res, 1); |
1481 | if (err) { | 1478 | if (err) { |
1482 | printk(KERN_ERR ABIT_UGURU_NAME | 1479 | pr_err("Device resource addition failed (%d)\n", err); |
1483 | ": Device resource addition failed (%d)\n", err); | ||
1484 | goto exit_device_put; | 1480 | goto exit_device_put; |
1485 | } | 1481 | } |
1486 | 1482 | ||
1487 | err = platform_device_add(abituguru_pdev); | 1483 | err = platform_device_add(abituguru_pdev); |
1488 | if (err) { | 1484 | if (err) { |
1489 | printk(KERN_ERR ABIT_UGURU_NAME | 1485 | pr_err("Device addition failed (%d)\n", err); |
1490 | ": Device addition failed (%d)\n", err); | ||
1491 | goto exit_device_put; | 1486 | goto exit_device_put; |
1492 | } | 1487 | } |
1493 | 1488 | ||
@@ -1507,7 +1502,7 @@ static void __exit abituguru_exit(void) | |||
1507 | platform_driver_unregister(&abituguru_driver); | 1502 | platform_driver_unregister(&abituguru_driver); |
1508 | } | 1503 | } |
1509 | 1504 | ||
1510 | MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); | 1505 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
1511 | MODULE_DESCRIPTION("Abit uGuru Sensor device"); | 1506 | MODULE_DESCRIPTION("Abit uGuru Sensor device"); |
1512 | MODULE_LICENSE("GPL"); | 1507 | MODULE_LICENSE("GPL"); |
1513 | 1508 | ||