public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: linux-media@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	hj210.choi@samsung.com, sw0312.kim@samsung.com
Subject: Re: [PATCH RFC v3 2/3] media: added managed v4l2 control initialization
Date: Fri, 17 May 2013 01:34:51 +0300	[thread overview]
Message-ID: <20130516223451.GA2077@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <1368692074-483-3-git-send-email-a.hajda@samsung.com>

Hi Andrzej,

Thanks for the patchset!

On Thu, May 16, 2013 at 10:14:33AM +0200, Andrzej Hajda wrote:
> This patch adds managed version of initialization
> function for v4l2 control handler.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> v3:
> 	- removed managed cleanup
> v2:
> 	- added missing struct device forward declaration,
> 	- corrected few comments
> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c |   32 ++++++++++++++++++++++++++++++++
>  include/media/v4l2-ctrls.h           |   16 ++++++++++++++++
>  2 files changed, 48 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index ebb8e48..f47ccfa 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1421,6 +1421,38 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl)
>  }
>  EXPORT_SYMBOL(v4l2_ctrl_handler_free);
>  
> +static void devm_v4l2_ctrl_handler_release(struct device *dev, void *res)
> +{
> +	struct v4l2_ctrl_handler **hdl = res;
> +
> +	v4l2_ctrl_handler_free(*hdl);

v4l2_ctrl_handler_free() acquires hdl->mutex which is independent of the
existence of hdl. By default hdl->lock is in the handler, but it may also be
elsewhere, e.g. in a driver-specific device struct such as struct
smiapp_sensor defined in drivers/media/i2c/smiapp/smiapp.h. I wonder if
anything guarantees that hdl->mutex still exists at the time the device is
removed.

I have to say I don't think it's neither meaningful to acquire that mutex in
v4l2_ctrl_handler_free(), though, since the whole going to be freed next
anyway: reference counting would be needed to prevent bad things from
happening, in case the drivers wouldn't take care of that.

> +}
> +

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

  reply	other threads:[~2013-05-16 22:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  8:14 [PATCH RFC v3 0/3] added managed media/v4l2 initialization Andrzej Hajda
2013-05-16  8:14 ` [PATCH RFC v3 1/3] media: added managed media entity initialization Andrzej Hajda
2013-06-18 22:03   ` Laurent Pinchart
2013-06-19 10:33     ` Andrzej Hajda
2013-06-19 10:36       ` Laurent Pinchart
2013-06-20  6:11         ` Andrzej Hajda
2013-05-16  8:14 ` [PATCH RFC v3 2/3] media: added managed v4l2 control initialization Andrzej Hajda
2013-05-16 22:34   ` Sakari Ailus [this message]
2013-05-20 14:24     ` Andrzej Hajda
2013-05-31  1:10       ` Sakari Ailus
2013-05-23 10:39     ` Hans Verkuil
2013-05-31  1:08       ` Sakari Ailus
2013-05-31  7:59         ` Hans Verkuil
2013-06-06 21:41           ` Sakari Ailus
2013-06-09 18:05             ` Sylwester Nawrocki
2013-06-10 13:36               ` Hans Verkuil
2013-05-23 10:40   ` Hans Verkuil
2013-06-18 22:04   ` Laurent Pinchart
2013-05-16  8:14 ` [PATCH RFC v3 3/3] media: added managed v4l2/i2c subdevice initialization Andrzej Hajda
2013-05-23 10:40   ` Hans Verkuil
2013-06-18 22:00   ` Laurent Pinchart
2013-06-19 14:10     ` [PATCH RFC v4] " Andrzej Hajda
2013-08-22 11:10       ` Hans Verkuil
2013-08-22 11:20         ` Sylwester Nawrocki

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=20130516223451.GA2077@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=a.hajda@samsung.com \
    --cc=hj210.choi@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sw0312.kim@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox