All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Guo Zhengkui <guozhengkui@vivo.com>,
	Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT" 
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT" 
	<linux-media@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Cc: zhengkui_guo@outlook.com
Subject: Re: [PATCH] media: platform: replace ternary operator with max()
Date: Wed, 18 May 2022 11:54:17 +0200	[thread overview]
Message-ID: <1761ab1a-68ce-4946-24d4-8f4f9575e735@xs4all.nl> (raw)
In-Reply-To: <20220513133255.58600-1-guozhengkui@vivo.com>

Hi Guo Zhengkui,

Please mention the driver in the subject line! Saying 'media: platform:' suggests
changes throughout many media/platform drivers, but this is just for a single
driver.

Regards,

	Hans

On 5/13/22 15:32, Guo Zhengkui wrote:
> Fix the following coccicheck warning:
> 
> drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c:1712:24-25:
> WARNING opportunity for max()
> 
> max() macro is defined in include/linux/minmax.h. It avoids multiple
> evaluations of the arguments when non-constant and performs strict
> type-checking.
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> index 456287186ad8..55814041b8d8 100644
> --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> @@ -1709,7 +1709,7 @@ static int exynos3250_jpeg_try_downscale(struct s5p_jpeg_ctx *ctx,
>  	w_ratio = ctx->out_q.w / r->width;
>  	h_ratio = ctx->out_q.h / r->height;
>  
> -	scale_factor = w_ratio > h_ratio ? w_ratio : h_ratio;
> +	scale_factor = max(w_ratio, h_ratio);
>  	scale_factor = clamp_val(scale_factor, 1, 8);
>  
>  	/* Align scale ratio to the nearest power of 2 */

WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Guo Zhengkui <guozhengkui@vivo.com>,
	Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT"
	<linux-media@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Cc: zhengkui_guo@outlook.com
Subject: Re: [PATCH] media: platform: replace ternary operator with max()
Date: Wed, 18 May 2022 11:54:17 +0200	[thread overview]
Message-ID: <1761ab1a-68ce-4946-24d4-8f4f9575e735@xs4all.nl> (raw)
In-Reply-To: <20220513133255.58600-1-guozhengkui@vivo.com>

Hi Guo Zhengkui,

Please mention the driver in the subject line! Saying 'media: platform:' suggests
changes throughout many media/platform drivers, but this is just for a single
driver.

Regards,

	Hans

On 5/13/22 15:32, Guo Zhengkui wrote:
> Fix the following coccicheck warning:
> 
> drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c:1712:24-25:
> WARNING opportunity for max()
> 
> max() macro is defined in include/linux/minmax.h. It avoids multiple
> evaluations of the arguments when non-constant and performs strict
> type-checking.
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> index 456287186ad8..55814041b8d8 100644
> --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> @@ -1709,7 +1709,7 @@ static int exynos3250_jpeg_try_downscale(struct s5p_jpeg_ctx *ctx,
>  	w_ratio = ctx->out_q.w / r->width;
>  	h_ratio = ctx->out_q.h / r->height;
>  
> -	scale_factor = w_ratio > h_ratio ? w_ratio : h_ratio;
> +	scale_factor = max(w_ratio, h_ratio);
>  	scale_factor = clamp_val(scale_factor, 1, 8);
>  
>  	/* Align scale ratio to the nearest power of 2 */

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-18  9:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 13:32 [PATCH] media: platform: replace ternary operator with max() Guo Zhengkui
2022-05-13 13:32 ` Guo Zhengkui
2022-05-18  9:54 ` Hans Verkuil [this message]
2022-05-18  9:54   ` Hans Verkuil
2022-05-18 12:08   ` [PATCH v2] media: platform: samsung: s5p-jpeg: " Guo Zhengkui
2022-05-18 12:08     ` Guo Zhengkui
2022-05-27  9:28     ` Andrzej Pietrasiewicz
2022-05-27  9:28       ` Andrzej Pietrasiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1761ab1a-68ce-4946-24d4-8f4f9575e735@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=andrzejtp2010@gmail.com \
    --cc=guozhengkui@vivo.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=zhengkui_guo@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.