[PATCH v4 3/3] drm/amd/display: make dc_set_power_state() return type `void` again
Alex Deucher
alexdeucher at gmail.com
Thu Oct 5 14:28:32 UTC 2023
On Wed, Oct 4, 2023 at 1:27 PM Mario Limonciello
<mario.limonciello at amd.com> wrote:
>
> As dc_set_power_state() no longer allocates memory, it's not necessary
> to have return types and check return code as it can't fail anymore.
>
> Change it back to `void`.
>
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++------------
> drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++----
> drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
> 3 files changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index a59a11ae42db..df9d9437f149 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2685,11 +2685,6 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
> }
> }
>
> -static int dm_set_power_state(struct dc *dc, enum dc_acpi_cm_power_state power_state)
> -{
> - return dc_set_power_state(dc, power_state) ? 0 : -ENOMEM;
> -}
> -
> static int dm_suspend(void *handle)
> {
> struct amdgpu_device *adev = handle;
> @@ -2723,7 +2718,9 @@ static int dm_suspend(void *handle)
>
> hpd_rx_irq_work_suspend(dm);
>
> - return dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
> + dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
> +
> + return 0;
> }
>
> struct drm_connector *
> @@ -2917,9 +2914,7 @@ static int dm_resume(void *handle)
> if (r)
> DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r);
>
> - r = dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
> - if (r)
> - return r;
> + dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
>
> dc_resume(dm->dc);
>
> @@ -2969,9 +2964,7 @@ static int dm_resume(void *handle)
> }
>
> /* power on hardware */
> - r = dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
> - if (r)
> - return r;
> + dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
>
> /* program HPD filter */
> dc_resume(dm->dc);
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index cb8c7c5a8807..2645d59dc58e 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -4724,12 +4724,12 @@ void dc_power_down_on_boot(struct dc *dc)
> dc->hwss.power_down_on_boot(dc);
> }
>
> -bool dc_set_power_state(
> +void dc_set_power_state(
> struct dc *dc,
> enum dc_acpi_cm_power_state power_state)
> {
> if (!dc->current_state)
> - return true;
> + return;
>
> switch (power_state) {
> case DC_ACPI_CM_POWER_STATE_D0:
> @@ -4752,8 +4752,6 @@ bool dc_set_power_state(
>
> break;
> }
> -
> - return true;
> }
>
> void dc_resume(struct dc *dc)
> diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
> index b140eb240ad7..b6002b11a745 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc.h
> +++ b/drivers/gpu/drm/amd/display/dc/dc.h
> @@ -2330,7 +2330,7 @@ void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bo
>
> /* Power Interfaces */
>
> -bool dc_set_power_state(
> +void dc_set_power_state(
> struct dc *dc,
> enum dc_acpi_cm_power_state power_state);
> void dc_resume(struct dc *dc);
> --
> 2.34.1
>
More information about the amd-gfx
mailing list