Re: I made a patch and would like feedback/testers (drivers/cdrom/aztcd.c)

From: Nish Aravamudan
Date: Sun Nov 20 2005 - 16:04:09 EST


On 11/20/05, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> > static void op_ok(void)
> > {
> > - aztTimeOutCount = 0;
> > + aztTimeOut = jiffies + 2;
> > do {
> > aztIndatum = inb(DATA_PORT);
> > - aztTimeOutCount++;
> > - if (aztTimeOutCount >= AZT_TIMEOUT) {
> > + if (time_after(jiffies, aztTimeOut)) {
> > printk("aztcd: Error Wait OP_OK\n");
> > break;
> > }
> > + schedule_timeout_interruptible(1);
>
> this I think is not quite right; schedule_timeout_*() doesn't do
> anything unless you set current->state to something. And at that point
> you might as well start using msleep()!

Not true, as Thomas points out. You are right for schedule_timeout(),
but that's why we introduced the _interruptible() and
_uninterruptible(). And there are reasons to use schedule_timeout_*()
instead of msleep() [not necessarily in this case, but in general],
specifically the presence of wait-queues.

> but what you're doing is generally a good idea; busy waits as the
> original code did is quite wrong...

I agree, and I recommend Daniel post to LKML to get some testing / see
if anyone actually uses this driver :)

Thanks,
Nish
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/