Hans de Goede ceb4a5619c drm/amd/display/amdgpu_dm: Refactor register_backlight_device()
Refactor register_backlight_device():

1) Turn the connector-type + signal check into an early exit
condition to avoid the indentation level of the rest of the code

2) Add an array bounds check for the arrays indexed by dm->num_of_edps

3) register_backlight_device() always increases dm->num_of_edps if
amdgpu_dm_register_backlight_device() has assigned a backlight_dev to
the current dm->backlight_link[dm->num_of_edps] slot.

So on its next call dm->backlight_dev[dm->num_of_edps] always point to
the next empty slot and the "if (!dm->backlight_dev[dm->num_of_edps])"
check will thus always succeed and can be removed.

4) Add a bl_idx local variable to use as array index, rather then
using dm->num_of_edps to improve the code readability.

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>
2023-03-22 00:47:59 -04:00
..
2023-01-24 17:36:29 +01:00
2023-03-14 17:07:48 +01:00
2023-02-22 18:28:03 -08:00
2023-03-14 17:07:48 +01:00
2023-03-14 17:07:48 +01:00
2023-02-24 13:40:13 -08:00
2023-03-14 17:07:49 +01:00
2023-02-10 08:21:04 -03:00
2023-02-22 18:28:03 -08:00
2023-01-04 14:59:25 +01:00
2023-02-24 12:58:55 -08:00
2023-02-20 14:56:52 +01:00
2022-12-16 03:54:54 -08:00