Skip to contentSkip to conversation

drm: debugfs: Remove all files automatically on cleanup part 2

PATCH In review Noralf Trønnes 3 participants 9 messages Mar 7, 2017 – Mar 8, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover drm: debugfs: Remove all files automatically on cleanup part 2

This is a follow up that removes the drm_driver.debugfs_cleanup callback.

Tegra is the only remaining user of drm_debugfs_remove_files().

Note:
Patches are only compile tested.

Noralf.

Noralf Trønnes (3):
drm/msm: Remove msm_debugfs_cleanup() drm/debugfs: Remove the drm_driver.debugfs_cleanup callback drm/qxl: Remove qxl_debugfs_remove_files()

 drivers/gpu/drm/drm_debugfs.c     |  5 -----
 drivers/gpu/drm/msm/msm_debugfs.c | 15 ---------------
 drivers/gpu/drm/msm/msm_debugfs.h |  1 -
 drivers/gpu/drm/msm/msm_drv.c     |  4 +++-
 drivers/gpu/drm/msm/msm_drv.h     |  4 ++--
 drivers/gpu/drm/msm/msm_kms.h     |  1 -
 drivers/gpu/drm/msm/msm_perf.c    |  5 ++---
 drivers/gpu/drm/msm/msm_rd.c      |  5 ++---
 drivers/gpu/drm/qxl/qxl_debugfs.c | 13 -------------
 drivers/gpu/drm/qxl/qxl_drv.h     |  1 -
 drivers/gpu/drm/qxl/qxl_kms.c     |  1 -
 include/drm/drm_drv.h             |  1 -
 12 files changed, 9 insertions(+), 47 deletions(-)

--
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH 1/3 drm/msm: Remove msm_debugfs_cleanup()

Move the contents of msm_debugfs_cleanup() to msm_drm_uninit() to free up the drm_driver->debugfs_cleanup callback. Also remove the mdp_kms_funcs->debugfs_cleanup callback which has no users.

---
 drivers/gpu/drm/msm/msm_debugfs.c | 15 ---------------
 drivers/gpu/drm/msm/msm_debugfs.h |  1 -
 drivers/gpu/drm/msm/msm_drv.c     |  4 +++-
 drivers/gpu/drm/msm/msm_drv.h     |  4 ++--
 drivers/gpu/drm/msm/msm_kms.h     |  1 -
 drivers/gpu/drm/msm/msm_perf.c    |  5 ++---
 drivers/gpu/drm/msm/msm_rd.c      |  5 ++---
 7 files changed, 9 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/msm_debugfs.c +0 -15
index e754429..1855182 100644
@@ -166,20 +166,5 @@ int msm_debugfs_init(struct drm_minor *minor)
 
 	return ret;
 }
-
-void msm_debugfs_cleanup(struct drm_minor *minor)
-{
-	struct drm_device *dev = minor->dev;
-	struct msm_drm_private *priv = dev->dev_private;
-
-	if (!priv)
-		return;
-
-	if (priv->kms->funcs->debugfs_cleanup)
-		priv->kms->funcs->debugfs_cleanup(priv->kms, minor);
-
-	msm_rd_debugfs_cleanup(minor);
-	msm_perf_debugfs_cleanup(minor);
-}
 #endif
 
drivers/gpu/drm/msm/msm_debugfs.h +0 -1
index 6110c97..f4077e3 100644
@@ -20,7 +20,6 @@
 
 #ifdef CONFIG_DEBUG_FS
 int msm_debugfs_init(struct drm_minor *minor);
-void msm_debugfs_cleanup(struct drm_minor *minor);
 #endif
 
 #endif /* __MSM_DEBUGFS_H__ */
drivers/gpu/drm/msm/msm_drv.c +3 -1
index 6c1a499..500ad18 100644
@@ -241,6 +241,9 @@ static int msm_drm_uninit(struct device *dev)
 
 	drm_dev_unregister(ddev);
 
+	msm_perf_debugfs_cleanup(priv);
+	msm_rd_debugfs_cleanup(priv);
+
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 	if (fbdev && priv->fbdev)
 		msm_fbdev_free(ddev);
@@ -838,7 +841,6 @@ static struct drm_driver msm_driver = {
 	.gem_prime_mmap     = msm_gem_prime_mmap,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init       = msm_debugfs_init,
-	.debugfs_cleanup    = msm_debugfs_cleanup,
 #endif
 	.ioctls             = msm_ioctls,
 	.num_ioctls         = DRM_MSM_NUM_IOCTLS,
drivers/gpu/drm/msm/msm_drv.h +2 -2
index c3b1487..b51fb0d 100644
@@ -304,10 +304,10 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m);
 void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m);
 int msm_debugfs_late_init(struct drm_device *dev);
 int msm_rd_debugfs_init(struct drm_minor *minor);
