]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/tegra: Store parent pointer in Tegra DRM clients
authorThierry Reding <treding@nvidia.com>
Fri, 1 Feb 2019 13:28:31 +0000 (14:28 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 7 Feb 2019 17:28:59 +0000 (18:28 +0100)
Tegra DRM clients need access to their parent, so store a pointer to it
upon registration. It's technically possible to get at this by going via
the host1x client's parent and getting the driver data, but that's quite
complicated and not very transparent. It's much more straightforward and
natural to let the children know about their parent.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h

index 4b70ce664c4185e36f8e173dfd43353eee404fa5..61dcbd218ffce20a1c87cd7acdf2a7cca3ff57fd 100644 (file)
@@ -1041,6 +1041,7 @@ int tegra_drm_register_client(struct tegra_drm *tegra,
 {
        mutex_lock(&tegra->clients_lock);
        list_add_tail(&client->list, &tegra->clients);
+       client->drm = tegra;
        mutex_unlock(&tegra->clients_lock);
 
        return 0;
@@ -1051,6 +1052,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
 {
        mutex_lock(&tegra->clients_lock);
        list_del_init(&client->list);
+       client->drm = NULL;
        mutex_unlock(&tegra->clients_lock);
 
        return 0;
index f1763b4d5b5fb0aba7613c2a2ec418ec7037e10f..2c809755bca7f964f22254811eb1a0931d084fb6 100644 (file)
@@ -88,6 +88,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 struct tegra_drm_client {
        struct host1x_client base;
        struct list_head list;
+       struct tegra_drm *drm;
 
        unsigned int version;
        const struct tegra_drm_client_ops *ops;