RE: [PATCH 38/38] drm/radeon: simplify boot level calculation

From: Deucher, Alexander
Date: Mon Oct 26 2015 - 12:29:16 EST


> -----Original Message-----
> From: Andrzej Hajda [mailto:a.hajda@xxxxxxxxxxx]
> Sent: Monday, September 21, 2015 9:34 AM
> To: linux-kernel@xxxxxxxxxxxxxxx
> Cc: Andrzej Hajda; Bartlomiej Zolnierkiewicz; Marek Szyprowski; David Airlie;
> Deucher, Alexander; Koenig, Christian; dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Subject: [PATCH 38/38] drm/radeon: simplify boot level calculation
>
> The patch simplifies the code without changing behaviour, but most
> problably there is a bug somewhere else.

I'd prefer the leave the code as is in case we ever add ACP support to these asics.

Thanks,

Alex

>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
>
> Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 11 +----------
> drivers/gpu/drm/radeon/kv_dpm.c | 11 +----------
> 2 files changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
> b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
> index 94ec04a..f9cfc56 100644
> --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
> @@ -1622,19 +1622,10 @@ static int kv_update_samu_dpm(struct
> amdgpu_device *adev, bool gate)
>
> static u8 kv_get_acp_boot_level(struct amdgpu_device *adev)
> {
> - u8 i;
> struct amdgpu_clock_voltage_dependency_table *table =
> &adev-
> >pm.dpm.dyn_state.acp_clock_voltage_dependency_table;
>
> - for (i = 0; i < table->count; i++) {
> - if (table->entries[i].clk >= 0) /* XXX */
> - break;
> - }
> -
> - if (i >= table->count)
> - i = table->count - 1;
> -
> - return i;
> + return table->count ? 0 : -1;
> }
>
> static void kv_update_acp_boot_level(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/radeon/kv_dpm.c
> b/drivers/gpu/drm/radeon/kv_dpm.c
> index 2d71da4..dc9aab5 100644
> --- a/drivers/gpu/drm/radeon/kv_dpm.c
> +++ b/drivers/gpu/drm/radeon/kv_dpm.c
> @@ -1546,19 +1546,10 @@ static int kv_update_samu_dpm(struct
> radeon_device *rdev, bool gate)
>
> static u8 kv_get_acp_boot_level(struct radeon_device *rdev)
> {
> - u8 i;
> struct radeon_clock_voltage_dependency_table *table =
> &rdev-
> >pm.dpm.dyn_state.acp_clock_voltage_dependency_table;
>
> - for (i = 0; i < table->count; i++) {
> - if (table->entries[i].clk >= 0) /* XXX */
> - break;
> - }
> -
> - if (i >= table->count)
> - i = table->count - 1;
> -
> - return i;
> + return table->count ? 0 : -1;
> }
>
> static void kv_update_acp_boot_level(struct radeon_device *rdev)
> --
> 1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/