-void msm_rd_debugfs_cleanup(struct drm_minor *minor);
+void msm_rd_debugfs_cleanup(struct msm_drm_private *priv);
 void msm_rd_dump_submit(struct msm_gem_submit *submit);
 int msm_perf_debugfs_init(struct drm_minor *minor);
-void msm_perf_debugfs_cleanup(struct drm_minor *minor);
+void msm_perf_debugfs_cleanup(struct msm_drm_private *priv);
 #else
 static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; }
 static inline void msm_rd_dump_submit(struct msm_gem_submit *submit) {}
drivers/gpu/drm/msm/msm_kms.h +0 -1
index 117635d2..faa22c7 100644
@@ -64,7 +64,6 @@ struct msm_kms_funcs {
 #ifdef CONFIG_DEBUG_FS
 	/* debugfs: */
 	int (*debugfs_init)(struct msm_kms *kms, struct drm_minor *minor);
-	void (*debugfs_cleanup)(struct msm_kms *kms, struct drm_minor *minor);
 #endif
 };
 
drivers/gpu/drm/msm/msm_perf.c +2 -3
index fc5a948..5ab21bd 100644
@@ -231,13 +231,12 @@ int msm_perf_debugfs_init(struct drm_minor *minor)
 	return 0;
 
 fail:
-	msm_perf_debugfs_cleanup(minor);
+	msm_perf_debugfs_cleanup(priv);
 	return -1;
 }
 
-void msm_perf_debugfs_cleanup(struct drm_minor *minor)
+void msm_perf_debugfs_cleanup(struct msm_drm_private *priv)
 {
-	struct msm_drm_private *priv = minor->dev->dev_private;
 	struct msm_perf_state *perf = priv->perf;
 
 	if (!perf)
drivers/gpu/drm/msm/msm_rd.c +2 -3
index ab0b39f..3df7322 100644
@@ -245,13 +245,12 @@ int msm_rd_debugfs_init(struct drm_minor *minor)
 	return 0;
 
 fail:
-	msm_rd_debugfs_cleanup(minor);
+	msm_rd_debugfs_cleanup(priv);
 	return -1;
 }
 
