Skip to content

Commit 603cc82

Browse files
Thomas ZimmermannMaarten Lankhorst
authored andcommitted
drm/client: Add client-hotplug helper
Move client hotplug calls to drm_client_hotplug(). We'll need this helper to send hotplug events after resuming. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Maarten Lankhorst <[email protected]>
1 parent d0a83b2 commit 603cc82

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

drivers/gpu/drm/drm_client_event.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ void drm_client_dev_unregister(struct drm_device *dev)
4949
}
5050
EXPORT_SYMBOL(drm_client_dev_unregister);
5151

52+
static void drm_client_hotplug(struct drm_client_dev *client)
53+
{
54+
struct drm_device *dev = client->dev;
55+
int ret;
56+
57+
if (!client->funcs || !client->funcs->hotplug)
58+
return;
59+
60+
if (client->hotplug_failed)
61+
return;
62+
63+
ret = client->funcs->hotplug(client);
64+
drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret);
65+
if (ret)
66+
client->hotplug_failed = true;
67+
}
68+
5269
/**
5370
* drm_client_dev_hotplug - Send hotplug event to clients
5471
* @dev: DRM device
@@ -61,7 +78,6 @@ EXPORT_SYMBOL(drm_client_dev_unregister);
6178
void drm_client_dev_hotplug(struct drm_device *dev)
6279
{
6380
struct drm_client_dev *client;
64-
int ret;
6581

6682
if (!drm_core_check_feature(dev, DRIVER_MODESET))
6783
return;
@@ -72,18 +88,8 @@ void drm_client_dev_hotplug(struct drm_device *dev)
7288
}
7389

7490
mutex_lock(&dev->clientlist_mutex);
75-
list_for_each_entry(client, &dev->clientlist, list) {
76-
if (!client->funcs || !client->funcs->hotplug)
77-
continue;
78-
79-
if (client->hotplug_failed)
80-
continue;
81-
82-
ret = client->funcs->hotplug(client);
83-
drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret);
84-
if (ret)
85-
client->hotplug_failed = true;
86-
}
91+
list_for_each_entry(client, &dev->clientlist, list)
92+
drm_client_hotplug(client);
8793
mutex_unlock(&dev->clientlist_mutex);
8894
}
8995
EXPORT_SYMBOL(drm_client_dev_hotplug);

0 commit comments

Comments
 (0)