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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA588C433F5 for ; Wed, 18 May 2022 09:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234744AbiERJy3 (ORCPT ); Wed, 18 May 2022 05:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234741AbiERJyZ (ORCPT ); Wed, 18 May 2022 05:54:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27DC956239; Wed, 18 May 2022 02:54:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6D9BB81EF2; Wed, 18 May 2022 09:54:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 020A0C385A5; Wed, 18 May 2022 09:54:18 +0000 (UTC) Message-ID: <1761ab1a-68ce-4946-24d4-8f4f9575e735@xs4all.nl> Date: Wed, 18 May 2022 11:54:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] media: platform: replace ternary operator with max() Content-Language: en-US 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@outlook.com References: <20220513133255.58600-1-guozhengkui@vivo.com> From: Hans Verkuil In-Reply-To: <20220513133255.58600-1-guozhengkui@vivo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 */ 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 C6ABAC433F5 for ; Wed, 18 May 2022 09:55:27 +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-Transfer-Encoding:Content-Type: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=SxtTAcMC7Td/eZXlnc/5SV2qKK5inuZA+THnX7sjdQE=; b=fbNjqEBqK7zY+r kZ5014vN5ahjU+7YfC5qQbsGiJKqa7KJ/Ccrpbvg9OPYeSpb4j5okh6SR925bESqs1dBHaemSXHmU 7AhfXNeZPY3TUYE1T1kq6bVHvVxyoxgEo+no1/OBCiZp/4QNtfPIfDaoSI8gzdXo5jlrbp/JKwf7F aI74Qerkh1XOkKsxVcOxruML5898G/Pdh/ytoYJY+IWZ71VUtSluubhmWor+vl04QiZDpyR7uid2l 7p7OcpNTKr4KmavKgL02OeY0FkbxjAd+5Sc5UPuEhwpYr/NYnsKeUzM63pARcpfa/FZG09Vy+igf0 n28YX2vY4EiBxvwyTKEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrGNu-001CiZ-UW; Wed, 18 May 2022 09:54:27 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrGNr-001ChQ-8o for linux-arm-kernel@lists.infradead.org; Wed, 18 May 2022 09:54:24 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E53B7B81EF8; Wed, 18 May 2022 09:54:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 020A0C385A5; Wed, 18 May 2022 09:54:18 +0000 (UTC) Message-ID: <1761ab1a-68ce-4946-24d4-8f4f9575e735@xs4all.nl> Date: Wed, 18 May 2022 11:54:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] media: platform: replace ternary operator with max() Content-Language: en-US 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@outlook.com References: <20220513133255.58600-1-guozhengkui@vivo.com> From: Hans Verkuil In-Reply-To: <20220513133255.58600-1-guozhengkui@vivo.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220518_025423_477481_C65B0F3A X-CRM114-Status: GOOD ( 18.14 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > 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