-void msm_rd_debugfs_cleanup(struct drm_minor *minor)
+void msm_rd_debugfs_cleanup(struct msm_drm_private *priv)
 {
-	struct msm_drm_private *priv = minor->dev->dev_private;
 	struct msm_rd_state *rd = priv->rd;
 
 	if (!rd)
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/3 drm/debugfs: Remove the drm_driver.debugfs_cleanup callback

In reply to Noralf Trønnes

Remove the .debugfs_cleanup() callback now that all the users are gone.

---
 drivers/gpu/drm/drm_debugfs.c | 5 -----
 include/drm/drm_drv.h         | 1 -
 2 files changed, 6 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -5
index 8b2c61a..1d2d18d 100644
@@ -242,14 +242,9 @@ static void drm_debugfs_remove_all_files(struct drm_minor *minor)
  */
 int drm_debugfs_cleanup(struct drm_minor *minor)
 {
-	struct drm_device *dev = minor->dev;
-
 	if (!minor->debugfs_root)
 		return 0;
 
-	if (dev->driver->debugfs_cleanup)
-		dev->driver->debugfs_cleanup(minor);
-
 	drm_debugfs_remove_all_files(minor);
 
 	debugfs_remove_recursive(minor->debugfs_root);
include/drm/drm_drv.h +0 -1
index 661ca24..8ed1ef5 100644
@@ -302,7 +302,6 @@ struct drm_driver {
 	void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv);
 
 	int (*debugfs_init)(struct drm_minor *minor);
-	void (*debugfs_cleanup)(struct drm_minor *minor);
 
 	/**
 	 * @gem_free_object: deconstructor for drm_gem_objects
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 2/3] drm/debugfs: Remove the drm_driver.debugfs_cleanup callback

Quoted 3 lines · Noralf Trønnes

Remove the .debugfs_cleanup() callback now that all the users are gone.

First 2 patches merged to drm-misc, with Rob's irc ack on the first one. I'll leave the 3rd for Gerd.

Thanks, Daniel

Quoted 43 lines
---
 drivers/gpu/drm/drm_debugfs.c | 5 -----
 include/drm/drm_drv.h         | 1 -
 2 files changed, 6 deletions(-)
drivers/gpu/drm/drm_debugfs.c +0 -5
index 8b2c61a..1d2d18d 100644
@@ -242,14 +242,9 @@ static void drm_debugfs_remove_all_files(struct drm_minor *minor)
  */
 int drm_debugfs_cleanup(struct drm_minor *minor)
 {
-	struct drm_device *dev = minor->dev;
-
 	if (!minor->debugfs_root)
 		return 0;
 
-	if (dev->driver->debugfs_cleanup)
-		dev->driver->debugfs_cleanup(minor);
-
 	drm_debugfs_remove_all_files(minor);
 
 	debugfs_remove_recursive(minor->debugfs_root);
include/drm/drm_drv.h +0 -1
index 661ca24..8ed1ef5 100644
@@ -302,7 +302,6 @@ struct drm_driver {
 	void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv);
 
 	int (*debugfs_init)(struct drm_minor *minor);
-	void (*debugfs_cleanup)(struct drm_minor *minor);
 
 	/**
 	 * @gem_free_object: deconstructor for drm_gem_objects
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 3/3 drm/qxl: Remove qxl_debugfs_remove_files()

In reply to Noralf Trønnes

drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files().

---
 drivers/gpu/drm/qxl/qxl_debugfs.c | 13 -------------
 drivers/gpu/drm/qxl/qxl_drv.h     |  1 -
 drivers/gpu/drm/qxl/qxl_kms.c     |  1 -
 3 files changed, 15 deletions(-)
drivers/gpu/drm/qxl/qxl_debugfs.c +0 -13
index 8e6c780..ffe821b 100644
@@ -129,16 +129,3 @@ int qxl_debugfs_add_files(struct qxl_device *qdev,
 #endif
 	return 0;
 }
-
-void qxl_debugfs_remove_files(struct qxl_device *qdev)
-{
-#if defined(CONFIG_DEBUG_FS)
-	unsigned i;
-
-	for (i = 0; i < qdev->debugfs_count; i++) {
-		drm_debugfs_remove_files(qdev->debugfs[i].files,
-					 qdev->debugfs[i].num_files,
-					 qdev->ddev.primary);
-	}
-#endif
-}
drivers/gpu/drm/qxl/qxl_drv.h +0 -1
index c048170..ed50a5b 100644
@@ -232,7 +232,6 @@ int qxl_debugfs_add_files(struct qxl_device *rdev,
 			     struct drm_info_list *files,
 			     unsigned nfiles);
 int qxl_debugfs_fence_init(struct qxl_device *rdev);
-void qxl_debugfs_remove_files(struct qxl_device *qdev);
 
 struct qxl_device;
 
drivers/gpu/drm/qxl/qxl_kms.c +0 -1
index 2b1e1f3..1c46532 100644
@@ -284,5 +284,4 @@ void qxl_device_fini(struct qxl_device *qdev)
 	qdev->rom = NULL;
 	qdev->mode_info.modes = NULL;
 	qdev->mode_info.num_modes = 0;
-	qxl_debugfs_remove_files(qdev);
 }
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] drm/qxl: Remove qxl_debugfs_remove_files()

Quoted 7 lines · Noralf Trønnes

drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files().

cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH 3/3] drm/qxl: Remove qxl_debugfs_remove_files()

Quoted 10 lines · Gerd Hoffmann
Quoted 7 lines · Noralf Trønnes

drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files().

I assume you'll push to drm-misc yourself since its qxl?

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#7 lore raw

Re: [PATCH 3/3] drm/qxl: Remove qxl_debugfs_remove_files()

Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Noralf Trønnes

drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files().

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I assume you'll push to drm-misc yourself since its qxl?

Can surely do that.

Question though: This seems to be a cross-driver cleanup series. At least only 3/3 landed in my inbox, did't look @ dri-devel for the other patches. What is the usual policy on those?

From the past I had the impression that in such a case the whole series gets applied by one of the drm-misc maintainers instead of each individual driver maintainer cherry-picking the patches from the series ...

cheers,
Gerd

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH 3/3] drm/qxl: Remove qxl_debugfs_remove_files()

Quoted 17 lines · Gerd Hoffmann
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Noralf Trønnes

drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so it's not necessary to call drm_debugfs_remove_files().

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I assume you'll push to drm-misc yourself since its qxl?

Can surely do that.

Quoted 8 lines

Question though: This seems to be a cross-driver cleanup series. At least only 3/3 landed in my inbox, did't look @ dri-devel for the other patches. What is the usual policy on those?

From the past I had the impression that in such a case the whole series gets applied by one of the drm-misc maintainers instead of each individual driver maintainer cherry-picking the patches from the series ...

Well mostly because many driver maintainers aren't dutiful with picking up patches, or lose them again, or just take forever. But for this series here there's no such excuse, and there's also no technical reason to order patches a certain way (at least your qxl one is free standing and depends upon nothing else and blocks nothing else).

One of my goals with drm-misc is that I can reduce my efforts spending on catchging other maintainer's fallout, so I'd very much encourage everyone to just push stuff. Especially if you're the maintainer, and you slap an r-b onto a patch with no indication whether you merge it yourself or except someone else to merge it it's confusing and just improves the odds of the patch hitting one of our holes ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel