All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: sadegh abbasi <sadegh612000@yahoo.co.uk>
Subject: Re: [PATCH 4/7] v4l2-ctrls: Export the standard control type operations
Date: Thu, 22 Jan 2015 16:13:20 +0100	[thread overview]
Message-ID: <54C11390.9070803@xs4all.nl> (raw)
In-Reply-To: <1421938126-17747-5-git-send-email-laurent.pinchart@ideasonboard.com>

On 01/22/15 15:48, Laurent Pinchart wrote:
> Drivers that implement custom control types need to implement the equal,
> init, log and validate operations. Depending on the control type some of
> those operations can use the standard control type implementation
> provided by the v4l2 control framework. Export them to enable their
> reuse.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 27 ++++++++++++++++-----------
>  include/media/v4l2-ctrls.h           |  9 +++++++++
>  2 files changed, 25 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index ba996de..17f10d4 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1233,9 +1233,9 @@ static void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes)
>  			v4l2_event_queue_fh(sev->fh, &ev);
>  }
>  
> -static bool std_equal(const struct v4l2_ctrl *ctrl, u32 idx,
> -		      union v4l2_ctrl_ptr ptr1,
> -		      union v4l2_ctrl_ptr ptr2)
> +bool v4l2_ctrl_type_std_equal(const struct v4l2_ctrl *ctrl, u32 idx,
> +			      union v4l2_ctrl_ptr ptr1,
> +			      union v4l2_ctrl_ptr ptr2)
>  {
>  	switch (ctrl->type) {
>  	case V4L2_CTRL_TYPE_BUTTON:
> @@ -1262,6 +1262,7 @@ static bool std_equal(const struct v4l2_ctrl *ctrl, u32 idx,
>  		return !memcmp(ptr1.p + idx, ptr2.p + idx, ctrl->elem_size);
>  	}
>  }
> +EXPORT_SYMBOL_GPL(v4l2_ctrl_type_std_equal);
>  
>  static void std_init_one(const struct v4l2_ctrl *ctrl, u32 idx,
>  			 union v4l2_ctrl_ptr ptr)
> @@ -1301,7 +1302,8 @@ static void std_init_one(const struct v4l2_ctrl *ctrl, u32 idx,
>  	}
>  }
>  
> -static void std_init(const struct v4l2_ctrl *ctrl, union v4l2_ctrl_ptr ptr)
> +void v4l2_ctrl_type_std_init(const struct v4l2_ctrl *ctrl,
> +			     union v4l2_ctrl_ptr ptr)
>  {
>  	u32 idx;
>  
> @@ -1329,8 +1331,9 @@ static void std_init(const struct v4l2_ctrl *ctrl, union v4l2_ctrl_ptr ptr)
>  		break;
>  	}
>  }
> +EXPORT_SYMBOL_GPL(v4l2_ctrl_type_std_init);
>  
> -static void std_log(const struct v4l2_ctrl *ctrl)
> +void v4l2_ctrl_type_std_log(const struct v4l2_ctrl *ctrl)
>  {
>  	union v4l2_ctrl_ptr ptr = ctrl->p_cur;
>  
> @@ -1387,6 +1390,7 @@ static void std_log(const struct v4l2_ctrl *ctrl)
>  		break;
>  	}
>  }
> +EXPORT_SYMBOL_GPL(v4l2_ctrl_type_std_log);
>  
>  /*
>   * Round towards the closest legal value. Be careful when we are
> @@ -1410,8 +1414,8 @@ static void std_log(const struct v4l2_ctrl *ctrl)
>  })
>  
>  /* Validate a new control */
> -static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
> -			union v4l2_ctrl_ptr ptr)
> +int v4l2_ctrl_type_std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
> +				union v4l2_ctrl_ptr ptr)
>  {
>  	size_t len;
>  	u64 offset;
> @@ -1485,12 +1489,13 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
>  		return -EINVAL;
>  	}
>  }
> +EXPORT_SYMBOL_GPL(v4l2_ctrl_type_std_validate);
>  
>  static const struct v4l2_ctrl_type_ops std_type_ops = {
> -	.equal = std_equal,
> -	.init = std_init,
> -	.log = std_log,
> -	.validate = std_validate,
> +	.equal = v4l2_ctrl_type_std_equal,
> +	.init = v4l2_ctrl_type_std_init,
> +	.log = v4l2_ctrl_type_std_log,
> +	.validate = v4l2_ctrl_type_std_validate,
>  };
>  
>  /* Helper function: copy the given control value back to the caller */
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index a7280e9..71067fb 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -93,6 +93,15 @@ struct v4l2_ctrl_type_ops {
>  			union v4l2_ctrl_ptr ptr);
>  };
>  
> +bool v4l2_ctrl_type_std_equal(const struct v4l2_ctrl *ctrl, u32 idx,
> +			      union v4l2_ctrl_ptr ptr1,
> +			      union v4l2_ctrl_ptr ptr2);
> +void v4l2_ctrl_type_std_init(const struct v4l2_ctrl *ctrl,
> +			     union v4l2_ctrl_ptr ptr);
> +void v4l2_ctrl_type_std_log(const struct v4l2_ctrl *ctrl);
> +int v4l2_ctrl_type_std_validate(const struct v4l2_ctrl *ctrl, u32 idx,
> +				union v4l2_ctrl_ptr ptr);
> +
>  typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
>  
>  /** struct v4l2_ctrl - The control structure.
> 


  reply	other threads:[~2015-01-22 15:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 14:48 [PATCH 0/7] omap4iss: Add RGB2RGB blending matrix support Laurent Pinchart
2015-01-22 14:48 ` [PATCH 1/7] v4l2-ctrls: Add new S8, S16 and S32 compound control types Laurent Pinchart
2015-01-22 15:07   ` Hans Verkuil
2015-01-22 14:48 ` [PATCH 2/7] v4l2-ctrls: Don't initialize array tail when setting a control Laurent Pinchart
2015-01-22 15:07   ` Hans Verkuil
2015-01-22 14:48 ` [PATCH 3/7] v4l2-ctrls: Make the control type init op initialize the whole control Laurent Pinchart
2015-01-22 15:12   ` Hans Verkuil
2015-01-22 16:13     ` Laurent Pinchart
2015-01-22 14:48 ` [PATCH 4/7] v4l2-ctrls: Export the standard control type operations Laurent Pinchart
2015-01-22 15:13   ` Hans Verkuil [this message]
2015-01-22 14:48 ` [PATCH 5/7] Revert "[media] v4l: omap4iss: Add module debug parameter" Laurent Pinchart
2015-01-22 15:14   ` Hans Verkuil
2015-01-22 14:48 ` [PATCH 6/7] staging: media: omap4iss: Cleanup media entities after unregistration Laurent Pinchart
2015-01-22 14:48 ` [PATCH 7/7] staging: media: omap4iss: ipipe: Expose the RGB2RGB blending matrix Laurent Pinchart

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=54C11390.9070803@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sadegh612000@yahoo.co.uk \
    /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.