Skip to content

Commit

Permalink
drm: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEG…
Browse files Browse the repository at this point in the history
…IN()

As requested in Documentation/gpu/todo.rst, replace the boilerplate code
surrounding drm_modeset_lock_all_ctx() with DRM_MODESET_LOCK_ALL_BEGIN()
and DRM_MODESET_LOCK_ALL_END()

Signed-off-by: Fernando Ramos <greenfoo@u92.eu>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210924064324.229457-2-greenfoo@u92.eu
  • Loading branch information
Fernando Ramos authored and Sean Paul committed Oct 1, 2021
1 parent 4bb2d36 commit 21dde40
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/gpu/drm/drm_client_modeset.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
int num_connectors_detected = 0;
int num_tiled_conns = 0;
struct drm_modeset_acquire_ctx ctx;
int err;

if (!drm_drv_uses_atomic_modeset(dev))
return false;
Expand All @@ -585,10 +586,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
if (!save_enabled)
return false;

drm_modeset_acquire_init(&ctx, 0);

while (drm_modeset_lock_all_ctx(dev, &ctx) != 0)
drm_modeset_backoff(&ctx);
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);

memcpy(save_enabled, enabled, count);
mask = GENMASK(count - 1, 0);
Expand Down Expand Up @@ -743,8 +741,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
ret = false;
}

drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
DRM_MODESET_LOCK_ALL_END(dev, ctx, err);

kfree(save_enabled);
return ret;
Expand Down

0 comments on commit 21dde40

Please sign in to comment.