From: Mario Limonciello <mario.limonciello@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v3 2/3] drm/amd/pm: Adjust returns when power_profile_mode is not supported
Date: Mon, 1 Nov 2021 16:28:47 -0500 [thread overview]
Message-ID: <20211101212848.20449-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20211101212848.20449-1-mario.limonciello@amd.com>
This better aligns that the caller can make a mistake with the buffer
and -EINVAL should be returned, but if the hardware doesn't support
the feature it should be -EOPNOTSUPP.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Changes from v2->v3:
* New patch
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index 978007664e71..79e565121206 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -877,7 +877,9 @@ static int pp_get_power_profile_mode(void *handle, char *buf)
struct pp_hwmgr *hwmgr = handle;
int ret;
- if (!hwmgr || !hwmgr->pm_en || !buf)
+ if (!hwmgr || !hwmgr->pm_en)
+ return -EOPNOTSUPP;
+ if (!buf)
return -EINVAL;
if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) {
@@ -894,7 +896,7 @@ static int pp_get_power_profile_mode(void *handle, char *buf)
static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
{
struct pp_hwmgr *hwmgr = handle;
- int ret = -EINVAL;
+ int ret = -EOPNOTSUPP;
if (!hwmgr || !hwmgr->pm_en)
return ret;
@@ -906,7 +908,7 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {
pr_debug("power profile setting is for manual dpm mode only.\n");
- return ret;
+ return -EINVAL;
}
mutex_lock(&hwmgr->smu_lock);
--
2.25.1
next prev parent reply other threads:[~2021-11-01 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 21:28 [PATCH v3 1/3] drm/amd/pm: Add missing mutex for pp_get_power_profile_mode Mario Limonciello
2021-11-01 21:28 ` Mario Limonciello [this message]
2021-11-01 21:28 ` [PATCH v3 3/3] drm/amdgpu/pm: Don't show pp_power_profile_mode for unsupported devices Mario Limonciello
2021-11-02 8:17 ` Lazar, Lijo
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=20211101212848.20449-2-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/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