]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: Use scoped guards for handle_hpd_irq_helper()
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 18 Feb 2025 04:58:39 +0000 (22:58 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Mar 2025 15:42:22 +0000 (10:42 -0500)
Scoped guards will release the mutex when they go out of scope.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index c73e194cb0275181061628c7cfc900974433dca9..4945f89bf2f6a4dc72bf4b7d4cc77259632de706 100644 (file)
@@ -3813,7 +3813,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
         * In case of failure or MST no need to update connector status or notify the OS
         * since (for MST case) MST does this in its own context.
         */
-       mutex_lock(&aconnector->hpd_lock);
+       guard(mutex)(&aconnector->hpd_lock);
 
        if (adev->dm.hdcp_workqueue) {
                hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index);
@@ -3837,10 +3837,10 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
                if (aconnector->base.force == DRM_FORCE_UNSPECIFIED)
                        drm_kms_helper_connector_hotplug_event(connector);
        } else {
-               mutex_lock(&adev->dm.dc_lock);
-               dc_exit_ips_for_hw_access(dc);
-               ret = dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
-               mutex_unlock(&adev->dm.dc_lock);
+               scoped_guard(mutex, &adev->dm.dc_lock) {
+                       dc_exit_ips_for_hw_access(dc);
+                       ret = dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
+               }
                if (ret) {
                        amdgpu_dm_update_connector_after_detect(aconnector);
 
@@ -3852,8 +3852,6 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
                                drm_kms_helper_connector_hotplug_event(connector);
                }
        }
-       mutex_unlock(&aconnector->hpd_lock);
-
 }
 
 static void handle_hpd_irq(void *param)