diff mbox

[RFCv2,API,24/28] v4l2-dev: add new VFL_DIR_ defines.

Message ID e2043c0ca47cc3ed1fd45f62a6bce14e3ed5e2e8.1347023744.git.hans.verkuil@cisco.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil Sept. 7, 2012, 1:29 p.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

These will be used by v4l2-dev.c to improve ioctl checking.
I.e. ioctls for capture should return -ENOTTY when called for
an output device.

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

Comments

Laurent Pinchart Sept. 13, 2012, 2:36 a.m. UTC | #1
Hi Hans,

Thanks for the patch.

On Friday 07 September 2012 15:29:24 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> These will be used by v4l2-dev.c to improve ioctl checking.
> I.e. ioctls for capture should return -ENOTTY when called for
> an output device.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  include/media/v4l2-dev.h |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> index 6ee8897..95d1c91 100644
> --- a/include/media/v4l2-dev.h
> +++ b/include/media/v4l2-dev.h
> @@ -26,6 +26,12 @@
>  #define VFL_TYPE_SUBDEV		3
>  #define VFL_TYPE_MAX		4
> 
> +/* Is this a receiver, transmitter or mem-to-mem? */
> +/* Ignored for VFL_TYPE_SUBDEV. */
> +#define VFL_DIR_RX		0
> +#define VFL_DIR_TX		1
> +#define VFL_DIR_M2M		2
> +

Wouldn't VFL_DIR_CAPTURE and VFL_DIR_OUTPUT sound more familiar ?

>  struct v4l2_ioctl_callbacks;
>  struct video_device;
>  struct v4l2_device;
> @@ -105,7 +111,8 @@ struct video_device
> 
>  	/* device info */
>  	char name[32];
> -	int vfl_type;
> +	int vfl_type;	/* device type */
> +	int vfl_dir;	/* receiver, transmitter or m2m */

Would combining vfl_dir with vfl_type using bitflags be an option ? The 
direction is somehow part of (or closely related to) the type.

>  	/* 'minor' is set to -1 if the registration failed */
>  	int minor;
>  	u16 num;
Hans Verkuil Sept. 13, 2012, 10:54 a.m. UTC | #2
On Thu 13 September 2012 04:36:27 Laurent Pinchart wrote:
> Hi Hans,
> 
> Thanks for the patch.
> 
> On Friday 07 September 2012 15:29:24 Hans Verkuil wrote:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> > 
> > These will be used by v4l2-dev.c to improve ioctl checking.
> > I.e. ioctls for capture should return -ENOTTY when called for
> > an output device.
> > 
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> >  include/media/v4l2-dev.h |    9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> > index 6ee8897..95d1c91 100644
> > --- a/include/media/v4l2-dev.h
> > +++ b/include/media/v4l2-dev.h
> > @@ -26,6 +26,12 @@
> >  #define VFL_TYPE_SUBDEV		3
> >  #define VFL_TYPE_MAX		4
> > 
> > +/* Is this a receiver, transmitter or mem-to-mem? */
> > +/* Ignored for VFL_TYPE_SUBDEV. */
> > +#define VFL_DIR_RX		0
> > +#define VFL_DIR_TX		1
> > +#define VFL_DIR_M2M		2
> > +
> 
> Wouldn't VFL_DIR_CAPTURE and VFL_DIR_OUTPUT sound more familiar ?

That was my first choice as well, but that terminology didn't make
that much sense for a radio device.

> 
> >  struct v4l2_ioctl_callbacks;
> >  struct video_device;
> >  struct v4l2_device;
> > @@ -105,7 +111,8 @@ struct video_device
> > 
> >  	/* device info */
> >  	char name[32];
> > -	int vfl_type;
> > +	int vfl_type;	/* device type */
> > +	int vfl_dir;	/* receiver, transmitter or m2m */
> 
> Would combining vfl_dir with vfl_type using bitflags be an option ? The 
> direction is somehow part of (or closely related to) the type.

They are two different things: the type determines the name of the device
node (video, vbi, radio, v4l-subdev), the dir determines what you can do
with the device node: read, write or both.

It's awkward if you have to mask out things all the time. It might make
sense to change the type from int to short to save some space.

> >  	/* 'minor' is set to -1 if the registration failed */
> >  	int minor;
> >  	u16 num;
> 
> 

Regards,

	Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 6ee8897..95d1c91 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -26,6 +26,12 @@ 
 #define VFL_TYPE_SUBDEV		3
 #define VFL_TYPE_MAX		4
 
+/* Is this a receiver, transmitter or mem-to-mem? */
+/* Ignored for VFL_TYPE_SUBDEV. */
+#define VFL_DIR_RX		0
+#define VFL_DIR_TX		1
+#define VFL_DIR_M2M		2
+
 struct v4l2_ioctl_callbacks;
 struct video_device;
 struct v4l2_device;
@@ -105,7 +111,8 @@  struct video_device
 
 	/* device info */
 	char name[32];
-	int vfl_type;
+	int vfl_type;	/* device type */
+	int vfl_dir;	/* receiver, transmitter or m2m */
 	/* 'minor' is set to -1 if the registration failed */
 	int minor;
 	u16 num;