summary refs log tree commit diff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-06 14:08:08 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:53:38 -0300
commit9190d191b1b814dfb488125b54cf0de6eedd9220 (patch)
treea0d4888daa6b56ff06c2296b9e7b83b904682271
parentc28f53f6cd45de5cefe8dc7479236b745b97d49c (diff)
downloadlinux-9190d191b1b814dfb488125b54cf0de6eedd9220.tar.gz
[media] v4l2 core: return -ENOTTY if an ioctl doesn't exist
Currently, -EINVAL is used to return either when an IOCTL is not
implemented, or if the ioctl was not implemented.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--Documentation/DocBook/media/v4l/gen-errors.xml13
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml2
-rw-r--r--drivers/media/video/v4l2-ioctl.c4
3 files changed, 10 insertions, 9 deletions
diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml
index 7c1980e8747b..5bbf3ce1973a 100644
--- a/Documentation/DocBook/media/v4l/gen-errors.xml
+++ b/Documentation/DocBook/media/v4l/gen-errors.xml
@@ -31,13 +31,6 @@
 	       ioctl requests for specific causes.</entry>
       </row>
       <row>
-	<entry>EINVAL or ENOTTY</entry>
-	<entry>The ioctl is not supported by the driver, actually meaning that
-	       the required functionality is not available, or the file
-	       descriptor is not for a media device. The usage of EINVAL is
-	       deprecated and will be fixed on a latter patch.</entry>
-      </row>
-      <row>
         <entry>ENODEV</entry>
 	<entry>Device not found or was removed.</entry>
       </row>
@@ -46,6 +39,12 @@
 	<entry>There's not enough memory to handle the desired operation.</entry>
       </row>
       <row>
+	<entry>ENOTTY</entry>
+	<entry>The ioctl is not supported by the driver, actually meaning that
+	       the required functionality is not available, or the file
+	       descriptor is not for a media device.</entry>
+      </row>
+      <row>
 	<entry>ENOSPC</entry>
 	<entry>On USB devices, the stream ioctl's can return this error, meaning
 	       that this request would overcommit the usb bandwidth reserved
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index c5ee3982cff5..43386a6aef76 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -132,7 +132,9 @@ applications. -->
 	<date>2011-06-27</date>
 	<authorinitials>mcc, po</authorinitials>
 	<revremark>Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one.</revremark>
+	<revremark>Standardize an error code for invalid ioctl.</revremark>
       </revision>
+
       <revision>
 	<revnumber>2.6.39</revnumber>
 	<date>2011-03-01</date>
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 29f7a7df34c3..002ce1363443 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -543,12 +543,12 @@ static long __video_do_ioctl(struct file *file,
 	struct v4l2_fh *vfh = NULL;
 	struct v4l2_format f_copy;
 	int use_fh_prio = 0;
-	long ret = -EINVAL;
+	long ret = -ENOTTY;
 
 	if (ops == NULL) {
 		printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
 				vfd->name);
-		return -EINVAL;
+		return ret;
 	}
 
 	if ((vfd->debug & V4L2_DEBUG_IOCTL) &&