Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1377993lqj; Mon, 3 Jun 2024 22:14:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLx+Exp/XraZ1ilY3lwAZUNrNLwOF36yXG0OT5s5aslwhFbbe5OngLFAq8srGYl3mKze7ca2fDC+ECaqs+nsWZdlz1Z7z5TuH2h3mfgA== X-Google-Smtp-Source: AGHT+IESqq2Bv6W20+QMhce/jZDcRU7Jad28Uva16ZfRulROY4x8QL760WtLHhRWIKuBHTY/lr8g X-Received: by 2002:a50:d504:0:b0:574:ea0b:c1a3 with SMTP id 4fb4d7f45d1cf-57a7a687649mr1040764a12.1.1717478091508; Mon, 03 Jun 2024 22:14:51 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31caf2f1si4500356a12.605.2024.06.03.22.14.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 22:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chipsnmedia.com header.s=selector1 header.b=WTCo9tNe; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-200046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200046-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3A6131F25060 for ; Tue, 4 Jun 2024 05:14:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55DD313E027; Tue, 4 Jun 2024 05:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="WTCo9tNe" Received: from SEVP216CU002.outbound.protection.outlook.com (mail-koreacentralazon11022018.outbound.protection.outlook.com [52.101.154.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89A3213DBA4; Tue, 4 Jun 2024 05:11:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.154.18 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717477904; cv=fail; b=ZinZKtdPC48dpocRZfpcE46JyTGxds0mkyWjBi/gIyqsmAnPI/qnVVgqZR/S+fhPsQkBda7BLS9Whb/kxquWT1jeJpb4KaxC17l1IZlFQICbQ5h8WJLnk6NM2BFMHQlH/mudKoc2sfNwSw9/ebbKLFIGUQjUJ7bhpCJ9+fmHJ7Y= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717477904; c=relaxed/simple; bh=7cJfdK87ftfvhKD8heJ0+NI98EwfX/oBDqQnG+UwBWs=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=YJa3XM7IipZ6c0W1h1hTHafuU0gxn6B5LvBrnyplgqppoCW2/QuU8sn5AKvC7nfFpVv3jAHQ20T+tZwjiu70BOwdPFnUqxjPZXXlio0Alv0b7PEs/Mq8keCX5OWTqJ9fqOAYjXNoWjiKvg1BlrwobXhSjHEoN54zlI0Mnopvm6I= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=pass smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=WTCo9tNe; arc=fail smtp.client-ip=52.101.154.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chipsnmedia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WHEkVQGwhCwsdDU8o+SW+95Jvh+Abw8qoy4/uqh9/YtJbr5EbPBBFP16kH3/50x+Jdntp69PWFv/GWukVdglSuc6X00A3u30/UC6TGAPIkvjCawYsqe4nTT1KdsbsINPrvhpuNbw98EPvpLPkI86WypyQVk0i+XV9khodbwmCIIWKR1+atkQl1/RXIRxtQNMfI6VLr6TWzOvh9YXaGfda4PdrpqdwRtR1/K/+FFKwG0bO/4g7/Ecl1BY5cL/Qv1Kgk1IdjDgi8LSOKHbTCZDnmG4kmdiGE+xdbLUUeFtii8yll/eQbnm4Q+n3ITo0u0xxqRAx+c7myUJJF6AlHz6cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZoCXtRmruLooNqkHk/hITgSWUp+4gmZn5RIctzBMGA8=; b=esQzSg1xk65i5znE2ei93zijvUN8k9gZnTmOfH8OIqk85f7gLAggoxEdz6AT0TydkmZjRcT7BHA+ZrcdSkmDfCfxAjnye5+20ztfwJoE0aMjdnqtW5d9UHlfv5LVgp7Rkp5DWfTkjTgTfOVvlPW9x4Rd8VlEYjRgGyCVq0drzj1K310DC3qCg/yV6KN4Fb04m0rhpgqs9A8YZUkG6hC7FZ91KmjZ6B+yF+ETzy9t9T/CuOeHT9WYJmeORdTf+x9Thy8flW0OwSjvCE7Fr7G+mc8n6rnHLnf3BfwlJDsCfVqbYLKpCrcZ1xjqlZzMlUwm5AO2ggBoB6Fb49zO81URLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZoCXtRmruLooNqkHk/hITgSWUp+4gmZn5RIctzBMGA8=; b=WTCo9tNexSEKPxLCe08saef8Konzlo5S2S/FQ70yk4cbSlQTRPeOZ0SP3cKwUIPv7bgoCXgTTQCIGWVRwOKUB63y1gdPq9mrT7Dd0BMHBPqRi+ZSkWWg6AsXBcS8/GiBbDacnsA004tM3SxnHRXjhaX4buhwBCMoO7LGw74ov/I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SL2P216MB1246.KORP216.PROD.OUTLOOK.COM (2603:1096:101:a::9) by SE2P216MB1537.KORP216.PROD.OUTLOOK.COM (2603:1096:101:2c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Tue, 4 Jun 2024 05:11:37 +0000 Received: from SL2P216MB1246.KORP216.PROD.OUTLOOK.COM ([fe80::9e3d:ee20:8cc7:3c07]) by SL2P216MB1246.KORP216.PROD.OUTLOOK.COM ([fe80::9e3d:ee20:8cc7:3c07%4]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 05:11:37 +0000 From: Nas Chung To: mchehab@kernel.org, hverkuil@xs4all.nl, bryan.odonoghue@linaro.org, linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nas Chung , Michael Tretter Subject: [PATCH v3 1/3] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Date: Tue, 4 Jun 2024 14:11:18 +0900 Message-Id: <20240604051120.9441-1-nas.chung@chipsnmedia.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SE2P216CA0068.KORP216.PROD.OUTLOOK.COM (2603:1096:101:118::11) To SL2P216MB1246.KORP216.PROD.OUTLOOK.COM (2603:1096:101:a::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2P216MB1246:EE_|SE2P216MB1537:EE_ X-MS-Office365-Filtering-Correlation-Id: 422e6d6f-6303-4fd0-a96c-08dc8454cf60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|366007|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HPuT2trc8kOi23WLMHZ8kPU6QMeun5f0qMcbxKGcQrH7owuFWkusrxxm9ahz?= =?us-ascii?Q?DlnTA9tbQRUIHWswQujtLE8qDcXI8sZhW9l13JpaX6kHlRBzEmc1VJhnMC9g?= =?us-ascii?Q?G1uw/RMjR9wRDFiqtapKKMvmEwpZbpdCPEJwwb518A9W6PHFOk9+6mmC3g05?= =?us-ascii?Q?TFqTtpHQN5Bh3Ws5HFNtdlasrDqhXL+hffjwYyfVgi3lt+GS2wHKRmdGfbOR?= =?us-ascii?Q?CaVwQfygCmYNvr//z0+vu3JrHt2SCRvNluVmgdmoHEckgHYa1P7oKJJB2bvb?= =?us-ascii?Q?TCSrG7PbS2LrQDyDLVvObXoyZM46SAxgPhPya+DNUuzGk4OXRcrORlEoOhxN?= =?us-ascii?Q?n1NpyJqZMRTHwCNQyft4nG11F5JGa+qt/YSsBZovdHOOG2htZhxK64YaZEhl?= =?us-ascii?Q?pKjOWoy5bz77IQqiJ3pFIJYj3Fm2Y7TwA0h27iFTQMP6U0KeytTc+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hdQazit9brDHgiLQbWWlOA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2P216MB1246.KORP216.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(366007)(1800799015)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zY7PKxnEyNIVSOfeQ5xnQYiKZDBFYLwohsu1Ni3/j303xf46XyYzmyewSpSP?= =?us-ascii?Q?26vyhdnCFaxk5jO2olFQnWBCQypfbn2f9d3JfVHt9EEQ0uEtFbbSXwnCwUxg?= =?us-ascii?Q?7iftd4jjSnUN9w4bgvYmrASSp0xSBD3WrfvLu3GLHhx7o/nkXf8JhgQRB9mF?= =?us-ascii?Q?UebX2gj5T83xUSZGe4WIkM/6ldiLtOPIEnJfXa4GeFQVnVfNYSVkTLTYSvRs?= =?us-ascii?Q?onVOkPl4D+dOGyaGnix1YO5JnEDs3vRELlsVzAuk7JUq6sedEScBdx4J9k8s?= =?us-ascii?Q?U1Fg3f89iw4dRITBQdvFbmxApL9/q5t3H1c6QSqPPN+bCp7xAlyaxB3USLen?= =?us-ascii?Q?s6b38aJGYngWWKDbfi7eLi7jylE8Xsp3vK85Fw5hLn8S9US7KgU6pSG+fUHj?= =?us-ascii?Q?EHoQXJVHErV0uySMHaPd4WC8mug6BDq4pxIHXZFEVtiX6SX3cnPG9Exn9PrV?= =?us-ascii?Q?K5XRvyH/7722FCcl9VIXvT4YJahqLQ8dtTh+1mzEfEN0Z2kJ/1U5bVoEaKbf?= =?us-ascii?Q?8V62+WW5l13vBE8IxDPRyBsq1iknGugFpBMSyDaq5d8ile5Odkm0oxpXQf1w?= =?us-ascii?Q?67zEmj9U8u9IynTGUvjNV+yxcnyeQ7Ib97ogxeF/NkGH/vmK2AJhAxmmQBzE?= =?us-ascii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G1Q0A3niQ4TPfdUQB2u5mGtthL?= =?us-ascii?Q?3StLcC3QIPxfGCUVk9AFpN0toxJZ6FYdd869YjnqQrZvISPA74PvDI+e6Q0K?= =?us-ascii?Q?Ow=3D=3D?= X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 422e6d6f-6303-4fd0-a96c-08dc8454cf60 X-MS-Exchange-CrossTenant-AuthSource: SL2P216MB1246.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 05:11:37.2333 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WnKv7SQFALFlk/4H9gzA/DtJqrzrGAoNRTPRWz6lmO2u+Ku4xz11zR6e9oj8mia8E14ubX6o7Ib4zE9FCMTUxS9o2mN5FkBLgXlgjILa0ME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE2P216MB1537 Explicitly compare a buffer type only with valid buffer types, to avoid matching a buffer type outside of the valid buffer type set. Signed-off-by: Nas Chung Reviewed-by: Michael Tretter --- v3 - Address Han's feedback v2 - Improve commit message - Add V4L2_TYPE_IS_VALID(type) macro include/uapi/linux/videodev2.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index fe6b67e83751..51da63173a98 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -153,10 +153,17 @@ enum v4l2_buf_type { V4L2_BUF_TYPE_SDR_OUTPUT = 12, V4L2_BUF_TYPE_META_CAPTURE = 13, V4L2_BUF_TYPE_META_OUTPUT = 14, + /* V4L2_TYPE_IS_VALID and V4L2_TYPE_IS_OUTPUT must + * be updated if a new type is added. + */ /* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, }; +#define V4L2_TYPE_IS_VALID(type) \ + ((type) >= V4L2_BUF_TYPE_VIDEO_CAPTURE \ + && (type) <= V4L2_BUF_TYPE_META_OUTPUT) + #define V4L2_TYPE_IS_MULTIPLANAR(type) \ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) @@ -171,7 +178,8 @@ enum v4l2_buf_type { || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \ || (type) == V4L2_BUF_TYPE_META_OUTPUT) -#define V4L2_TYPE_IS_CAPTURE(type) (!V4L2_TYPE_IS_OUTPUT(type)) +#define V4L2_TYPE_IS_CAPTURE(type) \ + (V4L2_TYPE_IS_VALID(type) && !V4L2_TYPE_IS_OUTPUT(type)) enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, -- 2.25.1