* [PATCH] v4l: Don't register media entities for subdev device nodes
@ 2011-04-11 14:26 Laurent Pinchart
2011-04-12 12:35 ` Sakari Ailus
2011-07-04 13:11 ` Michael Jones
0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2011-04-11 14:26 UTC (permalink / raw)
To: linux-media; +Cc: sakari.ailus
Subdevs already have their own entity, don't register as second one when
registering the subdev device node.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/video/v4l2-dev.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 498e674..6dc7196 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file *filp)
video_get(vdev);
mutex_unlock(&videodev_lock);
#if defined(CONFIG_MEDIA_CONTROLLER)
- if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
+ if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
+ vdev->vfl_type != VFL_TYPE_SUBDEV) {
entity = media_entity_get(&vdev->entity);
if (!entity) {
ret = -EBUSY;
@@ -415,7 +416,8 @@ err:
/* decrease the refcount in case of an error */
if (ret) {
#if defined(CONFIG_MEDIA_CONTROLLER)
- if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
+ if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
+ vdev->vfl_type != VFL_TYPE_SUBDEV)
media_entity_put(entity);
#endif
video_put(vdev);
@@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct file *filp)
mutex_unlock(vdev->lock);
}
#if defined(CONFIG_MEDIA_CONTROLLER)
- if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
+ if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
+ vdev->vfl_type != VFL_TYPE_SUBDEV)
media_entity_put(&vdev->entity);
#endif
/* decrease the refcount unconditionally since the release()
@@ -686,7 +689,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
#if defined(CONFIG_MEDIA_CONTROLLER)
/* Part 5: Register the entity. */
- if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
+ if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
+ vdev->vfl_type != VFL_TYPE_SUBDEV) {
vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
vdev->entity.name = vdev->name;
vdev->entity.v4l.major = VIDEO_MAJOR;
@@ -733,7 +737,8 @@ void video_unregister_device(struct video_device *vdev)
return;
#if defined(CONFIG_MEDIA_CONTROLLER)
- if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
+ if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
+ vdev->vfl_type != VFL_TYPE_SUBDEV)
media_device_unregister_entity(&vdev->entity);
#endif
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] v4l: Don't register media entities for subdev device nodes
2011-04-11 14:26 [PATCH] v4l: Don't register media entities for subdev device nodes Laurent Pinchart
@ 2011-04-12 12:35 ` Sakari Ailus
2011-07-04 13:11 ` Michael Jones
1 sibling, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2011-04-12 12:35 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
Laurent Pinchart wrote:
> Subdevs already have their own entity, don't register as second one when
> registering the subdev device node.
Thanks for the patch!
Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/video/v4l2-dev.c | 15 ++++++++++-----
> 1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index 498e674..6dc7196 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file *filp)
> video_get(vdev);
> mutex_unlock(&videodev_lock);
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> entity = media_entity_get(&vdev->entity);
> if (!entity) {
> ret = -EBUSY;
> @@ -415,7 +416,8 @@ err:
> /* decrease the refcount in case of an error */
> if (ret) {
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_entity_put(entity);
> #endif
> video_put(vdev);
> @@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct file *filp)
> mutex_unlock(vdev->lock);
> }
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_entity_put(&vdev->entity);
> #endif
> /* decrease the refcount unconditionally since the release()
> @@ -686,7 +689,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
>
> #if defined(CONFIG_MEDIA_CONTROLLER)
> /* Part 5: Register the entity. */
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
> vdev->entity.name = vdev->name;
> vdev->entity.v4l.major = VIDEO_MAJOR;
> @@ -733,7 +737,8 @@ void video_unregister_device(struct video_device *vdev)
> return;
>
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_device_unregister_entity(&vdev->entity);
> #endif
>
--
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] v4l: Don't register media entities for subdev device nodes
2011-04-11 14:26 [PATCH] v4l: Don't register media entities for subdev device nodes Laurent Pinchart
2011-04-12 12:35 ` Sakari Ailus
@ 2011-07-04 13:11 ` Michael Jones
2011-07-04 13:21 ` Laurent Pinchart
1 sibling, 1 reply; 4+ messages in thread
From: Michael Jones @ 2011-07-04 13:11 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, sakari.ailus
On 04/11/2011 04:26 PM, Laurent Pinchart wrote:
> Subdevs already have their own entity, don't register as second one when
> registering the subdev device node.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/video/v4l2-dev.c | 15 ++++++++++-----
> 1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index 498e674..6dc7196 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file *filp)
> video_get(vdev);
> mutex_unlock(&videodev_lock);
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> entity = media_entity_get(&vdev->entity);
> if (!entity) {
> ret = -EBUSY;
> @@ -415,7 +416,8 @@ err:
> /* decrease the refcount in case of an error */
> if (ret) {
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_entity_put(entity);
> #endif
> video_put(vdev);
> @@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct file *filp)
> mutex_unlock(vdev->lock);
> }
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_entity_put(&vdev->entity);
> #endif
> /* decrease the refcount unconditionally since the release()
> @@ -686,7 +689,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr,
>
> #if defined(CONFIG_MEDIA_CONTROLLER)
> /* Part 5: Register the entity. */
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
> vdev->entity.name = vdev->name;
> vdev->entity.v4l.major = VIDEO_MAJOR;
> @@ -733,7 +737,8 @@ void video_unregister_device(struct video_device *vdev)
> return;
>
> #if defined(CONFIG_MEDIA_CONTROLLER)
> - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> + vdev->vfl_type != VFL_TYPE_SUBDEV)
> media_device_unregister_entity(&vdev->entity);
> #endif
>
Hi Laurent,
If v4l2_subdev has a 'struct media_entity' inside of its 'struct
video_device' member, why does it need a media_entity of its own?
Shouldn't we eliminate v4l2_subdev.entity and always just use
v4l2_subdev.devnode.entity where it is needed? Or do they have 2
different purposes?
-Michael
MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] v4l: Don't register media entities for subdev device nodes
2011-07-04 13:11 ` Michael Jones
@ 2011-07-04 13:21 ` Laurent Pinchart
0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2011-07-04 13:21 UTC (permalink / raw)
To: Michael Jones; +Cc: linux-media, sakari.ailus
Hi Michael,
On Monday 04 July 2011 15:11:21 Michael Jones wrote:
> On 04/11/2011 04:26 PM, Laurent Pinchart wrote:
> > Subdevs already have their own entity, don't register as second one when
> > registering the subdev device node.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >
> > drivers/media/video/v4l2-dev.c | 15 ++++++++++-----
> > 1 files changed, 10 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/media/video/v4l2-dev.c
> > b/drivers/media/video/v4l2-dev.c index 498e674..6dc7196 100644
> > --- a/drivers/media/video/v4l2-dev.c
> > +++ b/drivers/media/video/v4l2-dev.c
> > @@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file
> > *filp)
> >
> > video_get(vdev);
> > mutex_unlock(&videodev_lock);
> >
> > #if defined(CONFIG_MEDIA_CONTROLLER)
> >
> > - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> > + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> > + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> >
> > entity = media_entity_get(&vdev->entity);
> > if (!entity) {
> >
> > ret = -EBUSY;
> >
> > @@ -415,7 +416,8 @@ err:
> > /* decrease the refcount in case of an error */
> > if (ret) {
> >
> > #if defined(CONFIG_MEDIA_CONTROLLER)
> >
> > - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> > + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> > + vdev->vfl_type != VFL_TYPE_SUBDEV)
> >
> > media_entity_put(entity);
> >
> > #endif
> >
> > video_put(vdev);
> >
> > @@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct
> > file *filp)
> >
> > mutex_unlock(vdev->lock);
> >
> > }
> >
> > #if defined(CONFIG_MEDIA_CONTROLLER)
> >
> > - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> > + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> > + vdev->vfl_type != VFL_TYPE_SUBDEV)
> >
> > media_entity_put(&vdev->entity);
> >
> > #endif
> >
> > /* decrease the refcount unconditionally since the release()
> >
> > @@ -686,7 +689,8 @@ int __video_register_device(struct video_device
> > *vdev, int type, int nr,
> >
> > #if defined(CONFIG_MEDIA_CONTROLLER)
> >
> > /* Part 5: Register the entity. */
> >
> > - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) {
> > + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> > + vdev->vfl_type != VFL_TYPE_SUBDEV) {
> >
> > vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
> > vdev->entity.name = vdev->name;
> > vdev->entity.v4l.major = VIDEO_MAJOR;
> >
> > @@ -733,7 +737,8 @@ void video_unregister_device(struct video_device
> > *vdev)
> >
> > return;
> >
> > #if defined(CONFIG_MEDIA_CONTROLLER)
> >
> > - if (vdev->v4l2_dev && vdev->v4l2_dev->mdev)
> > + if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
> > + vdev->vfl_type != VFL_TYPE_SUBDEV)
> >
> > media_device_unregister_entity(&vdev->entity);
> >
> > #endif
>
> Hi Laurent,
>
> If v4l2_subdev has a 'struct media_entity' inside of its 'struct
> video_device' member, why does it need a media_entity of its own?
> Shouldn't we eliminate v4l2_subdev.entity and always just use
> v4l2_subdev.devnode.entity where it is needed? Or do they have 2
> different purposes?
Not all subdevs have a devnode. struct video_device is embedded in struct
v4l2_subdev, but it's not used for devnode-less subdevs.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-04 13:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-11 14:26 [PATCH] v4l: Don't register media entities for subdev device nodes Laurent Pinchart
2011-04-12 12:35 ` Sakari Ailus
2011-07-04 13:11 ` Michael Jones
2011-07-04 13:21 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox