[Prism54-devel] WPA Supplicant support for Prism54 driver

Jens Maurer Jens.Maurer@gmx.net
Tue, 13 Jan 2004 10:44:32 +0100


Aurelien wrote:
> I took a quick look at this code and I saw some strange things with locking...
> eg :
> 	spin_lock_irqsave(&priv->slock, flags);		spin_unlock_irqrestore(&priv->slock, flags);
> 
> I didn't investigate further but I don't think all this runs in interrupt context. And this lock is not meant to do this.

First of all, you are right that this does not run in interrupt context.
Second, spin_lock_irqsave() is the correct lock to use (in principle):
It disables interrupts on the local CPU and locks a spinlock.
If everybody does this when accessing the data, you're now the only
one that can possibly access the data.

That said, the priv->slock is meant for serialization of access to
device registers, not for protection of a simple driver datastructure.
It would be better to have a fresh semaphore for that.

Jens Maurer