aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/abituguru.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index 03694cc17a3..8f07a9dda15 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -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
226static const char *never_happen = "This should never happen.";
227static 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 */
224static int abituguru_wait(struct abituguru_data *data, u8 state) 231static 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++)
@@ -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
@@ -1467,8 +1468,7 @@ static int __init abituguru_init(void)
1467 1468
1468 abituguru_pdev = platform_device_alloc(ABIT_UGURU_NAME, address); 1469 abituguru_pdev = platform_device_alloc(ABIT_UGURU_NAME, address);
1469 if (!abituguru_pdev) { 1470 if (!abituguru_pdev) {
1470 printk(KERN_ERR ABIT_UGURU_NAME 1471 pr_err("Device allocation failed\n");
1471 ": Device allocation failed\n");
1472 err = -ENOMEM; 1472 err = -ENOMEM;
1473 goto exit_driver_unregister; 1473 goto exit_driver_unregister;
1474 } 1474 }
@@ -1479,15 +1479,13 @@ static int __init abituguru_init(void)
1479 1479
1480 err = platform_device_add_resources(abituguru_pdev, &res, 1); 1480 err = platform_device_add_resources(abituguru_pdev, &res, 1);
1481 if (err) { 1481 if (err) {
1482 printk(KERN_ERR ABIT_UGURU_NAME 1482 pr_err("Device resource addition failed (%d)\n", err);
1483 ": Device resource addition failed (%d)\n", err);
1484 goto exit_device_put; 1483 goto exit_device_put;
1485 } 1484 }
1486 1485
1487 err = platform_device_add(abituguru_pdev); 1486 err = platform_device_add(abituguru_pdev);
1488 if (err) { 1487 if (err) {
1489 printk(KERN_ERR ABIT_UGURU_NAME 1488 pr_err("Device addition failed (%d)\n", err);
1490 ": Device addition failed (%d)\n", err);
1491 goto exit_device_put; 1489 goto exit_device_put;
1492 } 1490 }
1493 1491