From 346385ae70ac2cfc149a7f958a4a864c43d103e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20B=C3=A9rard?= Date: Sat, 9 Sep 2006 21:18:24 +0000 Subject: [PATCH] * Add a timout when we loop trying to switch off the fan --- fan.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fan.c b/fan.c index 5989eb6..aa66e04 100644 --- a/fan.c +++ b/fan.c @@ -55,7 +55,7 @@ static int omnibook_fan_on(struct omnibook_operation *io_op) static int omnibook_fan_off(struct omnibook_operation *io_op) { - int retval = 0; + int i,retval = 0; /* * Special handling for XE3GF & TSP10 @@ -75,15 +75,19 @@ static int omnibook_fan_off(struct omnibook_operation *io_op) return retval; /* - * FIXME: should add a timeout + * Wait for no longer than 250ms, this is arbitrary */ - do { + for(i=0; i < 250; i++) { fot_io_op.backend->byte_write(&fot_io_op, temp); mdelay(1); - } while (omnibook_get_fan(io_op) != 0); - + if( omnibook_get_fan(io_op) == 0) { + retval = fot_io_op.backend->byte_write(&fot_io_op, fot); + return retval; + } + } fot_io_op.backend->byte_write(&fot_io_op, fot); - + printk(O_ERR "Attempt to switch off the fan failed.\n"); + return -EIO; } else retval = omnibook_apply_write_mask(io_op, 0); -- 2.43.5