Re: PROBLEM: PCI trouble : can not mount /dev/cdrom

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Sun, 28 Feb 1999 14:28:45 +0100 (CET)


On Sun, 28 Feb 1999, Andrea Arcangeli wrote:

> >debug. But sometimes it's legal to add a timer with not all fields
> >initialized.
>
> When?

the content of t->prev does not matter to the outcome of add_timer().
_usually_ a nonzero t->prev means an already active timer has been added,
but sometimes it's not. So we should just assume everything was done OK,
but we will print a debugging message. (so we catch the case when the
timer is really already added). We could also check wether the timer has
already been added (it's simple), but i think we want all kernel code to
use init_timer() to initialize timers, this way we can assure correctness
when in the future we change the timer abstraction.

(one example of a 'correct' add_timer() is in scsi_error.c, the attached
patch from Alan Cox fixes the debugging message)

-- mingo

--- scsi_error.c~ Fri Feb 19 00:00:42 1999
+++ scsi_error.c Sun Feb 21 17:03:08 1999
@@ -563,6 +563,7 @@
struct semaphore sem = MUTEX_LOCKED;
struct timer_list timer;

+ init_timer(&timer);
timer.data = (unsigned long) &sem;
timer.expires = jiffies + timeout;
timer.function = (void (*)(unsigned long))scsi_sleep_done;

-
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/