From: Deepak R Varma <drv@mailo.com>
To: "Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: [PATCH 1/4] drm/amd/display: Use min()/max() macros in dcn_calc_math
Date: Sun, 15 Jan 2023 02:49:39 +0530 [thread overview]
Message-ID: <fd6e5bea063d2cfde8bde7d10a7309214acf9251.1673730293.git.drv@mailo.com> (raw)
In-Reply-To: <cover.1673730293.git.drv@mailo.com>
Use the standard min() / max() helper macros instead of direct variable
comparison using if/else blocks or ternary operator. Change identified
using minmax.cocci Coccinelle semantic patch.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
.../gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
index cac72413a097..81629f3715d3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
@@ -52,12 +52,12 @@ float dcn_bw_min2(const float arg1, const float arg2)
return arg2;
if (isNaN(arg2))
return arg1;
- return arg1 < arg2 ? arg1 : arg2;
+ return min(arg1, arg2);
}
unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
{
- return arg1 > arg2 ? arg1 : arg2;
+ return max(arg1, arg2);
}
float dcn_bw_max2(const float arg1, const float arg2)
{
@@ -65,7 +65,7 @@ float dcn_bw_max2(const float arg1, const float arg2)
return arg2;
if (isNaN(arg2))
return arg1;
- return arg1 > arg2 ? arg1 : arg2;
+ return max(arg1, arg2);
}
float dcn_bw_floor2(const float arg, const float significance)
@@ -93,12 +93,12 @@ float dcn_bw_ceil2(const float arg, const float significance)
float dcn_bw_max3(float v1, float v2, float v3)
{
- return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2);
+ return max(v3, dcn_bw_max2(v1, v2));
}
float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5)
{
- return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2, v3) : dcn_bw_max2(v4, v5);
+ return max(dcn_bw_max3(v1, v2, v3), dcn_bw_max2(v4, v5));
}
float dcn_bw_pow(float a, float exp)
--
2.34.1
WARNING: multiple messages have this Message-ID
From: Deepak R Varma <drv@mailo.com>
To: "Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: [PATCH 1/4] drm/amd/display: Use min()/max() macros in dcn_calc_math
Date: Sun, 15 Jan 2023 02:50:10 +0530 [thread overview]
Message-ID: <fd6e5bea063d2cfde8bde7d10a7309214acf9251.1673730293.git.drv@mailo.com> (raw)
Message-ID: <20230114212010.vLlASvG_oj597vARsfflymSOl_ZcFsnHCO3NM1zzChs@z> (raw)
In-Reply-To: <cover.1673730293.git.drv@mailo.com>
Use the standard min() / max() helper macros instead of direct variable
comparison using if/else blocks or ternary operator. Change identified
using minmax.cocci Coccinelle semantic patch.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
.../gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
index cac72413a097..81629f3715d3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calc_math.c
@@ -52,12 +52,12 @@ float dcn_bw_min2(const float arg1, const float arg2)
return arg2;
if (isNaN(arg2))
return arg1;
- return arg1 < arg2 ? arg1 : arg2;
+ return min(arg1, arg2);
}
unsigned int dcn_bw_max(const unsigned int arg1, const unsigned int arg2)
{
- return arg1 > arg2 ? arg1 : arg2;
+ return max(arg1, arg2);
}
float dcn_bw_max2(const float arg1, const float arg2)
{
@@ -65,7 +65,7 @@ float dcn_bw_max2(const float arg1, const float arg2)
return arg2;
if (isNaN(arg2))
return arg1;
- return arg1 > arg2 ? arg1 : arg2;
+ return max(arg1, arg2);
}
float dcn_bw_floor2(const float arg, const float significance)
@@ -93,12 +93,12 @@ float dcn_bw_ceil2(const float arg, const float significance)
float dcn_bw_max3(float v1, float v2, float v3)
{
- return v3 > dcn_bw_max2(v1, v2) ? v3 : dcn_bw_max2(v1, v2);
+ return max(v3, dcn_bw_max2(v1, v2));
}
float dcn_bw_max5(float v1, float v2, float v3, float v4, float v5)
{
- return dcn_bw_max3(v1, v2, v3) > dcn_bw_max2(v4, v5) ? dcn_bw_max3(v1, v2, v3) : dcn_bw_max2(v4, v5);
+ return max(dcn_bw_max3(v1, v2, v3), dcn_bw_max2(v4, v5));
}
float dcn_bw_pow(float a, float exp)
--
2.34.1
next prev parent reply other threads:[~2023-01-14 21:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-14 21:18 [PATCH 0/4] drm/amd/display: Use min()/max() helper macros Deepak R Varma
2023-01-14 21:19 ` Deepak R Varma [this message]
2023-01-14 21:20 ` [PATCH 1/4] drm/amd/display: Use min()/max() macros in dcn_calc_math Deepak R Varma
2023-01-14 21:20 ` [PATCH 2/4] drm/amd/display: dcn20: Use min()/max() helper macros Deepak R Varma
2023-01-14 21:21 ` [PATCH 3/4] drm/amd/display: dcn21: " Deepak R Varma
2023-01-14 21:21 ` [PATCH 4/4] drm/amd/display: dcn32: " Deepak R Varma
2023-01-22 18:45 ` [PATCH 0/4] drm/amd/display: " Deepak R Varma
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=fd6e5bea063d2cfde8bde7d10a7309214acf9251.1673730293.git.drv@mailo.com \
--to=drv@mailo.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ssengar@microsoft.com \
--cc=sunpeng.li@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®