drm/amd/display/amdgpu_dm: Add a bl_idx to amdgpu_dm_connector
authorHans de Goede <hdegoede@redhat.com>
Sun, 12 Mar 2023 19:17:48 +0000 (20:17 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 31 Mar 2023 15:06:41 +0000 (11:06 -0400)
commitf196198cafb8f0f2bedf1d8abc755f791fc03648
treec7c393358d2c6c9d682eae46f8a8b5d9945324ea
parent0e909e4fa8895bcef1b1ef2e39b9f1a158933ffe
drm/amd/display/amdgpu_dm: Add a bl_idx to amdgpu_dm_connector

Currently functions like update_connector_ext_caps() and
amdgpu_dm_connector_destroy() are iterating over dm->backlight_link[i]
to find the index of the (optional) backlight_dev associated with
the connector.

Instead make register_backlight_device() store the dm->backlight_dev[]
index used for the connector inside the amdgpu_dm_connector struct.

This removes the need to iterate over the dm->backlight_link[]
array and this is necessary as a preparation patch for moving
the actual backlight_device_register()
call to drm_connector_funcs.late_register.

While reworking update_connector_ext_caps() also remove the aconnector
and aconnector->dc_link NULL checks in this function. These are both
never NULL and are unconditionally derefed in its callers.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h