From patchwork Wed Jul 6 18:04:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 950702 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p66I6aJT009640 for ; Wed, 6 Jul 2011 18:08:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755389Ab1GFSEn (ORCPT ); Wed, 6 Jul 2011 14:04:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12312 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755361Ab1GFSEm (ORCPT ); Wed, 6 Jul 2011 14:04:42 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p66I4fqt013664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Jul 2011 14:04:42 -0400 Received: from pedra (vpn1-4-139.ams2.redhat.com [10.36.4.139]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p66I4D6W027326; Wed, 6 Jul 2011 14:04:40 -0400 Date: Wed, 6 Jul 2011 15:04:03 -0300 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List , Linux Kernel Mailing List Subject: [PATCH RFCv3 16/17] [media] v4l2 core: return -ENOTTY if an ioctl doesn't exist Message-ID: <20110706150403.5ddb7a30@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 06 Jul 2011 18:08:17 +0000 (UTC) Currently, -EINVAL is used to return either when an IOCTL is not implemented, or if the ioctl was not implemented. Note: Drivers that don't use video_ioctl2, will need extra patches. Signed-off-by: Mauro Carvalho Chehab diff --git a/Documentation/DocBook/media/v4l/gen-errors.xml b/Documentation/DocBook/media/v4l/gen-errors.xml index dedcc90..8117c60 100644 --- a/Documentation/DocBook/media/v4l/gen-errors.xml +++ b/Documentation/DocBook/media/v4l/gen-errors.xml @@ -30,13 +30,6 @@ ioctl requests for specific causes. - EINVAL or ENOTTY - 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. - - ENODEV Device not found or was removed. @@ -45,6 +38,12 @@ There's not enough memory to handle the desired operation. + ENOTTY + 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. + + ENOSPC 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 c5ee398..43386a6 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -132,7 +132,9 @@ applications. --> 2011-06-27 mcc, po Documented that VIDIOC_QUERYCAP now returns a per-subsystem version instead of a per-driver one. + Standardize an error code for invalid ioctl. + 2.6.39 2011-03-01 diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index f9aebac..4253276 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) &&