Re: [PATCH v3 10/16] drm/tegra: Store parent pointer in Tegra DRM clients

2019-02-01 Thread Dmitry Osipenko
01.02.2019 16:28, Thierry Reding пишет:
> From: Thierry Reding 
> 
> 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 
> Reviewed-by: Dmitry Osipenko 
> ---
>  drivers/gpu/drm/tegra/drm.c | 2 ++
>  drivers/gpu/drm/tegra/drm.h | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 4b70ce664c41..61dcbd218ffc 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -1041,6 +1041,7 @@ int tegra_drm_register_client(struct tegra_drm *tegra,
>  {
>   mutex_lock(>clients_lock);
>   list_add_tail(>list, >clients);
> + client->drm = tegra;
>   mutex_unlock(>clients_lock);
>  
>   return 0;
> @@ -1051,6 +1052,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
>  {
>   mutex_lock(>clients_lock);
>   list_del_init(>list);
> + client->drm = NULL;
>   mutex_unlock(>clients_lock);
>  
>   return 0;
> diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
> index 7370f7a0fdb8..70154c253d45 100644
> --- a/drivers/gpu/drm/tegra/drm.h
> +++ b/drivers/gpu/drm/tegra/drm.h
> @@ -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;
> 

Reviewed-by: Dmitry Osipenko 
Tested-by: Dmitry Osipenko 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 10/16] drm/tegra: Store parent pointer in Tegra DRM clients

2019-02-01 Thread Thierry Reding
From: Thierry Reding 

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 
Reviewed-by: Dmitry Osipenko 
---
 drivers/gpu/drm/tegra/drm.c | 2 ++
 drivers/gpu/drm/tegra/drm.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 4b70ce664c41..61dcbd218ffc 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1041,6 +1041,7 @@ int tegra_drm_register_client(struct tegra_drm *tegra,
 {
mutex_lock(>clients_lock);
list_add_tail(>list, >clients);
+   client->drm = tegra;
mutex_unlock(>clients_lock);
 
return 0;
@@ -1051,6 +1052,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
 {
mutex_lock(>clients_lock);
list_del_init(>list);
+   client->drm = NULL;
mutex_unlock(>clients_lock);
 
return 0;
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 7370f7a0fdb8..70154c253d45 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -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;
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel