2021-09-17 06:51:11

by Fernando Ramos

[permalink] [raw]
Subject: [PATCH 02/15] dmr/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()

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 <[email protected]>
---
drivers/gpu/drm/i915/display/intel_display.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 134a6acbd8fb..997a16e85c85 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -13476,22 +13476,13 @@ void intel_display_resume(struct drm_device *dev)
if (state)
state->acquire_ctx = &ctx;

- drm_modeset_acquire_init(&ctx, 0);
-
- while (1) {
- ret = drm_modeset_lock_all_ctx(dev, &ctx);
- if (ret != -EDEADLK)
- break;
-
- drm_modeset_backoff(&ctx);
- }
+ DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);

- if (!ret)
- ret = __intel_display_resume(dev, state, &ctx);
+ ret = __intel_display_resume(dev, state, &ctx);

intel_enable_ipc(dev_priv);
- drm_modeset_drop_locks(&ctx);
- drm_modeset_acquire_fini(&ctx);
+
+ DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);

if (ret)
drm_err(&dev_priv->drm,
--
2.33.0


2021-09-17 23:37:07

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH 02/15] dmr/i915: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()

On Thu, Sep 16, 2021 at 11:15:39PM +0200, Fernando Ramos wrote:
> 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()
>

With the subject fixed (s/dmr/drm),

Reviewed-by: Sean Paul <[email protected]>

> Signed-off-by: Fernando Ramos <[email protected]>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 134a6acbd8fb..997a16e85c85 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -13476,22 +13476,13 @@ void intel_display_resume(struct drm_device *dev)
> if (state)
> state->acquire_ctx = &ctx;
>
> - drm_modeset_acquire_init(&ctx, 0);
> -
> - while (1) {
> - ret = drm_modeset_lock_all_ctx(dev, &ctx);
> - if (ret != -EDEADLK)
> - break;
> -
> - drm_modeset_backoff(&ctx);
> - }
> + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
>
> - if (!ret)
> - ret = __intel_display_resume(dev, state, &ctx);
> + ret = __intel_display_resume(dev, state, &ctx);
>
> intel_enable_ipc(dev_priv);
> - drm_modeset_drop_locks(&ctx);
> - drm_modeset_acquire_fini(&ctx);
> +
> + DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
>
> if (ret)
> drm_err(&dev_priv->drm,
> --
> 2.33.0
>

--
Sean Paul, Software Engineer, Google / Chromium OS