Re: [RFC PATCHES] First version of the V4L2 core locking patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, September 21, 2010 19:14:07 Mauro Carvalho Chehab wrote:
> Em Tue, 21 Sep 2010 15:50:13 +0200
> "Hans Verkuil" <hverkuil@xxxxxxxxx> escreveu:
> 
> > Hi Mauro,
> > 
> > > Em 20-09-2010 18:37, Hans Verkuil escreveu:
> ...
> > > 	/*
> > > 	 * Need to sleep in order to wait for videobufs to complete.
> > > 	 * It is not a good idea to sleep while waiting for an event with the dev
> > > lock hold,
> > > 	 * as it will block any other access to the device. Just unlock it while
> > > waiting,
> > > 	 * locking it again at the end.
> > > 	 */
> > >
> > >  	is_vdev_locked = (q->vdev_lock && mutex_is_locked(q->vdev_lock)) ? true
> > > : false;
> > > 	if (is_vdev_locked)
> > > 		mutex_unlock(q->vdev_lock);
> > > 	if (intr)
> > > 		return wait_event_interruptible(vb->done, is_state_active_or_queued(vb,
> > > q));
> > 
> > This obviously needs to save the return value and continue to make sure
> > the lock is taken again.
> 
> Yeah, it should be:
>  rc = wait_event_interruptible(vb->done, is_state_active_or_queued(vb, q));
> 
> and return rc at the end.
>  
> > > 	else
> > > 		wait_event(vb->done, is_state_active_or_queued(vb, q));
> > > 	if (is_vdev_locked)
> > > 		mutex_lock(q->vdev_lock);
> > >
> > > 	return 0;
> > > }
> > 
> > Agreed. Thanks for reviewing this, it was the one patch that I knew I had
> > to look into more closely. I'll incorporate your changes.
> 
> Ok, thanks.

I added a patch with basically this code to my test tree. I will try to convert
and test a few more drivers, but that will probably be Friday. If the conversion
goes well then I plan to post a pull request by Friday or Saturday with somewhat
cleaned up patches.

I strongly suspect that for the 2-3 weeks after that I will not be able to
continue with this, so I hope others will take over from me.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux