[RFCv2 PATCH 4/9] v4l: add buffer exporting via dmabuf

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Mar 27 03:21:27 PDT 2012


Hi Tomasz,

On Friday 23 March 2012 12:33:24 Tomasz Stanislawski wrote:
> On 03/22/2012 12:16 PM, Laurent Pinchart wrote:
> > On Tuesday 13 March 2012 11:17:02 Tomasz Stanislawski wrote:

[snip]

> >> +	case VIDIOC_EXPBUF:
> >> +	{
> >> +		struct v4l2_exportbuffer *p = arg;
> >> +
> >> +		if (!ops->vidioc_expbuf)
> >> +			break;
> >> +
> >> +		ret = ops->vidioc_expbuf(file, fh, p);
> > 
> > You can pass arg to ops->vidioc_expbuf() directly, there's no need to
> > create a struct v4l2_exportbuffer *p variable.
> 
> No problem. I tried to follow style of other ioctls.
> Notice that adding this temporary variable provides some form of type
> checking. I mean using a proper structure for a proper callback.

It makes sure that the argument passed to video_expbuf is indeed a 
v4l2_exportbuffer, but it doesn't check that the arg pointer you assign to p 
points to the right type, so it's a bit pointless in my opinion.

This construct makes sense if you need to access field of the arg pointer here 
before or after calling the operation.

> >> +		break;
> >> +	}

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list