diff mbox

[4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

Message ID 1346052196-32682-5-git-send-email-gaowanlong@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wanlong Gao Aug. 27, 2012, 7:23 a.m. UTC
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: linux-media@vger.kernel.org
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
 drivers/media/video/omap3isp/ispvideo.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart Sept. 13, 2012, 4:03 a.m. UTC | #1
Hi Wanlong,

Thanks for the patch.

On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  drivers/media/video/omap3isp/ispvideo.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/video/omap3isp/ispvideo.c
> b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
> --- a/drivers/media/video/omap3isp/ispvideo.c
> +++ b/drivers/media/video/omap3isp/ispvideo.c
> @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
>  	if (ret == -ENOIOCTLCMD)
> -		ret = -EINVAL;
> +		ret = -ENOTTY;

I don't think this location should be changed. __isp_video_get_format() is 
called by isp_video_check_format() only, which in turn is called by 
isp_video_streamon() only. A failure to retrieve the format in 
__isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
supported.

I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

> 
>  	mutex_unlock(&video->mutex);
> 
> @@ -723,7 +723,7 @@ isp_video_try_format(struct file *file, void *fh, struct
> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
>  	if (ret)
> -		return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> +		return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
> 
>  	isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
>  	return 0;
> @@ -744,7 +744,7 @@ isp_video_cropcap(struct file *file, void *fh, struct
> v4l2_cropcap *cropcap) ret = v4l2_subdev_call(subdev, video, cropcap,
> cropcap);
>  	mutex_unlock(&video->mutex);
> 
> -	return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> +	return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
>  }
> 
>  static int
> @@ -771,7 +771,7 @@ isp_video_get_crop(struct file *file, void *fh, struct
> v4l2_crop *crop) format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format);
>  	if (ret < 0)
> -		return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> +		return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
> 
>  	crop->c.left = 0;
>  	crop->c.top = 0;
> @@ -796,7 +796,7 @@ isp_video_set_crop(struct file *file, void *fh, struct
> v4l2_crop *crop) ret = v4l2_subdev_call(subdev, video, s_crop, crop);
>  	mutex_unlock(&video->mutex);
> 
> -	return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> +	return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
>  }
> 
>  static int
Wanlong Gao Sept. 13, 2012, 10:21 a.m. UTC | #2
On 09/13/2012 12:03 PM, Laurent Pinchart wrote:
> Hi Wanlong,
> 
> Thanks for the patch.
> 
> On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
>> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
>> translated as ENOTTY to user mode.
>>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
>> Cc: linux-media@vger.kernel.org
>> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>> ---
>>  drivers/media/video/omap3isp/ispvideo.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/media/video/omap3isp/ispvideo.c
>> b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
>> --- a/drivers/media/video/omap3isp/ispvideo.c
>> +++ b/drivers/media/video/omap3isp/ispvideo.c
>> @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
>> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>>  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
>>  	if (ret == -ENOIOCTLCMD)
>> -		ret = -EINVAL;
>> +		ret = -ENOTTY;
> 
> I don't think this location should be changed. __isp_video_get_format() is 
> called by isp_video_check_format() only, which in turn is called by 
> isp_video_streamon() only. A failure to retrieve the format in 
> __isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
> supported.
> 
> I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

Fine, I defer to your great knowledge in this.

Thanks,
Wanlong Gao

--
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
Mauro Carvalho Chehab Sept. 15, 2012, 4:24 p.m. UTC | #3
Em Thu, 13 Sep 2012 06:03:21 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Wanlong,
> 
> Thanks for the patch.
> 
> On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
> > At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> > translated as ENOTTY to user mode.
> > 
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> > Cc: linux-media@vger.kernel.org
> > Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> > ---
> >  drivers/media/video/omap3isp/ispvideo.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/media/video/omap3isp/ispvideo.c
> > b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
> > --- a/drivers/media/video/omap3isp/ispvideo.c
> > +++ b/drivers/media/video/omap3isp/ispvideo.c
> > @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
> > v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> >  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
> >  	if (ret == -ENOIOCTLCMD)
> > -		ret = -EINVAL;
> > +		ret = -ENOTTY;
> 
> I don't think this location should be changed. __isp_video_get_format() is 
> called by isp_video_check_format() only, which in turn is called by 
> isp_video_streamon() only. A failure to retrieve the format in 
> __isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
> supported.
> 
> I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.
> 

Not quite sure how to tag it at patchwork... I guess I'll mark it as "accepted",
as, from what I understood, Laurent partially accepted it, and will be adding
on his tree.

Regards,
Mauro
--
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
Laurent Pinchart Sept. 19, 2012, 12:33 a.m. UTC | #4
Hi Mauro,

On Saturday 15 September 2012 13:24:37 Mauro Carvalho Chehab wrote:
> Em Thu, 13 Sep 2012 06:03:21 +0200 Laurent Pinchart escreveu:
> > On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
> > > At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> > > translated as ENOTTY to user mode.
> > > 
> > > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> > > Cc: linux-media@vger.kernel.org
> > > Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> > > ---
> > > 
> > >  drivers/media/video/omap3isp/ispvideo.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/omap3isp/ispvideo.c
> > > b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
> > > --- a/drivers/media/video/omap3isp/ispvideo.c
> > > +++ b/drivers/media/video/omap3isp/ispvideo.c
> > > @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video,
> > > struct
> > > v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> > > 
> > >  	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
> > >  	if (ret == -ENOIOCTLCMD)
> > > 
> > > -		ret = -EINVAL;
> > > +		ret = -ENOTTY;
> > 
> > I don't think this location should be changed. __isp_video_get_format() is
> > called by isp_video_check_format() only, which in turn is called by
> > isp_video_streamon() only. A failure to retrieve the format in
> > __isp_video_get_format() does not really mean the VIDIOC_STREAMON is not
> > supported.
> > 
> > I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.
> 
> Not quite sure how to tag it at patchwork... I guess I'll mark it as
> "accepted", as, from what I understood, Laurent partially accepted it, and
> will be adding on his tree.

Yes I'll add a modified version to my tree.
diff mbox

Patch

diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index b37379d..2dd982e 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -337,7 +337,7 @@  __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
 	fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
 	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
 	if (ret == -ENOIOCTLCMD)
-		ret = -EINVAL;
+		ret = -ENOTTY;
 
 	mutex_unlock(&video->mutex);
 
@@ -723,7 +723,7 @@  isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
 	fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
 	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
 	if (ret)
-		return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+		return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
 	isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
 	return 0;
@@ -744,7 +744,7 @@  isp_video_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap)
 	ret = v4l2_subdev_call(subdev, video, cropcap, cropcap);
 	mutex_unlock(&video->mutex);
 
-	return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+	return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int
@@ -771,7 +771,7 @@  isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop)
 	format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
 	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format);
 	if (ret < 0)
-		return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+		return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
 	crop->c.left = 0;
 	crop->c.top = 0;
@@ -796,7 +796,7 @@  isp_video_set_crop(struct file *file, void *fh, struct v4l2_crop *crop)
 	ret = v4l2_subdev_call(subdev, video, s_crop, crop);
 	mutex_unlock(&video->mutex);
 
-	return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+	return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int