From: Thomas Zimmermann Date: Thu, 12 Dec 2024 17:08:44 +0000 (+0100) Subject: drm/client: Send pending hotplug events after resume X-Git-Tag: v6.15-rc1~120^2~9^2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a93247b58d04750a5d8dff922053d8d7ad6e8917;p=thirdparty%2Flinux.git drm/client: Send pending hotplug events after resume If a hotplug event arrives while the client has been suspended, DRM's client code will deliver the event after resuming. The functionality has been taken form i915, where it can be removed by a later commit. Signed-off-by: Thomas Zimmermann Reviewed-by: Maarten Lankhorst Link: https://patchwork.freedesktop.org/patch/msgid/20241212170913.185939-4-tzimmermann@suse.de Signed-off-by: Maarten Lankhorst --- diff --git a/drivers/gpu/drm/drm_client_event.c b/drivers/gpu/drm/drm_client_event.c index 8514df4a2e65a..bd93cd93d5190 100644 --- a/drivers/gpu/drm/drm_client_event.c +++ b/drivers/gpu/drm/drm_client_event.c @@ -60,6 +60,12 @@ static void drm_client_hotplug(struct drm_client_dev *client) if (client->hotplug_failed) return; + if (client->suspended) { + client->hotplug_pending = true; + return; + } + + client->hotplug_pending = false; ret = client->funcs->hotplug(client); drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); if (ret) @@ -159,6 +165,9 @@ static int drm_client_resume(struct drm_client_dev *client, bool holds_console_l client->suspended = false; + if (client->hotplug_pending) + drm_client_hotplug(client); + return ret; } diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 3b13cf29ed55c..146ca80e35db6 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -142,6 +142,14 @@ struct drm_client_dev { */ bool suspended; + /** + * @hotplug_pending: + * + * A hotplug event has been received while the client was suspended. + * Try again on resume. + */ + bool hotplug_pending; + /** * @hotplug_failed: *