From patchwork Wed Jul 20 12:31:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9239491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25FAE60574 for ; Wed, 20 Jul 2016 12:31:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 175AA2787C for ; Wed, 20 Jul 2016 12:31:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C36027BF8; Wed, 20 Jul 2016 12:31:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7184B2787C for ; Wed, 20 Jul 2016 12:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753516AbcGTMbe (ORCPT ); Wed, 20 Jul 2016 08:31:34 -0400 Received: from lb1-smtp-cloud6.xs4all.net ([194.109.24.24]:35207 "EHLO lb1-smtp-cloud6.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752134AbcGTMbb (ORCPT ); Wed, 20 Jul 2016 08:31:31 -0400 Received: from tschai.lan ([90.149.38.145]) by smtp-cloud6.xs4all.net with ESMTP id M0XS1t00337uBN2010XVHz; Wed, 20 Jul 2016 14:31:29 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by tschai.lan (Postfix) with ESMTPSA id E42BF180496 for ; Wed, 20 Jul 2016 14:31:25 +0200 (CEST) To: Linux Media Mailing List From: Hans Verkuil Subject: [PATCH] vivid: return -ENODATA if the current input doesn't support g/s_selection Message-ID: <1dc0cf10-5278-4430-b925-51eca4dc4599@xs4all.nl> Date: Wed, 20 Jul 2016 14:31:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Returning -EINVAL indicates wrong arguments, but that's not the case here. Returning -ENOTTY is also no option, since the ioctl is implemented, but it just is not valid for this input. So use -ENODATA instead. This is also used elsewhere when an ioctl isn't valid for a specific input. In this case G/S_SELECTION returned -EINVAL for the webcam input. That input doesn't support cropping, instead it uses ENUM_FRAMESIZES to enumerate a list of discrete frame sizes. Signed-off-by: Hans Verkuil --- A patch for docs-next will follow. --- -- 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 diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index d404a7c..d5c84ec 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -823,7 +823,7 @@ int vivid_vid_cap_g_selection(struct file *file, void *priv, if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; sel->r.left = sel->r.top = 0; switch (sel->target) { @@ -872,7 +872,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; switch (s->target) { case V4L2_SEL_TGT_CROP: