Re: [PATCH] spin[un]locks revision on new cmpci driver (5.64)

Alan Cox (alan@lxorguk.ukuu.org.uk)
Sat, 26 May 2001 01:16:29 +0100 (BST)


> The following patch fixes SMP hangs w/ cmpci v5.64 ( k244-ac17 ).

Let me suggest a different approach

> - - spin_lock_irqsave(&s->lock, flags);
> set_spdifout(s, rate);
> + spin_lock_irqsave(&s->lock, flags);

Split the various locked versions stuff stuff like set_adc_rate out as
__set_adc_rate which doesnt take the lock, and set_adc_rate which takes the
lock and calls the other one.

That is how several other drivers were done and avoids messy lock/unlocks
some of which in your changes I think introduce races

Ditto for enable_dac as the old code and a newer __enable_dac, as well
I suspect as __set_spdifout (although is that ever called by anyone not
holding the lock ???)

> init_timer(&s->midi.timer);
> s->midi.timer.expires =3D jiffies+1;
> s->midi.timer.data =3D (unsigned long)s;
> +
> + spin_unlock_irqrestore(&s->lock, flags);
> s->midi.timer.function =3D cm_midi_timer;
> + spin_lock_irqsave(&s->lock, flags);
> +

That one doesnt seem to be needed

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