aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/abituguru3.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/abituguru3.c')
-rw-r--r--drivers/hwmon/abituguru3.c64
1 files changed, 22 insertions, 42 deletions
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index 3cf28af614b5..d30855a75786 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -1,7 +1,7 @@
1/* 1/*
2 abituguru3.c 2 abituguru3.c
3 3
4 Copyright (c) 2006-2008 Hans de Goede <j.w.r.degoede@hhs.nl> 4 Copyright (c) 2006-2008 Hans de Goede <hdegoede@redhat.com>
5 Copyright (c) 2008 Alistair John Strachan <alistair@devzero.co.uk> 5 Copyright (c) 2008 Alistair John Strachan <alistair@devzero.co.uk>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,9 @@
23 chip found on newer Abit uGuru motherboards. Note: because of lack of specs 23 chip found on newer Abit uGuru motherboards. Note: because of lack of specs
24 only reading the sensors and their settings is supported. 24 only reading the sensors and their settings is supported.
25*/ 25*/
26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
26#include <linux/module.h> 29#include <linux/module.h>
27#include <linux/init.h> 30#include <linux/init.h>
28#include <linux/slab.h> 31#include <linux/slab.h>
@@ -148,7 +151,7 @@ struct abituguru3_data {
148 /* Pointer to the sensors info for the detected motherboard */ 151 /* Pointer to the sensors info for the detected motherboard */
149 const struct abituguru3_sensor_info *sensors; 152 const struct abituguru3_sensor_info *sensors;
150 153
151 /* The abituguru3 supports upto 48 sensors, and thus has registers 154 /* The abituguru3 supports up to 48 sensors, and thus has registers
152 sets for 48 sensors, for convienence reasons / simplicity of the 155 sets for 48 sensors, for convienence reasons / simplicity of the
153 code we always read and store all registers for all 48 sensors */ 156 code we always read and store all registers for all 48 sensors */
154 157
@@ -608,6 +611,9 @@ static int verbose = 1;
608module_param(verbose, bool, 0644); 611module_param(verbose, bool, 0644);
609MODULE_PARM_DESC(verbose, "Enable/disable verbose error reporting"); 612MODULE_PARM_DESC(verbose, "Enable/disable verbose error reporting");
610 613
614static const char *never_happen = "This should never happen.";
615static const char *report_this =
616 "Please report this to the abituguru3 maintainer (see MAINTAINERS)";
611 617
612/* wait while the uguru is busy (usually after a write) */ 618/* wait while the uguru is busy (usually after a write) */
613static int abituguru3_wait_while_busy(struct abituguru3_data *data) 619static int abituguru3_wait_while_busy(struct abituguru3_data *data)
@@ -940,15 +946,13 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
940 if (abituguru3_motherboards[i].id == id) 946 if (abituguru3_motherboards[i].id == id)
941 break; 947 break;
942 if (!abituguru3_motherboards[i].id) { 948 if (!abituguru3_motherboards[i].id) {
943 printk(KERN_ERR ABIT_UGURU3_NAME ": error unknown motherboard " 949 pr_err("error unknown motherboard ID: %04X. %s\n",
944 "ID: %04X. Please report this to the abituguru3 " 950 (unsigned int)id, report_this);
945 "maintainer (see MAINTAINERS)\n", (unsigned int)id);
946 goto abituguru3_probe_error; 951 goto abituguru3_probe_error;
947 } 952 }
948 data->sensors = abituguru3_motherboards[i].sensors; 953 data->sensors = abituguru3_motherboards[i].sensors;
949 954
950 printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " 955 pr_info("found Abit uGuru3, motherboard ID: %04X\n", (unsigned int)id);
951 "ID: %04X\n", (unsigned int)id);
952 956
953 /* Fill the sysfs attr array */ 957 /* Fill the sysfs attr array */
954 sysfs_attr_i = 0; 958 sysfs_attr_i = 0;
@@ -957,11 +961,8 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
957 for (i = 0; data->sensors[i].name; i++) { 961 for (i = 0; data->sensors[i].name; i++) {
958 /* Fail safe check, this should never happen! */ 962 /* Fail safe check, this should never happen! */
959 if (i >= ABIT_UGURU3_MAX_NO_SENSORS) { 963 if (i >= ABIT_UGURU3_MAX_NO_SENSORS) {
960 printk(KERN_ERR ABIT_UGURU3_NAME 964 pr_err("Fatal error motherboard has more sensors then ABIT_UGURU3_MAX_NO_SENSORS. %s %s\n",
961 ": Fatal error motherboard has more sensors " 965 never_happen, report_this);
962 "then ABIT_UGURU3_MAX_NO_SENSORS. This should "
963 "never happen please report to the abituguru3 "
964 "maintainer (see MAINTAINERS)\n");
965 res = -ENAMETOOLONG; 966 res = -ENAMETOOLONG;
966 goto abituguru3_probe_error; 967 goto abituguru3_probe_error;
967 } 968 }
@@ -983,10 +984,8 @@ static int __devinit abituguru3_probe(struct platform_device *pdev)
983 } 984 }
984 /* Fail safe check, this should never happen! */ 985 /* Fail safe check, this should never happen! */
985 if (sysfs_names_free < 0) { 986 if (sysfs_names_free < 0) {
986 printk(KERN_ERR ABIT_UGURU3_NAME 987 pr_err("Fatal error ran out of space for sysfs attr names. %s %s\n",
987 ": Fatal error ran out of space for sysfs attr names. " 988 never_happen, report_this);
988 "This should never happen please report to the "
989 "abituguru3 maintainer (see MAINTAINERS)\n");
990 res = -ENAMETOOLONG; 989 res = -ENAMETOOLONG;
991 goto abituguru3_probe_error; 990 goto abituguru3_probe_error;
992 } 991 }
@@ -1120,8 +1119,6 @@ static struct platform_driver abituguru3_driver = {
1120 .resume = abituguru3_resume 1119 .resume = abituguru3_resume
1121}; 1120};
1122 1121
1123#ifdef CONFIG_DMI
1124
1125static int __init abituguru3_dmi_detect(void) 1122static int __init abituguru3_dmi_detect(void)
1126{ 1123{
1127 const char *board_vendor, *board_name; 1124 const char *board_vendor, *board_name;
@@ -1160,15 +1157,6 @@ static int __init abituguru3_dmi_detect(void)
1160 return 1; 1157 return 1;
1161} 1158}
1162 1159
1163#else /* !CONFIG_DMI */
1164
1165static inline int abituguru3_dmi_detect(void)
1166{
1167 return 1;
1168}
1169
1170#endif /* CONFIG_DMI */
1171
1172/* FIXME: Manual detection should die eventually; we need to collect stable 1160/* FIXME: Manual detection should die eventually; we need to collect stable
1173 * DMI model names first before we can rely entirely on CONFIG_DMI. 1161 * DMI model names first before we can rely entirely on CONFIG_DMI.
1174 */ 1162 */
@@ -1189,8 +1177,7 @@ static int __init abituguru3_detect(void)
1189 "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val); 1177 "0x%02X\n", (unsigned int)data_val, (unsigned int)cmd_val);
1190 1178
1191 if (force) { 1179 if (force) {
1192 printk(KERN_INFO ABIT_UGURU3_NAME ": Assuming Abit uGuru3 is " 1180 pr_info("Assuming Abit uGuru3 is present because of \"force\" parameter\n");
1193 "present because of \"force\" parameter\n");
1194 return 0; 1181 return 0;
1195 } 1182 }
1196 1183
@@ -1218,12 +1205,8 @@ static int __init abituguru3_init(void)
1218 if (err) 1205 if (err)
1219 return err; 1206 return err;
1220 1207
1221#ifdef CONFIG_DMI 1208 pr_warn("this motherboard was not detected using DMI. "
1222 printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " 1209 "Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n");
1223 "not detected using DMI. Please send the output of "
1224 "\"dmidecode\" to the abituguru3 maintainer "
1225 "(see MAINTAINERS)\n");
1226#endif
1227 } 1210 }
1228 1211
1229 err = platform_driver_register(&abituguru3_driver); 1212 err = platform_driver_register(&abituguru3_driver);
@@ -1233,8 +1216,7 @@ static int __init abituguru3_init(void)
1233 abituguru3_pdev = platform_device_alloc(ABIT_UGURU3_NAME, 1216 abituguru3_pdev = platform_device_alloc(ABIT_UGURU3_NAME,
1234 ABIT_UGURU3_BASE); 1217 ABIT_UGURU3_BASE);
1235 if (!abituguru3_pdev) { 1218 if (!abituguru3_pdev) {
1236 printk(KERN_ERR ABIT_UGURU3_NAME 1219 pr_err("Device allocation failed\n");
1237 ": Device allocation failed\n");
1238 err = -ENOMEM; 1220 err = -ENOMEM;
1239 goto exit_driver_unregister; 1221 goto exit_driver_unregister;
1240 } 1222 }
@@ -1245,15 +1227,13 @@ static int __init abituguru3_init(void)
1245 1227
1246 err = platform_device_add_resources(abituguru3_pdev, &res, 1); 1228 err = platform_device_add_resources(abituguru3_pdev, &res, 1);
1247 if (err) { 1229 if (err) {
1248 printk(KERN_ERR ABIT_UGURU3_NAME 1230 pr_err("Device resource addition failed (%d)\n", err);
1249 ": Device resource addition failed (%d)\n", err);
1250 goto exit_device_put; 1231 goto exit_device_put;
1251 } 1232 }
1252 1233
1253 err = platform_device_add(abituguru3_pdev); 1234 err = platform_device_add(abituguru3_pdev);
1254 if (err) { 1235 if (err) {
1255 printk(KERN_ERR ABIT_UGURU3_NAME 1236 pr_err("Device addition failed (%d)\n", err);
1256 ": Device addition failed (%d)\n", err);
1257 goto exit_device_put; 1237 goto exit_device_put;
1258 } 1238 }
1259 1239
@@ -1273,7 +1253,7 @@ static void __exit abituguru3_exit(void)
1273 platform_driver_unregister(&abituguru3_driver); 1253 platform_driver_unregister(&abituguru3_driver);
1274} 1254}
1275 1255
1276MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 1256MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
1277MODULE_DESCRIPTION("Abit uGuru3 Sensor device"); 1257MODULE_DESCRIPTION("Abit uGuru3 Sensor device");
1278MODULE_LICENSE("GPL"); 1258MODULE_LICENSE("GPL");
1279 1259