summaryrefslogtreecommitdiff
blob: 8b6f6c442a823e479db4ace9af1ff5a89fcc0a2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Remove debugging messages.

From: Nicolas Boichat <nicolas@boichat.ch>


---

 drivers/hwmon/applesmc.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)


diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 3b09cdb..25204b4 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -133,7 +133,8 @@ struct dmi_match_data {
 	int temperature_set;
 };
 
-static const int debug;
+static int debug = 0;
+module_param(debug, int, S_IRUGO|S_IWUSR);
 static struct platform_device *pdev;
 static s16 rest_x;
 static s16 rest_y;
@@ -172,7 +173,7 @@ static int __wait_status(u8 val)
 
 	for (i = 0; i < 200; i++) {
 		if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == val) {
-			if (debug)
+			if (debug >= 9)
 				printk(KERN_DEBUG
 						"Waited %d us for status %x\n",
 						i*10, val);
@@ -181,7 +182,8 @@ static int __wait_status(u8 val)
 		udelay(10);
 	}
 
-	printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
+	if (debug >= 1)
+		printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
 						val, inb(APPLESMC_CMD_PORT));
 
 	return -EIO;
@@ -219,11 +221,11 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
 				goto wait_fail;
 			}
 		}
-		if (debug)
+		if (debug >= 9)
 			printk(KERN_DEBUG "<%s", key);
 
 		outb(len, APPLESMC_DATA_PORT);
-		if (debug)
+		if (debug >= 9)
 			printk(KERN_DEBUG ">%x", len);
 
 		for (i = 0; i < len; i++) {
@@ -232,22 +234,16 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
 				goto wait_fail;
 			}
 			buffer[i] = inb(APPLESMC_DATA_PORT);
-			if (debug)
+			if (debug >= 9)
 				printk(KERN_DEBUG "<%x", buffer[i]);
 		}
-		if (debug)
+		if (debug >= 9)
 			printk(KERN_DEBUG "\n");
 
 		break;
 
 wait_fail:
 		msleep(ACCESS_WAIT_MSECS);
-		continue;		
-	}
-
-	if (total != ACCESS_TIMEOUT_MSECS) {
-		printk(KERN_DEBUG "Read: Waited %d ms for the value\n",
-						ACCESS_TIMEOUT_MSECS-total);
 	}
 
 	return ret;
@@ -399,7 +395,7 @@ static int applesmc_device_init(void)
 	mutex_lock(&applesmc_lock);
 
 	for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
-		if (debug)
+		if (debug >= 9)
 			printk(KERN_DEBUG "applesmc try %d\n", total);
 		if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
 				(buffer[0] != 0x00 || buffer[1] != 0x00)) {