lkml.org 
[lkml]   [1999]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: down_interruptible and timers

On Sat, 23 Jan 1999, Tim Waugh wrote:

> Here's a code snippet from a module I'm compiling against the 2.2.0-pre9
> source:

> false_alarm:
> timer.expires = jiffies + HZ;
> timer.data = (unsigned long) port;
> timer.function = (timer_fn) parport_ieee1284_wakeup;
> add_timer (&timer);

> printk (KERN_DEBUG "No signal pending\n");
> if (!time_before (jiffies, expire)) {
> /* Timed out. */
> printk (KERN_DEBUG "Timed out\n");
> break;
> }
>
> ecrval = inb (ecr);
> if (!(ecrval & (1<<2)))
> goto false_alarm;
> continue;
> }

i think here is your problem. You've returned from down_interruptible
without having a signal, this means you _got_ the semaphore. In this case
you should not do the 'goto false_alarm' because you will down() forever.

also, you say the timer wakes you up, but only if everything is OK. You
should rather have a timer for the case that the hardware doesnt respond,
this will then up() your process, and the process might retry 5 times if
the hardware is not yet OK.

-- mingo


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [from the cache]
©2003-2011 Jasper Spaans