Re: [PATCH] V4L: add convenience macros to the subdevice / Media Controller API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 29 Sep 2011, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> Thanks for the patch.
> 
> On Thursday 29 September 2011 10:18:31 Guennadi Liakhovetski wrote:
> > Drivers, that can be built and work with and without
> > CONFIG_VIDEO_V4L2_SUBDEV_API, need the v4l2_subdev_get_try_format() and
> > v4l2_subdev_get_try_crop() functions, even though their return value
> > should never be dereferenced. Also add convenience macros to init and
> > clean up subdevice internal media entities.
> 
> Why don't you just make the drivers depend on CONFIG_VIDEO_V4L2_SUBDEV_API ? 
> They don't need to actually export a device node to userspace, but they 
> require the in-kernel API.

Why? Why should the user build and load all the media controller stuff, 
buy all the in-kernel objects and code to never actually use it? Where 
OTOH all is needed to avoid that is a couple of NOP macros?

Thanks
Guennadi

> 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
> > ---
> >  include/media/v4l2-subdev.h |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> > index f0f3358..4670506 100644
> > --- a/include/media/v4l2-subdev.h
> > +++ b/include/media/v4l2-subdev.h
> > @@ -569,6 +569,9 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh,
> > unsigned int pad) {
> >  	return &fh->try_crop[pad];
> >  }
> > +#else
> > +#define v4l2_subdev_get_try_format(arg...)	NULL
> > +#define v4l2_subdev_get_try_crop(arg...)	NULL
> >  #endif
> > 
> >  extern const struct v4l2_file_operations v4l2_subdev_fops;
> > @@ -610,4 +613,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
> >  	((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
> >  	 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
> > 
> > +#if defined(CONFIG_MEDIA_CONTROLLER)
> > +#define subdev_media_entity_init(sd, n, p,
> > e)	media_entity_init(&(sd)->entity, n, p, e) +#define
> > subdev_media_entity_cleanup(sd)		media_entity_cleanup(&(sd)->entity)
> > +#else
> > +#define subdev_media_entity_init(sd, n, p, e)	0
> > +#define subdev_media_entity_cleanup(sd)		do {} while (0)
> > +#endif
> > +
> >  #endif
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux