[PATCH] drm/atomic: debugfs atomic state should be removed too

2016-11-29 Thread Jyri Sarha
If atomic state file is not removed from debugfs it will prevent
atomic driver modules from reloading after unload when debugfs is
enabled.

Fixes commit 6559c901cb484 ("drm/atomic: add debugfs file to dump out
atomic state")

Signed-off-by: Jyri Sarha 
---
 drivers/gpu/drm/drm_atomic.c  | 6 ++
 drivers/gpu/drm/drm_debugfs.c | 2 ++
 include/drm/drm_atomic.h  | 1 +
 3 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index b476ec5..0db642a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1686,6 +1686,12 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
ARRAY_SIZE(drm_atomic_debugfs_list),
minor->debugfs_root, minor);
 }
+
+void drm_atomic_debugfs_fini(struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(drm_atomic_debugfs_list,
+   ARRAY_SIZE(drm_atomic_debugfs_list), minor);
+}
 #endif

 /*
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 206a4fe..68be42c 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -237,6 +237,8 @@ int drm_debugfs_cleanup(struct drm_minor *minor)

drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);

+   drm_atomic_debugfs_fini(minor);
+
debugfs_remove(minor->debugfs_root);
minor->debugfs_root = NULL;

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index c0eaec7..c8cec34 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -372,6 +372,7 @@ void drm_atomic_set_fence_for_plane(struct drm_plane_state 
*plane_state,
 #ifdef CONFIG_DEBUG_FS
 struct drm_minor;
 int drm_atomic_debugfs_init(struct drm_minor *minor);
+void drm_atomic_debugfs_fini(struct drm_minor *minor);
 #endif

 #define for_each_connector_in_state(__state, connector, connector_state, __i) \
-- 
1.9.1



[PATCH] drm/atomic: debugfs atomic state should be removed too

2016-11-29 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 10:19:10PM +0200, Jyri Sarha wrote:
> If atomic state file is not removed from debugfs it will prevent
> atomic driver modules from reloading after unload when debugfs is
> enabled.
> 
> Fixes commit 6559c901cb484 ("drm/atomic: add debugfs file to dump out
> atomic state")
> 
> Signed-off-by: Jyri Sarha 

We have one already:

commit 8c0b55e22aff84cb6938a993d86c3ce02006236e
Author: Liviu Dudau 
Date:   Thu Nov 17 11:41:29 2016 +

drm/atomic: cleanup debugfs entries on un-registering the driver.

Cheers, Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c  | 6 ++
>  drivers/gpu/drm/drm_debugfs.c | 2 ++
>  include/drm/drm_atomic.h  | 1 +
>  3 files changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index b476ec5..0db642a 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1686,6 +1686,12 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
>   ARRAY_SIZE(drm_atomic_debugfs_list),
>   minor->debugfs_root, minor);
>  }
> +
> +void drm_atomic_debugfs_fini(struct drm_minor *minor)
> +{
> + drm_debugfs_remove_files(drm_atomic_debugfs_list,
> + ARRAY_SIZE(drm_atomic_debugfs_list), minor);
> +}
>  #endif
>  
>  /*
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 206a4fe..68be42c 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -237,6 +237,8 @@ int drm_debugfs_cleanup(struct drm_minor *minor)
>  
>   drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
>  
> + drm_atomic_debugfs_fini(minor);
> +
>   debugfs_remove(minor->debugfs_root);
>   minor->debugfs_root = NULL;
>  
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index c0eaec7..c8cec34 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -372,6 +372,7 @@ void drm_atomic_set_fence_for_plane(struct 
> drm_plane_state *plane_state,
>  #ifdef CONFIG_DEBUG_FS
>  struct drm_minor;
>  int drm_atomic_debugfs_init(struct drm_minor *minor);
> +void drm_atomic_debugfs_fini(struct drm_minor *minor);
>  #endif
>  
>  #define for_each_connector_in_state(__state, connector, connector_state, 
> __i) \
> -- 
> 1.9.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch