mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wangkailong@jari.cn
To: airlied@gmail.com, daniel@ffwll.ch, evan.quan@amd.com,
	alexander.deucher@amd.com, christian.koenig@amd.com,
	Xinhui.Pan@amd.com
Cc: darren.powell@amd.com, aleksei.kodanev@bell-sw.com,
	tangmeng@uniontech.com, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amd/pm: replace ternary operator with max()
Date: Sat, 29 Oct 2022 23:31:43 +0800 (GMT+08:00)	[thread overview]
Message-ID: <3b1eb0d7.3f.184245eccc6.Coremail.wangkailong@jari.cn> (raw)

Fix the following coccicheck warning:
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:348:85-86:
WARNING opportunity for max()
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:351:52-53:
WARNING opportunity for max()

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index c8c9fb827bda..35677c13ddf9 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
@@ -345,12 +345,8 @@ static int vega10_odn_initial_default_setting(struct pp_hwmgr *hwmgr)
 		odn_table->min_vddc = dep_table[0]->entries[0].vddc;
 
 	i = od_table[2]->count - 1;
-	od_table[2]->entries[i].clk = hwmgr->platform_descriptor.overdriveLimit.memoryClock > od_table[2]->entries[i].clk ?
-					hwmgr->platform_descriptor.overdriveLimit.memoryClock :
-					od_table[2]->entries[i].clk;
-	od_table[2]->entries[i].vddc = odn_table->max_vddc > od_table[2]->entries[i].vddc ?
-					odn_table->max_vddc :
-					od_table[2]->entries[i].vddc;
+	od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock, od_table[2]->entries[i].clk);
+	od_table[2]->entries[i].vddc = max(odn_table->max_vddc, od_table[2]->entries[i].vddc);
 
 	return 0;
 }
-- 
2.25.1

             reply	other threads:[~2022-10-29 15:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 15:31 wangkailong [this message]
2022-10-30  4:03 ` kernel test robot

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=3b1eb0d7.3f.184245eccc6.Coremail.wangkailong@jari.cn \
    --to=wangkailong@jari.cn \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=aleksei.kodanev@bell-sw.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=darren.powell@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tangmeng@uniontech.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®