From patchwork Wed Feb 1 16:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 650766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 946D4C05027 for ; Wed, 1 Feb 2023 16:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232280AbjBAQMC (ORCPT ); Wed, 1 Feb 2023 11:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjBAQMA (ORCPT ); Wed, 1 Feb 2023 11:12:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F289F6A735 for ; Wed, 1 Feb 2023 08:11:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9022D6185D for ; Wed, 1 Feb 2023 16:11:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 413AEC433EF; Wed, 1 Feb 2023 16:11:57 +0000 (UTC) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Andy Walls , Hans Verkuil Subject: [PATCH 2/8] v4l2-dev.c: check for V4L2_CAP_STREAMING to enable streaming ioctls Date: Wed, 1 Feb 2023 17:11:47 +0100 Message-Id: <20230201161153.883376-3-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230201161153.883376-1-hverkuil-cisco@xs4all.nl> References: <20230201161153.883376-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil Rather than checking which device type it is, just check the STREAMING cap since that indicates support for streaming ioctls. Some drivers only support READWRITE (typically MPEG encoders). Signed-off-by: Hans Verkuil --- drivers/media/v4l2-core/v4l2-dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 397d553177fa..f81279492682 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -556,6 +556,7 @@ static void determine_valid_ioctls(struct video_device *vdev) bool is_rx = vdev->vfl_dir != VFL_DIR_TX; bool is_tx = vdev->vfl_dir != VFL_DIR_RX; bool is_io_mc = vdev->device_caps & V4L2_CAP_IO_MC; + bool has_streaming = vdev->device_caps & V4L2_CAP_STREAMING; bitmap_zero(valid_ioctls, BASE_VIDIOC_PRIVATE); @@ -708,8 +709,8 @@ static void determine_valid_ioctls(struct video_device *vdev) SET_VALID_IOCTL(ops, VIDIOC_TRY_FMT, vidioc_try_fmt_sdr_out); } - if (is_vid || is_vbi || is_sdr || is_tch || is_meta) { - /* ioctls valid for video, vbi, sdr, touch and metadata */ + if (has_streaming) { + /* ioctls valid for streaming I/O */ SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf);