From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 0291C481CD for ; Sat, 20 Apr 2024 23:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713654716; cv=none; b=Cuai7yZZdL513NdeL6FJDt0AAHYB2yz+FOYGl74neJmvk8e2YMxbW2gUQ5Du80obPx1iiS7uFYsTBU6MS8MeKSc5Ba1IAg+E3W2Gc/wMJJO7g9M57auXABAYr3lxN0OjSC/x371YiL0I0g20QtmlQK0OwijwKQ/x+slTJcokr18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713654716; c=relaxed/simple; bh=RnTvMGDlpXWcw0TABozpeun32zm855Jpbto6yuwQGuk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EgDFpiObDgzLTfLkdP7BJt4M9WGGRwObabFc75J6YB9CydYqWrBuM5VZXd3nfGWzpmg2dzRcerYrvd5yHQExG4ePddQU4eAxFr5Ku/OJGa6jL8FJcFkQyCmYbYl4cyIr72J9VfWmjwidAfSBdOb3skpLWstg7zDBmSvuJmcfxAA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ggz1xevr; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ggz1xevr" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-419c8236b34so14335155e9.0 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.linux.dev; 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=ggz1xevrxDIU9XB0y8tOhh+QKIFH93X7N+LQq+Ag7/zHsMRnef+mWnOOtCiwF0yW5B NgDCt41iVKVGxqynfhkTEx+iA8LHqVRf4GEIsz1SYYCo/wfFuJZlAUUxNfRmsbCdjfh4 jxS5Xc/vP9L5l2wHjw5dw3etdmTiSiJi5o9BRq/jnwRYwaqlMT49mGa1EX5H63t6CUAo QLRzoRMH2wHccmUGJ0S1ccwyArwnT/GRI/XxB7eY19DmJZnn5xfbrdADmheh0WgMslJ7 kYxAXUir9fIiUkte7sb8Wjtei3u89x7Ri9LEfLkh8KMKHj+tN5mFjSSa5ZJSH8LJZtL+ mnLQ== 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=cTXzOZnTsS4OmutN8lX+OXLYTYmDOp5vTyG83z9su5I3hlcWJF56zRZrkAi1r/iUQo XHtDfCR+cCXBRJzue/rBoRSWEXCLUNJ/a78OCv1l5NX/ArGNOtP7twJyZy8Jz6oYSSSh 6O9KzGMACC2t/iTI4cTse7TqAh+3TSKUo7abWPfEwH0sebEgpTMb6PAqtv0b1Sw1cux/ 0IToBzruTOh2GGQBrhDTPrZBFDfS+Bc0n9Mz+qBgQ8yMr5LAwxPL1g/4TbicSL8hUD50 X6hV7LivnqQRVaFzQHGRgzVWUMNEqCiOFngF9Y5fRQmrohINO6iwz1Q3saJVtC4KWvxW dAgg== X-Forwarded-Encrypted: i=1; AJvYcCU3bPhsUb9uFWURVc28jTNyXpXt3K+1PqHUUrgE5jrJL6a/Bbc4PgBD0tnqLcjVu22RnFiIsTQEJjvsvETFzB1etEYgT8VgTzCSNfQ= X-Gm-Message-State: AOJu0YwFlQiqnN7tDIafBe574nH4C9bDNnXdg0z2GCWMjM61Sd6VzJNY RS7iv61pN2KUygx0fSEU0hb4QBavgkn1few0IyXbvoKOQmti3LxWYXsJs8mxhEM= 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 Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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