]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: Use scoped guard for amdgpu_dm_update_connector_after_detect()
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 18 Feb 2025 04:58:37 +0000 (22:58 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Mar 2025 15:42:14 +0000 (10:42 -0500)
A scoped guard will release the mutex when it goes 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 4ad9178228d4cd34a1d8cbce5695a816e6362ea1..1b754c49896bdb0bb31e2dd5cc1ba2c49b932705 100644 (file)
@@ -3681,7 +3681,7 @@ void amdgpu_dm_update_connector_after_detect(
                 * For S3 resume with headless use eml_sink to fake stream
                 * because on resume connector->sink is set to NULL
                 */
-               mutex_lock(&dev->mode_config.mutex);
+               guard(mutex)(&dev->mode_config.mutex);
 
                if (sink) {
                        if (aconnector->dc_sink) {
@@ -3706,8 +3706,6 @@ void amdgpu_dm_update_connector_after_detect(
                        }
                }
 
-               mutex_unlock(&dev->mode_config.mutex);
-
                if (sink)
                        dc_sink_release(sink);
                return;
@@ -3737,7 +3735,7 @@ void amdgpu_dm_update_connector_after_detect(
        drm_dbg_kms(dev, "DCHPD: connector_id=%d: Old sink=%p New sink=%p\n",
                    aconnector->connector_id, aconnector->dc_sink, sink);
 
-       mutex_lock(&dev->mode_config.mutex);
+       guard(mutex)(&dev->mode_config.mutex);
 
        /*
         * 1. Update status of the drm connector
@@ -3799,8 +3797,6 @@ void amdgpu_dm_update_connector_after_detect(
                        connector->state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
        }
 
-       mutex_unlock(&dev->mode_config.mutex);
-
        update_subconnector_property(aconnector);
 
        if (sink)