All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: platform: replace ternary operator with max()
@ 2022-05-13 13:32 ` Guo Zhengkui
  0 siblings, 0 replies; 8+ messages in thread
From: Guo Zhengkui @ 2022-05-13 13:32 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo, Guo Zhengkui

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 */
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] media: platform: replace ternary operator with max()
@ 2022-05-13 13:32 ` Guo Zhengkui
  0 siblings, 0 replies; 8+ messages in thread
From: Guo Zhengkui @ 2022-05-13 13:32 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo, Guo Zhengkui

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 */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] media: platform: replace ternary operator with max()
  2022-05-13 13:32 ` Guo Zhengkui
@ 2022-05-18  9:54   ` Hans Verkuil
  -1 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2022-05-18  9:54 UTC (permalink / raw)
  To: Guo Zhengkui, Andrzej Pietrasiewicz, Jacek Anaszewski,
	Sylwester Nawrocki, Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo

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 */

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] media: platform: replace ternary operator with max()
@ 2022-05-18  9:54   ` Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2022-05-18  9:54 UTC (permalink / raw)
  To: Guo Zhengkui, Andrzej Pietrasiewicz, Jacek Anaszewski,
	Sylwester Nawrocki, Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] media: platform: samsung: s5p-jpeg: replace ternary operator with max()
  2022-05-18  9:54   ` Hans Verkuil
@ 2022-05-18 12:08     ` Guo Zhengkui
  -1 siblings, 0 replies; 8+ messages in thread
From: Guo Zhengkui @ 2022-05-18 12:08 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo, Guo Zhengkui

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>
---
v1 -> v2: Change the subject according to Hans Verkuil's suggestion.

 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 */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2] media: platform: samsung: s5p-jpeg: replace ternary operator with max()
@ 2022-05-18 12:08     ` Guo Zhengkui
  0 siblings, 0 replies; 8+ messages in thread
From: Guo Zhengkui @ 2022-05-18 12:08 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo, Guo Zhengkui

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>
---
v1 -> v2: Change the subject according to Hans Verkuil's suggestion.

 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 */
-- 
2.20.1


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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] media: platform: samsung: s5p-jpeg: replace ternary operator with max()
  2022-05-18 12:08     ` Guo Zhengkui
@ 2022-05-27  9:28       ` Andrzej Pietrasiewicz
  -1 siblings, 0 replies; 8+ messages in thread
From: Andrzej Pietrasiewicz @ 2022-05-27  9:28 UTC (permalink / raw)
  To: Guo Zhengkui, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo

Hi Guo Zhengkui,

Sorry about the delay.

W dniu 18.05.2022 o 14:08, Guo Zhengkui pisze:
> 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>

Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>

> ---
> v1 -> v2: Change the subject according to Hans Verkuil's suggestion.
> 
>   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 */

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] media: platform: samsung: s5p-jpeg: replace ternary operator with max()
@ 2022-05-27  9:28       ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 8+ messages in thread
From: Andrzej Pietrasiewicz @ 2022-05-27  9:28 UTC (permalink / raw)
  To: Guo Zhengkui, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab,
	moderated list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT,
	open list:ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT, open list
  Cc: zhengkui_guo

Hi Guo Zhengkui,

Sorry about the delay.

W dniu 18.05.2022 o 14:08, Guo Zhengkui pisze:
> 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>

Acked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>

> ---
> v1 -> v2: Change the subject according to Hans Verkuil's suggestion.
> 
>   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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-27  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.