[PATCH] therm_adt746x: Quiet fan speed change messages

Only output the messages about fan speed changes with a verbose=1 module
param.

Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Ben Collins 2006-01-06 00:11:40 -08:00 committed by Linus Torvalds
parent 683e2cc6dc
commit 9f6d4b0c21

View file

@ -52,6 +52,7 @@ static char *sensor_location[3] = {NULL, NULL, NULL};
static int limit_adjust = 0; static int limit_adjust = 0;
static int fan_speed = -1; static int fan_speed = -1;
static int verbose = 0;
MODULE_AUTHOR("Colin Leroy <colin@colino.net>"); MODULE_AUTHOR("Colin Leroy <colin@colino.net>");
MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and " MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and "
@ -66,6 +67,10 @@ module_param(fan_speed, int, 0644);
MODULE_PARM_DESC(fan_speed,"Specify starting fan speed (0-255) " MODULE_PARM_DESC(fan_speed,"Specify starting fan speed (0-255) "
"(default 64)"); "(default 64)");
module_param(verbose, bool, 0);
MODULE_PARM_DESC(verbose,"Verbose log operations "
"(default 0)");
struct thermostat { struct thermostat {
struct i2c_client clt; struct i2c_client clt;
u8 temps[3]; u8 temps[3];
@ -212,12 +217,14 @@ static void write_fan_speed(struct thermostat *th, int speed, int fan)
return; return;
if (th->last_speed[fan] != speed) { if (th->last_speed[fan] != speed) {
if (verbose) {
if (speed == -1) if (speed == -1)
printk(KERN_DEBUG "adt746x: Setting speed to automatic " printk(KERN_DEBUG "adt746x: Setting speed to automatic "
"for %s fan.\n", sensor_location[fan+1]); "for %s fan.\n", sensor_location[fan+1]);
else else
printk(KERN_DEBUG "adt746x: Setting speed to %d " printk(KERN_DEBUG "adt746x: Setting speed to %d "
"for %s fan.\n", speed, sensor_location[fan+1]); "for %s fan.\n", speed, sensor_location[fan+1]);
}
} else } else
return; return;
@ -298,7 +305,8 @@ static void update_fans_speed (struct thermostat *th)
if (new_speed > 255) if (new_speed > 255)
new_speed = 255; new_speed = 255;
printk(KERN_DEBUG "adt746x: setting fans speed to %d " if (verbose)
printk(KERN_DEBUG "adt746x: Setting fans speed to %d "
"(limit exceeded by %d on %s) \n", "(limit exceeded by %d on %s) \n",
new_speed, var, new_speed, var,
sensor_location[fan_number+1]); sensor_location[fan_number+1]);
@ -309,6 +317,7 @@ static void update_fans_speed (struct thermostat *th)
* so cold (lastvar >= -1) */ * so cold (lastvar >= -1) */
if (i == 2 && lastvar < -1) { if (i == 2 && lastvar < -1) {
if (th->last_speed[fan_number] != 0) if (th->last_speed[fan_number] != 0)
if (verbose)
printk(KERN_DEBUG "adt746x: Stopping " printk(KERN_DEBUG "adt746x: Stopping "
"fans.\n"); "fans.\n");
write_both_fan_speed(th, 0); write_both_fan_speed(th, 0);