All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, isely@isely.net,
	pali.rohar@gmail.com, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 3/5] uvc gadget: switch to unlocked_ioctl.
Date: Mon, 16 Feb 2015 16:11:55 +0100	[thread overview]
Message-ID: <54E208BB.9010804@xs4all.nl> (raw)
In-Reply-To: <3185495.drmK3h6s8j@avalon>

On 02/03/2015 02:55 PM, Laurent Pinchart wrote:
> Hi Hans,
> 
> Thank you for the patch.
> 
> On Tuesday 03 February 2015 13:47:24 Hans Verkuil wrote:
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> Instead of .ioctl use unlocked_ioctl. While all the queue ops
>> already use a lock, there was no lock to protect uvc_video, so
>> add that one.
> 
> There's more. streamon and streamoff need to be protected by a lock for 
> instance. Wouldn't it be easier to just set vdev->lock for this driver instead 
> of adding manual locking ?

I could set vdev->lock to &video->mutex and remove the queue->mutex
altogether since video->mutex will now be used for all locking. I only
need to take the video->mutex in uvc_v4l2_release() as well.

If you agree with that, then I'll make that change.

> 
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> ---
>>  drivers/usb/gadget/function/f_uvc.c    | 1 +
>>  drivers/usb/gadget/function/uvc.h      | 1 +
>>  drivers/usb/gadget/function/uvc_v4l2.c | 6 +++++-
>>  3 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_uvc.c
>> b/drivers/usb/gadget/function/f_uvc.c index 945b3bd..748a80c 100644
>> --- a/drivers/usb/gadget/function/f_uvc.c
>> +++ b/drivers/usb/gadget/function/f_uvc.c
>> @@ -817,6 +817,7 @@ static struct usb_function *uvc_alloc(struct
>> usb_function_instance *fi) if (uvc == NULL)
>>  		return ERR_PTR(-ENOMEM);
>>
>> +	mutex_init(&uvc->video.mutex);
> 
> We need a corresponding mutex_destroy() somewhere.

Why? Few drivers do so. If you want it, then I'll do that, but it's not
required to my knowledge.

Regards,

	Hans

  reply	other threads:[~2015-02-16 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 12:47 [PATCH 0/5] Remove .ioctl from v4l2_file_operations Hans Verkuil
2015-02-03 12:47 ` [PATCH 1/5] pvrusb2: replace .ioctl by .unlocked_ioctl Hans Verkuil
2015-02-03 12:47 ` [PATCH 2/5] radio-bcm2048: use unlocked_ioctl instead of ioctl Hans Verkuil
2015-02-03 13:01   ` Pali Rohár
2015-02-03 12:47 ` [PATCH 3/5] uvc gadget: switch to unlocked_ioctl Hans Verkuil
2015-02-03 13:55   ` Laurent Pinchart
2015-02-16 15:11     ` Hans Verkuil [this message]
2015-02-16 20:15       ` Laurent Pinchart
2015-02-03 12:47 ` [PATCH 4/5] uvc gadget: set device_caps in querycap Hans Verkuil
2015-02-03 13:44   ` Laurent Pinchart
2015-02-03 12:47 ` [PATCH 5/5] v4l2-core: remove the old .ioctl BKL replacement Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E208BB.9010804@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=isely@isely.net \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.