Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp521055lqt; Fri, 19 Apr 2024 02:53:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWrmRLKMnvWYvYBW8IfIBjqM+2BI3oS5yDG/jh1PYRHhj/QDpun6pVs1b7J1EFOjnu4qbiJl34xIj9yiGS2lwGIeD/r6o1TLl3WN+myCw== X-Google-Smtp-Source: AGHT+IE6T/1lrFYrvU8kR+nVxVt0FEQtIHeGCuXO8ySgGt2CO2y9zRId6q33pnURH/jiSoIv8jr2 X-Received: by 2002:a05:6512:12cd:b0:518:c902:f992 with SMTP id p13-20020a05651212cd00b00518c902f992mr1481486lfg.9.1713520403407; Fri, 19 Apr 2024 02:53:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713520402; cv=pass; d=google.com; s=arc-20160816; b=Ho/Kcx11WKS34m6CHc2DijoDBCL/uK6ogQXteLA3Utg/6wC8wz7vqnI9EtQp0vlMUD r/EO4bcEFeVilrBwrQJVP3Ko19PdGMxa1afWGmcMJXZW6aDKarf+vqzz04JEUU5cSmzN 3Ed+X053MF3jV4c4qx78A19sLzLNnnFUKpSfai+aA+gfnFeJiw35bCj1dK0WVuzspDy1 KF5nVAksLiiLp3EqiZ+Uje8KdWyh6TAFW3f08dFjGJ4ni5MsFIh64hPkBbN2MIanNSG2 GVToBKDGWny39rT+BzcCjU6+96sG6hDGC0bwtP4jeu2HuGhfx1j+lcmOWTSwH2cvaj+V 5K/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=0jv41cPIK92ur4lysOBbsHOVURXwH8FRVBK0KQUkRX8=; fh=qAjgKCEe5PWmKV43chAriJ0UaciK0CT/Ew1ZjvSy19o=; b=vBPGbHn2vRXdEaLAo7JLowv8fdBhAFSFBHA5B2JsdW6vVlHu6N/a7n2qbUB5SPnKg4 cTYaAOhe40VOy+nhX4A5K+oDeGeK2ZZYG3WTbMwn51stV+mt79eC0yAdeRlskJ4PuDIY LTpFmtHEb0lNIIgRPGYm4vGnPrH2DR8jBSHHIQJpxbRYqz3NzjqTAHeGxnioeOkpwVS8 8C8ZhsR8Dayi2ailOa6lCRdv/68GF/80DW85M9iYgqyNEY0GGuWQq5aZr3fYPml15+is P7X854E/yX7+bpiKddltv+I0g7W1gUTnK+qIU0dzszmoeW9SXLEYzxlneH/RDD2MPuF2 PmLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eIZu+n3k; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-151260-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g17-20020aa7d1d1000000b00570238b3efesi1915008edp.21.2024.04.19.02.53.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151260-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; dkim=pass header.i=@chromium.org header.s=google header.b=eIZu+n3k; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-151260-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 E58AD1F21D3E for ; Fri, 19 Apr 2024 09:53:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A450012D210; Fri, 19 Apr 2024 09:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eIZu+n3k" Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FBC585C74 for ; Fri, 19 Apr 2024 09:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520177; cv=none; b=XaSBZPNUuyczJ3lJbvcPXOrE9c4WimZ1Kq5qsPEfB3vO8UUzgfyseLNlaoq39r53ug42XF2hDsx4p6V7mLamEHXCb4IoH/hhGOGiWVmxnq11rmSAJr7TzkehoCvJC7kMrVqdeA81QMFVnSM3/ke2K7fi+lObsJ07NEeq4B/y+zA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520177; c=relaxed/simple; bh=0VmWOq0FNED2TWNE7G/mZoZRSR2zskQMt81gS2SxLNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IILHSbc7/AHbQMLzSgXSERQCSNom7p8OTawTDrP5PBG8IDtUezaa0b2S4N72+I4H/awpKSGwghNVDzEhhK1XaMZ+iL5yWM0mKb8/0Xz2d+CfkaNUn+spFCN7U6pc6tdal10wJciTgIpJzlmAdlDvgDCS/L8vq01uIpyAsZ7tEvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=eIZu+n3k; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78f056f928eso115331285a.0 for ; Fri, 19 Apr 2024 02:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520174; x=1714124974; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0jv41cPIK92ur4lysOBbsHOVURXwH8FRVBK0KQUkRX8=; b=eIZu+n3kqnN5hXJRWz93UrTIokn6sMlXNWwbhawXi2uyaqyDOwpG/WKlT3vgtWx/XU rXqQ9jItl3g1MrrNa9vK20rtrkt+RO55CCgvaNrnwGzCkw6c1Ste0HiwvHt2LFrfMF/Q o79fAzEvHZTy+v/1BZR+n6eFRXim+VlEUxu6Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520174; x=1714124974; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0jv41cPIK92ur4lysOBbsHOVURXwH8FRVBK0KQUkRX8=; b=u0Mp0lSUOxXOvb8f9+jVnjhIToH96nT16+eLgS3sFH09inQXkjIwFlWNxxxLEooci2 R4vnt+stWiDVKs5JGanJ1ITMJ5KRHdyToheUd0fT3cd0aGJgRVAIQE3bwhmIfGn4+ios ntHRRbzZLwdH/cLLVvUkBvdrZECyfgAawzyoQA6dkBviq5iI0+RD8gpcW2JkpRpXf8F4 RLNtB/7HRzt/j4qqJJIjR+TcX8BSe1A3HBE1c52llnPakROa6uYEFvMgDXoVMBie8MWc awFACVpaOVc5MAECV/fbota4ymRJrUFMRD8Ul047PBrEepoFJeJrc/qThi1EhIQZ3g2l 4mAA== X-Forwarded-Encrypted: i=1; AJvYcCXwcNzFxSIrrHpKYd3upk3gokeZ+e1bm09WN4bcrkb8IEhKwKtdZcyQb96Xf8bXNT2dnlft0E3IrTjSQSOuGdXDdr4xoYjSmUOBjMIJ X-Gm-Message-State: AOJu0YxkiIYP0x/MuH/4Gw24c/lnp2EzYVN2ndgD0juwzlGFwDkPK50O /aItqsy8EKjsZt8wfSMhUsMDHqt+CHZilmLb7YG3pksWMgyHomB6KSvWmiTlrw== X-Received: by 2002:a05:620a:4694:b0:78e:d2ff:a108 with SMTP id bq20-20020a05620a469400b0078ed2ffa108mr2287614qkb.0.1713520174478; Fri, 19 Apr 2024 02:49:34 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id dt14-20020a05620a478e00b0078d735ca917sm1434532qkb.123.2024.04.19.02.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:34 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:47:59 +0000 Subject: [PATCH v2 13/26] media: common: saa7146: Use min macro 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-Transfer-Encoding: 7bit Message-Id: <20240419-fix-cocci-v2-13-2119e692309c@chromium.org> References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> In-Reply-To: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 Simplifies the code. Found by cocci: drivers/media/common/saa7146/saa7146_hlp.c:125:36-37: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:154:41-42: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:286:35-36: WARNING opportunity for min() drivers/media/common/saa7146/saa7146_hlp.c:289:35-36: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/common/saa7146/saa7146_hlp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/saa7146/saa7146_hlp.c b/drivers/media/common/saa7146/saa7146_hlp.c index 7569d8cdd4d8..fe3348af543e 100644 --- a/drivers/media/common/saa7146/saa7146_hlp.c +++ b/drivers/media/common/saa7146/saa7146_hlp.c @@ -122,7 +122,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* set horizontal filter parameters (CXY = CXUV) */ - cxy = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].hps_coeff; + cxy = hps_h_coeff_tab[min(xpsc - 1, 63)].hps_coeff; cxuv = cxy; /* calculate and set horizontal fine scale (xsci) */ @@ -151,7 +151,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, xacm = 0; /* get best match in the table of attenuations for horizontal scaling */ - h_atten = hps_h_coeff_tab[( (xpsc - 1) < 63 ? (xpsc - 1) : 63 )].weight_sum; + h_atten = hps_h_coeff_tab[min(xpsc - 1, 63)].weight_sum; for (i = 0; h_attenuation[i] != 0; i++) { if (h_attenuation[i] >= h_atten) @@ -283,10 +283,10 @@ static int calculate_v_scale_registers(struct saa7146_dev *dev, enum v4l2_field } /* get filter coefficients for cya, cyb from table hps_v_coeff_tab */ - cya_cyb = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].hps_coeff; + cya_cyb = hps_v_coeff_tab[min(yacl, 63)].hps_coeff; /* get best match in the table of attenuations for vertical scaling */ - v_atten = hps_v_coeff_tab[ (yacl < 63 ? yacl : 63 ) ].weight_sum; + v_atten = hps_v_coeff_tab[min(yacl, 63)].weight_sum; for (i = 0; v_attenuation[i] != 0; i++) { if (v_attenuation[i] >= v_atten) -- 2.44.0.769.g3c40516874-goog