diff mbox series

[PATCHv17,07/34] v4l2-device.h: add v4l2_device_supports_requests() helper

Message ID 20180804124526.46206-8-hverkuil@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series Request API | expand

Commit Message

Hans Verkuil Aug. 4, 2018, 12:44 p.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

Add a simple helper function that tests if the driver supports
the request API.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 include/media/v4l2-device.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Mauro Carvalho Chehab Aug. 9, 2018, 7:57 p.m. UTC | #1
Em Sat,  4 Aug 2018 14:44:59 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> Add a simple helper function that tests if the driver supports
> the request API.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

> ---
>  include/media/v4l2-device.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
> index b330e4a08a6b..ac7677a183ff 100644
> --- a/include/media/v4l2-device.h
> +++ b/include/media/v4l2-device.h
> @@ -211,6 +211,17 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd,
>  		sd->v4l2_dev->notify(sd, notification, arg);
>  }
>  
> +/**
> + * v4l2_device_supports_requests - Test if requests are supported.
> + *
> + * @v4l2_dev: pointer to struct v4l2_device
> + */
> +static inline bool v4l2_device_supports_requests(struct v4l2_device *v4l2_dev)
> +{
> +	return v4l2_dev->mdev && v4l2_dev->mdev->ops &&
> +	       v4l2_dev->mdev->ops->req_queue;
> +}
> +
>  /* Helper macros to iterate over all subdevs. */
>  
>  /**



Thanks,
Mauro
diff mbox series

Patch

diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index b330e4a08a6b..ac7677a183ff 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -211,6 +211,17 @@  static inline void v4l2_subdev_notify(struct v4l2_subdev *sd,
 		sd->v4l2_dev->notify(sd, notification, arg);
 }
 
+/**
+ * v4l2_device_supports_requests - Test if requests are supported.
+ *
+ * @v4l2_dev: pointer to struct v4l2_device
+ */
+static inline bool v4l2_device_supports_requests(struct v4l2_device *v4l2_dev)
+{
+	return v4l2_dev->mdev && v4l2_dev->mdev->ops &&
+	       v4l2_dev->mdev->ops->req_queue;
+}
+
 /* Helper macros to iterate over all subdevs. */
 
 /**