From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17458C4345F for ; Sat, 20 Apr 2024 23:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PigKY6TTTU1BuEACT0k9pacwpW7psm5DKpqpeP3NYJY=; b=wC9xbmc54OnYTR 4m61o5LcVOU535ppkkGXYOwm08af2AaidRvBIWK9MPi3gXqx/csDg93b+KWxTPRpOfUQFbOgs5PpT JUbPWLdTZxEr0aq6csxybI75T7eRO2+X3u/tWL7K3JFq2TxPd9qA/T7uIBORvNw9O5nkwJoT/ZiKI 8n4yAjqxCUVTm54nyKNDhHNe8VN+dGCgliVFTyU6HDD5QzMpueanYyrwJkAx8AzryQA0PR7DLHQuv ipYYRJw9HZSshNCVGpJX21xyjchAyDZ1z3GKFo/SF4BsI1nSUxNPcXl/JF5YfSpggB/Fk1sSrft/y C8JxxoQOOXkerU+mtTRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryJsK-00000009N3c-1Oys; Sat, 20 Apr 2024 23:12:04 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryJsI-00000009N1j-13m4 for linux-arm-kernel@lists.infradead.org; Sat, 20 Apr 2024 23:12:03 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41a24251123so1552215e9.2 for ; Sat, 20 Apr 2024 16:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713654713; x=1714259513; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=r4SJobPXiJZTeUtb9I6Mhq3OcgAMqPAgBwxUvUsXgSw=; b=QEiwfRtBGVOxyZWEO83FNFs1GIK1HPQfYS3Aal0DS2UF2UQuJ4C5ArAAd3qT0SLmcL gJ+npfVp3wsohZ3JlcVa87VaT5F+mVGzozKidwiZXenxBusHiuQYvGaPU+k8lp7o81Db i05bHz5icuyxW1euu+r2R92QEprZfY+3N4nZPNaXnhpvvViRTkZiif/Ol0Ip5E1IyTPH OezN8pzZ8lTGjFMvG19TP0B2WLrEcXzlLFCzThiRQ2+QNjarY82qwaQ7EQqIe0bbBkTZ EjPN2F1JxLNyiCxUoVggYXJwgNLSzBboPhTOGYjqe719+qsnoauIaxVkFm8NRnyKTvRZ uZ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713654713; x=1714259513; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r4SJobPXiJZTeUtb9I6Mhq3OcgAMqPAgBwxUvUsXgSw=; b=bJkQa0pP82uYYxp/axsIcdUmWWFXGJulCpNYrtUzjIV/M6YIiN0a7uFC/yYJ4d3Esw RVFelqtd3kOquivA3p4/qk3ZO7OSJIsnIJFpXGWH5yQ7g+PWc9bGlSqRWm+hL1syNjEg M23a6fJWBdpL0O+RvUiuilKDlWEXGO2zAyRGeu3Kxl3SyrgYsnJL9ZuvqvmIfAbrnhA/ zqaLmbggqth5XZhyPMuO29ogo2TIc6rloom9vNT4/H/41wjhfbtUDd4nhU3o8FSGHg5b DGkHlfus1hfmKTteI20AB7wfFFnOc6Xkj+4tMiiQhEE/ne+pYIR7EtzycNeC7xC041GL 6Viw== X-Forwarded-Encrypted: i=1; AJvYcCWh9LvOd7nceBnlS3dMngZMdHkNG2VXTJZSODszkVd8u4GG9a+ExKElKHvcceTSS6y4DM33XPJdDX838JZ3AKYsDEBDwES4Lf54q3dEHEUmF1gXAsY= X-Gm-Message-State: AOJu0Yz/usFpSjP/F9MZpcRa5igPwjh6Esi1tmFjzL2yvcyzBNvCSct/ pLiP4JrEyFHnSrXBMyjChnd17Pg/mbP/6vZaSFz2KOPfcGeNFlLxumymPmnf6xA= X-Google-Smtp-Source: AGHT+IHhrXMbVyPQ3xu0BxAvDr/qwuPP5+bQspGoLom9YV5UOhqLd7IShzLKZACYdNB5R60XxGZpSg== X-Received: by 2002:a05:600c:1d0a:b0:418:7c58:d592 with SMTP id l10-20020a05600c1d0a00b004187c58d592mr5521241wms.28.1713654713122; Sat, 20 Apr 2024 16:11:53 -0700 (PDT) Received: from [192.168.0.102] ([176.61.106.68]) by smtp.gmail.com with ESMTPSA id f8-20020adff8c8000000b0033e7b05edf3sm7827624wrq.44.2024.04.20.16.11.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Apr 2024 16:11:52 -0700 (PDT) Message-ID: Date: Sun, 21 Apr 2024 00:11:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 05/26] media: go7007: Use min and max macros To: Ricardo Ribalda , 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 , 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 References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> <20240419-fix-cocci-v2-5-2119e692309c@chromium.org> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <20240419-fix-cocci-v2-5-2119e692309c@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240420_161202_306674_A3A87440 X-CRM114-Status: GOOD ( 16.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 19/04/2024 10:47, Ricardo Ribalda wrote: > It makes the code simpler and cocci happier: > > drivers/media/usb/go7007/go7007-fw.c:1292:14-15: WARNING opportunity for max() > drivers/media/usb/go7007/go7007-fw.c:1293:14-15: WARNING opportunity for min() > > Signed-off-by: Ricardo Ribalda > --- > drivers/media/usb/go7007/go7007-fw.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c > index 018019ba47d4..86ce593e0c54 100644 > --- a/drivers/media/usb/go7007/go7007-fw.c > +++ b/drivers/media/usb/go7007/go7007-fw.c > @@ -1289,8 +1289,8 @@ static int avsync_to_package(struct go7007 *go, __le16 *code, int space) > 0xbf99, (u16)((-adjratio) >> 16), > 0xbf92, 0, > 0xbf93, 0, > - 0xbff4, f1 > f2 ? f1 : f2, > - 0xbff5, f1 < f2 ? f1 : f2, > + 0xbff4, max(f1, f2), > + 0xbff5, min(f1, f2), > 0xbff6, f1 < f2 ? ratio : ratio + 1, > 0xbff7, f1 > f2 ? ratio : ratio + 1, > 0xbff8, 0, > Code is correct, but the commit log could use some expansion. Suggest: "Replace ternary inline selection of f1 and f2 min max values with min() and max() helper functions for the sake of readability and to make coccinelle happier" You can take the RB either way though Reviewed-by: Bryan O'Donoghue _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel