[RFC AR6000 patch V2] Set hardware unavailable during wext_ioctl when the suspend or rfkill is send

Michael Trimarchi trimarchi at gandalf.sssup.it
Tue Mar 31 08:47:04 CEST 2009


Hi,

Werner Almesberger wrote:
> Michael Trimarchi wrote:
>   
>> ->ioctl_start ..... by a process, your lock is not acquire
>> <--- in the middle you acquire the hardware lock and don't made the hw_unvalaible
>> ---> release the lock at the end
>> -> call ioctl_wext crash 
>>     
>
>   
> What I mean is something like this:
>
> 	ar6000_avail_ev()
> 	{
> 		up_write(&sem);
> 	}
>
> 	ar6000_unavail_ev()
> 	{
> 		down_write(&sem);
> 	}
>
> 	ar6000_do_ioctl()
> 	{
> 		...
> 	}
>
> 	ar6000_ioctl()
> 	{
> 		if (!down_read_trylock(&sem))
> 			return -EIO;
> 		ar6000_do_ioctl();
> 		up_read(&sem);
> 	}
>
> If the unavailability event arrives while we're still in the ioctl,
> the down_write just blocks until the ioctl ends and releases the
> read lock.
>
> - Werner
>
>   
Ok, it's the same with one lock. Sorry, for the delay, seems to be a 
better solution.

Michael




More information about the openmoko-kernel mailing list