* [PATCH] drm/amd/pm: make power values signed
@ 2023-11-09 8:41 José Pekkarinen
2023-11-10 8:25 ` Lazar, Lijo
0 siblings, 1 reply; 3+ messages in thread
From: José Pekkarinen @ 2023-11-09 8:41 UTC (permalink / raw)
To: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan, skhan
Cc: José Pekkarinen, airlied, daniel, jdelvare, linux, amd-gfx,
dri-devel, linux-kernel, linux-kernel-mentees
The following patch will convert the power values returned by
amdgpu_hwmon_get_power to signed, fixing the following warnings reported
by coccinelle:
drivers/gpu/drm/amd/pm/amdgpu_pm.c:2801:5-8: WARNING: Unsigned expression compared with zero: val < 0
drivers/gpu/drm/amd/pm/amdgpu_pm.c:2814:5-8: WARNING: Unsigned expression compared with zero: val < 0
Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
---
drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index e7bb1d324084..913ff62d5d5e 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -2795,7 +2795,7 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- unsigned int val;
+ int val;
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER);
@@ -2806,7 +2806,7 @@ static ssize_t amdgpu_hwmon_show_power_input(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- unsigned int val;
+ int val;
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER);
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/amd/pm: make power values signed
2023-11-09 8:41 [PATCH] drm/amd/pm: make power values signed José Pekkarinen
@ 2023-11-10 8:25 ` Lazar, Lijo
2023-11-10 11:27 ` José Pekkarinen
0 siblings, 1 reply; 3+ messages in thread
From: Lazar, Lijo @ 2023-11-10 8:25 UTC (permalink / raw)
To: José Pekkarinen, evan.quan, alexander.deucher,
christian.koenig, Xinhui.Pan, skhan
Cc: jdelvare, linux-kernel, amd-gfx, dri-devel, daniel, airlied,
linux, linux-kernel-mentees
On 11/9/2023 2:11 PM, José Pekkarinen wrote:
> The following patch will convert the power values returned by
> amdgpu_hwmon_get_power to signed, fixing the following warnings reported
> by coccinelle:
>
> drivers/gpu/drm/amd/pm/amdgpu_pm.c:2801:5-8: WARNING: Unsigned expression compared with zero: val < 0
> drivers/gpu/drm/amd/pm/amdgpu_pm.c:2814:5-8: WARNING: Unsigned expression compared with zero: val < 0
>
> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
> ---
> drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index e7bb1d324084..913ff62d5d5e 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -2795,7 +2795,7 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> {
> - unsigned int val;
> + int val;
Hi Alex,
It's a different code in drm-next.
https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/pm/amdgpu_pm.c#L2936
Thanks,
Lijo
>
> val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER);
>
> @@ -2806,7 +2806,7 @@ static ssize_t amdgpu_hwmon_show_power_input(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> {
> - unsigned int val;
> + int val;
>
> val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER);
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/amd/pm: make power values signed
2023-11-10 8:25 ` Lazar, Lijo
@ 2023-11-10 11:27 ` José Pekkarinen
0 siblings, 0 replies; 3+ messages in thread
From: José Pekkarinen @ 2023-11-10 11:27 UTC (permalink / raw)
To: Lazar, Lijo
Cc: evan.quan, alexander.deucher, christian.koenig, Xinhui.Pan, skhan,
jdelvare, linux-kernel, amd-gfx, dri-devel, daniel, airlied,
linux, linux-kernel-mentees
On 2023-11-10 10:25, Lazar, Lijo wrote:
> On 11/9/2023 2:11 PM, José Pekkarinen wrote:
>> The following patch will convert the power values returned by
>> amdgpu_hwmon_get_power to signed, fixing the following warnings
>> reported
>> by coccinelle:
>>
>> drivers/gpu/drm/amd/pm/amdgpu_pm.c:2801:5-8: WARNING: Unsigned
>> expression compared with zero: val < 0
>> drivers/gpu/drm/amd/pm/amdgpu_pm.c:2814:5-8: WARNING: Unsigned
>> expression compared with zero: val < 0
>>
>> Signed-off-by: José Pekkarinen <jose.pekkarinen@foxhound.fi>
>> ---
>> drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> index e7bb1d324084..913ff62d5d5e 100644
>> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> @@ -2795,7 +2795,7 @@ static ssize_t
>> amdgpu_hwmon_show_power_avg(struct device *dev,
>> struct device_attribute *attr,
>> char *buf)
>> {
>> - unsigned int val;
>> + int val;
>
> Hi Alex,
>
> It's a different code in drm-next.
>
> https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/pm/amdgpu_pm.c#L2936
I checked it, and ssize_t also removes the warning,
so you can stay with whatever is in the amd-staging-drm-next
tree and ignore this.
Thanks!
José.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-10 19:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 8:41 [PATCH] drm/amd/pm: make power values signed José Pekkarinen
2023-11-10 8:25 ` Lazar, Lijo
2023-11-10 11:27 ` José Pekkarinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox