From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
dacohen@gmail.com, snjw23@gmail.com,
andriy.shevchenko@linux.intel.com, t.stanislaws@samsung.com,
tuukkat76@gmail.com, k.debski@samsung.com, riverful@gmail.com,
hverkuil@xs4all.nl, teturtia@gmail.com,
pradeep.sawlani@gmail.com
Subject: Re: [PATCH v5 18/35] v4l: Allow changing control handler lock
Date: Mon, 14 May 2012 17:27:20 +0200 [thread overview]
Message-ID: <4FB12458.80809@samsung.com> (raw)
In-Reply-To: <1331051596-8261-18-git-send-email-sakari.ailus@iki.fi>
Hi Sakari,
On 03/06/2012 05:32 PM, Sakari Ailus wrote:
> Allow choosing the lock used by the control handler. This may be handy
> sometimes when a driver providing multiple subdevs does not want to use
> several locks to serialise its functions.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
> drivers/media/video/adp1653.c | 8 +++---
> drivers/media/video/v4l2-ctrls.c | 39 +++++++++++++++++++------------------
> drivers/media/video/vivi.c | 4 +-
> include/media/v4l2-ctrls.h | 9 +++++--
> 4 files changed, 32 insertions(+), 28 deletions(-)
...
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index 533315b..71abac0 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -168,7 +168,9 @@ struct v4l2_ctrl_ref {
> /** struct v4l2_ctrl_handler - The control handler keeps track of all the
> * controls: both the controls owned by the handler and those inherited
> * from other handlers.
> + * @_lock: Default for "lock".
> * @lock: Lock to control access to this handler and its controls.
> + * May be replaced by the user right after init.
> * @ctrls: The list of controls owned by this handler.
> * @ctrl_refs: The list of control references.
> * @cached: The last found control reference. It is common that the same
> @@ -179,7 +181,8 @@ struct v4l2_ctrl_ref {
> * @error: The error code of the first failed control addition.
> */
> struct v4l2_ctrl_handler {
> - struct mutex lock;
> + struct mutex _lock;
> + struct mutex *lock;
I think we have an issue here. All drivers that reference ctrl_handler.lock
directly need to be updated, since the 'lock' member of struct v4l2_ctrl_handler
is no a pointer. So insted
mutex_lock(&ctrl_handler.lock);
they should now do
mutex_lock(ctrl_handler.lock);
Or am I missing something ?
For example, I'm getting following error:
drivers/media/video/s5p-fimc/fimc-core.c: In function ‘fimc_ctrls_activate’:
drivers/media/video/s5p-fimc/fimc-core.c:678: warning: passing argument 1 of ‘mutex_lock’ from incompatible pointer type
include/linux/mutex.h:152: note: expected ‘struct mutex *’ but argument is of type ‘struct mutex **’
drivers/media/video/s5p-fimc/fimc-core.c:697: warning: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type
include/linux/mutex.h:169: note: expected ‘struct mutex *’ but argument is of type ‘struct mutex **’
AFAICT only vivi and s5p-fimc drivers use the control handler lock
directly, so I can prepare a patch updating those drivers.
> struct list_head ctrls;
> struct list_head ctrl_refs;
> struct v4l2_ctrl_ref *cached;
> @@ -456,7 +459,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
> */
> static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
> {
> - mutex_lock(&ctrl->handler->lock);
> + mutex_lock(ctrl->handler->lock);
> }
>
> /** v4l2_ctrl_lock() - Helper function to unlock the handler
> @@ -465,7 +468,7 @@ static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
> */
> static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
> {
> - mutex_unlock(&ctrl->handler->lock);
> + mutex_unlock(ctrl->handler->lock);
> }
>
> /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
--
Regards,
Sylwester
next prev parent reply other threads:[~2012-05-14 15:27 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 16:32 [PATCH v5 0/35] V4L2 subdev and sensor control changes, SMIA++ driver and N9 camera board code Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 01/35] v4l: Introduce integer menu controls Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 02/35] v4l: Document " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 03/35] vivi: Add an integer menu test control Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 04/35] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 05/35] v4l: vdev_to_v4l2_subdev() should have return type "struct v4l2_subdev *" Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 06/35] v4l: Check pad number in get try pointer functions Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 07/35] v4l: Support s_crop and g_crop through s/g_selection Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 08/35] v4l: Add subdev selections documentation: svg and dia files Sakari Ailus
2012-03-06 16:42 ` Laurent Pinchart
2012-03-06 16:32 ` [PATCH v5 09/35] v4l: Add subdev selections documentation Sakari Ailus
2012-03-06 16:44 ` Laurent Pinchart
2012-03-07 8:53 ` Michael Jones
2012-03-07 18:11 ` Sakari Ailus
2012-03-15 9:55 ` Sylwester Nawrocki
2012-03-15 13:00 ` Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 10/35] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 11/35] v4l: Image source control class Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 12/35] v4l: Image processing " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 13/35] v4l: Document raw bayer 4CC codes Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 14/35] v4l: Add DPCM compressed raw bayer pixel formats Sakari Ailus
2012-03-21 9:37 ` Prabhakar Lad
2012-03-21 9:53 ` Sakari Ailus
2012-03-21 11:44 ` [PATCH v5.5 14/40] " Sakari Ailus
2012-03-21 12:08 ` Prabhakar Lad
2012-03-06 16:32 ` [PATCH v5 15/35] media: Add link_validate() op to check links to the sink pad Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 16/35] v4l: Improve sub-device documentation for pad ops Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 17/35] v4l: Implement v4l2_subdev_link_validate() Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 18/35] v4l: Allow changing control handler lock Sakari Ailus
2012-05-14 15:27 ` Sylwester Nawrocki [this message]
2012-05-14 15:45 ` Sakari Ailus
2012-05-14 16:02 ` Sylwester Nawrocki
2012-05-14 15:48 ` Sylwester Nawrocki
2012-03-06 16:33 ` [PATCH v5 19/35] omap3isp: Support additional in-memory compressed bayer formats Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 20/35] omap3isp: Move definitions required by board code under include/media Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 21/35] omap3: add definition for CONTROL_CAMERA_PHY_CTRL Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 22/35] omap3isp: Move setting constaints above media_entity_pipeline_start Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 23/35] omap3isp: Assume media_entity_pipeline_start may fail Sakari Ailus
2012-03-06 16:45 ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 24/35] omap3isp: Add lane configuration to platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 25/35] omap3isp: Collect entities that are part of the pipeline Sakari Ailus
2012-03-07 10:35 ` Laurent Pinchart
2012-03-07 17:20 ` Sakari Ailus
2012-03-07 17:22 ` [PATCH v5.1 " Sakari Ailus
2012-03-07 23:50 ` Laurent Pinchart
2012-03-09 18:44 ` [PATCH " Sakari Ailus
2012-03-09 20:31 ` [PATCH v5.3 " Sakari Ailus
2012-03-09 20:34 ` Laurent Pinchart
2012-03-08 17:05 ` Sakari Ailus
2012-03-07 10:50 ` [PATCH v5 " Laurent Pinchart
2012-03-07 15:24 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 26/35] omap3isp: Add information on external subdev to struct isp_pipeline Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 27/35] omap3isp: Introduce isp_video_check_external_subdevs() Sakari Ailus
2012-03-07 10:43 ` Laurent Pinchart
2012-03-07 17:49 ` Sakari Ailus
2012-03-07 18:52 ` Laurent Pinchart
2012-03-07 23:57 ` Sakari Ailus
2012-03-08 17:04 ` [PATCH v5.3 " Sakari Ailus
2012-03-08 18:05 ` Laurent Pinchart
2012-03-07 18:14 ` [PATCH v5.1 " Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 28/35] omap3isp: Use external rate instead of vpcfg Sakari Ailus
2012-03-07 10:53 ` Laurent Pinchart
2012-03-07 17:54 ` Sakari Ailus
2012-03-07 18:34 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 29/35] omap3isp: Default link validation for ccp2, csi2, preview and resizer Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 30/35] omap3isp: Move CCDC link validation to ccdc_link_validate() Sakari Ailus
2012-03-07 11:00 ` Laurent Pinchart
2012-03-07 18:02 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 31/35] omap3isp: Configure CSI-2 phy based on platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 32/35] omap3isp: Add resizer data rate configuration to resizer_link_validate Sakari Ailus
2012-03-07 11:01 ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 33/35] omap3isp: Find source pad from external entity Sakari Ailus
2012-03-07 11:04 ` Laurent Pinchart
2012-03-07 18:08 ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 34/35] smiapp: Generic SMIA++/SMIA PLL calculator Sakari Ailus
2012-03-07 12:26 ` Laurent Pinchart
2012-03-08 13:29 ` Sakari Ailus
2012-03-08 13:57 ` [PATCH v5.1 " Sakari Ailus
2012-03-08 14:38 ` Laurent Pinchart
2012-03-08 14:48 ` Sakari Ailus
2012-03-08 14:49 ` [PATCH v5.2 " Sakari Ailus
2012-03-08 14:51 ` Laurent Pinchart
2012-03-08 13:57 ` [PATCH v5.1 35/35] smiapp: Add driver Sakari Ailus
2012-03-08 14:46 ` Laurent Pinchart
2012-03-08 16:49 ` [PATCH v5.3 " Sakari Ailus
2012-03-11 13:37 ` Laurent Pinchart
2012-03-11 14:03 ` Sakari Ailus
2012-03-11 14:45 ` [PATCH v5.4 " Sakari Ailus
2012-03-11 16:32 ` Laurent Pinchart
2012-03-08 15:06 ` [PATCH v5.1 " jean-philippe francois
2012-03-11 9:04 ` Sakari Ailus
2012-03-12 9:44 ` jean-philippe francois
2012-03-06 16:33 ` [PATCH v5 35/35] rm680: Add camera init Sakari Ailus
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=4FB12458.80809@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dacohen@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=k.debski@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=pradeep.sawlani@gmail.com \
--cc=riverful@gmail.com \
--cc=sakari.ailus@iki.fi \
--cc=snjw23@gmail.com \
--cc=t.stanislaws@samsung.com \
--cc=teturtia@gmail.com \
--cc=tuukkat76@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).