Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp183080lqp; Wed, 22 May 2024 00:55:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUss1Q+StohDV0u+nrcmMYCWzpmAgBrQSiwTSPKp5vG6H9rp1JgYEnSrCc69VIHaNcAJ5udLy8D7fjrDA/l5o5dzTGWqPclZuxcjzWGtA== X-Google-Smtp-Source: AGHT+IGpoaDfS2GbE+92O2/kEpoGnLu35/JUR8DorO3Gohgs2erxKx8aeKUs3WkM+zN0RRxKwgL7 X-Received: by 2002:a05:6512:2f7:b0:51c:d6c9:e9a3 with SMTP id 2adb3069b0e04-526bdc52482mr621749e87.17.1716364502938; Wed, 22 May 2024 00:55:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716364502; cv=pass; d=google.com; s=arc-20160816; b=qb6MBqIygPumOUfdkKg+D555OImD2bSNCHOioPp4K9SfJr+atwjvxiOXjY3CQ9z/GN 0PQLq/39/rVCfaNQROqLwjSpSPWvHd1VKXH/jKKFDjmYHCpJS6EChu5QEpviupwHWAK8 yq2/o89CPGY8Ew7199tCPst02quVUl1G9kRgQHtKE1+BTWN7viqG8+NtNqx2hS04I6cp pz/aljxi18DmuuWcpvUhQ89xJ/BJWsDpGfTSKGqeGndoWrhWvck6Ey+9SVMm+77Z7PTt +ycKsb7lNToK4pHadxbFm5KLNPhN/lFfqUAC5/Ji2htFMUxho1VAe+2OtfhIa4pTmzmK PFXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=a8u4qXV/yGEQQXSM2mT2a1BOcwIKU4NgvOgIEcOEl8o=; fh=SN/w8D5YXoIh6XF9k6DPDEKVLJ0OEMRbIPLn/fBbKac=; b=GYh2d2aA9Ie4ZsbBWx8wNS2PFiD2M1zGQrujsWZjkTjUR9/ZNIaom0kmYx3Knyxckp hQROTV17+Hvfg1zwERcHichHONaPgBRHfm8t/rDUWZZqthRIRSfhE3WWXNbYGM199ETP NMrQIo0yQdjYkcHY/WXMY0TvWt6YUE7oQqB+2+Y0MouPrgNi7K2d+3xux/wBda7WlTyw 5oHwKRFW2Vwz06k/CXBaPsiIQZnTegru4AJzHPGZeE7M4d0cHaAbmuR5ThH6PE+DKPam 7Sz0ztnVa85zXWgzMYTed712KOD/Sy965+3ZXNH4BbYC4YrR+G9lgxJhJUejeggw9Tjs LCyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-185887-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185887-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5e5ec9e79asi459892966b.149.2024.05.22.00.55.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 00:55:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185887-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-185887-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185887-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 A4C9F1F22854 for ; Wed, 22 May 2024 07:55:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14DFE7F460; Wed, 22 May 2024 07:54:43 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 28E6D7BB15 for ; Wed, 22 May 2024 07:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716364482; cv=none; b=JggQaN0BkvKLIw6O3gwG9uE+GAd2+j4R1z4rsL0j+UGY+KgfMJ6AxE1A1ARA/8YWXFcM8ULp7FeBO5zr9gFU5iSgoquWW+W2BzmvrWW9gpYRJrxQxmfSaasJ+VAJEyIOVQfe7QNMqcyRuk3JsxrgQ169Nc9uC+hbM+6d/3AQ7Rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716364482; c=relaxed/simple; bh=SVntbTmQZEA3PKqs8A1qluZvBPdpd11OxVSUTFpHJGI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qYBWXXMGk8DAGSQPMKQTy9td+egam//Bx/UjiKuWTAnEvvzsqzESqzHYRF0qqAK47667WMm+TD9io47eMIZuHvJ3hULnBQsQRFmUX+JJHgMTWN2xeh2bbhydstTsyX4qMrGXblGxFPJ9yGLd7j0LDmQy4wChm81B3fcFPzcgppU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s9gnz-0000y6-6g; Wed, 22 May 2024 09:54:35 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9gny-002Ulm-AQ; Wed, 22 May 2024 09:54:34 +0200 Received: from mtr by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s9gny-007sjD-0l; Wed, 22 May 2024 09:54:34 +0200 Date: Wed, 22 May 2024 09:54:34 +0200 From: Michael Tretter To: Nas Chung Cc: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Fricke Subject: Re: [PATCH] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Message-ID: Mail-Followup-To: Michael Tretter , Nas Chung , mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Fricke References: <20240517094940.1169-1-nas.chung@chipsnmedia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240517094940.1169-1-nas.chung@chipsnmedia.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Fri, 17 May 2024 18:49:40 +0900, Nas Chung wrote: > We expect V4L2_TYPE_IS_CAPTURE() macro allow only CAPTURE type. > But, Inverting OUTPUT type can allow undefined v4l2_buf_type. > Check CAPTURE type directly instead of inverting OUTPUT type. > > Signed-off-by: Nas Chung > --- > include/uapi/linux/videodev2.h | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index fe6b67e83751..32b10e2b7695 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -171,7 +171,13 @@ 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) \ > + ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE \ > + || (type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ > + || (type) == V4L2_BUF_TYPE_VBI_CAPTURE \ > + || (type) == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE \ > + || (type) == V4L2_BUF_TYPE_SDR_CAPTURE \ > + || (type) == V4L2_BUF_TYPE_META_CAPTURE) Maybe adding a V4L2_TYPE_IS_VALID(type) macro would be helpful to define TYPE_IS_CAPTURE as all valid types that are not OUTPUT: #define V4L2_TYPE_IS_VALID(type) \ ((type) >= V4L2_BUF_TYPE_VIDEO_CAPTURE \ && (type) <= V4L2_BUF_TYPE_META_OUTPUT) #define V4L2_TYPE_IS_CAPTURE(type) \ (V4L2_TYPE_IS_VALID(type) && !V4L2_TYPE_IS_OUTPUT(type)) This would avoid keeping the two explicit lists of OUTPUT and CAPTURE types. Michael > > enum v4l2_tuner_type { > V4L2_TUNER_RADIO = 1, > -- > 2.25.1 > > >