Driver authors are a forgetful breed, and having to manually clean up all inodes from debugfs during module unload is tedious and rarely encountered by users; leftover inodes fester. But behold, the drm core already tracks all inodes created under the DRI debugfs minor so that we can do all the teardown ourselves.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Dave Airlie airlied@redhat.com --- drivers/gpu/drm/drm_debugfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index a05087c..b855fd7 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -229,7 +229,16 @@ int drm_debugfs_cleanup(struct drm_minor *minor) if (dev->driver->debugfs_cleanup) dev->driver->debugfs_cleanup(minor);
- drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor); + while (!list_empty(&minor->debugfs_list)) { + struct drm_info_node *node = + list_first_entry(&minor->debugfs_list, + struct drm_info_node, + list); + + debugfs_remove(node->dent); + list_del(&node->list); + kfree(node); + }
debugfs_remove(minor->debugfs_root); minor->debugfs_root = NULL;
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Daniel Vetter daniel.vetter@ffwll.ch Cc: Ben Widawsky ben@bwidawsl.net --- drivers/gpu/drm/i915/i915_debugfs.c | 16 ---------------- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/i915_drv.h | 1 - 3 files changed, 18 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 1608f47..2a39d57 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2428,20 +2428,4 @@ int i915_debugfs_init(struct drm_minor *minor) minor->debugfs_root, minor); }
-void i915_debugfs_cleanup(struct drm_minor *minor) -{ - int i; - - drm_debugfs_remove_files(i915_debugfs_list, - I915_DEBUGFS_ENTRIES, minor); - drm_debugfs_remove_files((struct drm_info_list *) &i915_forcewake_fops, - 1, minor); - for (i = 0; i < ARRAY_SIZE(i915_debugfs_files); i++) { - struct drm_info_list *info_list = - (struct drm_info_list *) &i915_debugfs_files[i].fops; - - drm_debugfs_remove_files(info_list, 1, minor); - } -} - #endif /* CONFIG_DEBUG_FS */ diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0fe2bee..e49afff 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1183,7 +1183,6 @@ static struct drm_driver driver = { .master_destroy = i915_master_destroy, #if defined(CONFIG_DEBUG_FS) .debugfs_init = i915_debugfs_init, - .debugfs_cleanup = i915_debugfs_cleanup, #endif .gem_init_object = i915_gem_init_object, .gem_free_object = i915_gem_free_object, diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1fe6e5b..bafb0be 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1978,7 +1978,6 @@ void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
/* i915_debugfs.c */ int i915_debugfs_init(struct drm_minor *minor); -void i915_debugfs_cleanup(struct drm_minor *minor); __printf(2, 3) void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...); int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Ben Skeggs bskeggs@redhat.com --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 7 ------- drivers/gpu/drm/nouveau/nouveau_debugfs.h | 6 ------ drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - 3 files changed, 14 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 5392e07..d3f8f23 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -55,10 +55,3 @@ nouveau_debugfs_init(struct drm_minor *minor) minor->debugfs_root, minor); return 0; } - -void -nouveau_debugfs_takedown(struct drm_minor *minor) -{ - drm_debugfs_remove_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES, - minor); -} diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.h b/drivers/gpu/drm/nouveau/nouveau_debugfs.h index a62af6f..3cf44f0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.h +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.h @@ -5,18 +5,12 @@
#if defined(CONFIG_DEBUG_FS) extern int nouveau_debugfs_init(struct drm_minor *); -extern void nouveau_debugfs_takedown(struct drm_minor *); #else static inline int nouveau_debugfs_init(struct drm_minor *minor) { return 0; } - -static inline void nouveau_debugfs_takedown(struct drm_minor *minor) -{ -} - #endif
#endif diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 218a4b5..a8b3a28 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -687,7 +687,6 @@ driver = {
#if defined(CONFIG_DEBUG_FS) .debugfs_init = nouveau_debugfs_init, - .debugfs_cleanup = nouveau_debugfs_takedown, #endif
.get_vblank_counter = drm_vblank_count,
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Rob Clark robdclark@gmail.com --- drivers/gpu/drm/omapdrm/omap_debugfs.c | 10 ---------- drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/omapdrm/omap_drv.h | 1 - 3 files changed, 12 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c index c27f59d..6a11c2c 100644 --- a/drivers/gpu/drm/omapdrm/omap_debugfs.c +++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c @@ -112,14 +112,4 @@ int omap_debugfs_init(struct drm_minor *minor)
return ret; } - -void omap_debugfs_cleanup(struct drm_minor *minor) -{ - drm_debugfs_remove_files(omap_debugfs_list, - ARRAY_SIZE(omap_debugfs_list), minor); - if (dmm_is_available()) - drm_debugfs_remove_files(omap_dmm_debugfs_list, - ARRAY_SIZE(omap_dmm_debugfs_list), minor); -} - #endif diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 826586f..9a08219 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -607,7 +607,6 @@ static struct drm_driver omap_drm_driver = { .irq_handler = omap_irq_handler, #ifdef CONFIG_DEBUG_FS .debugfs_init = omap_debugfs_init, - .debugfs_cleanup = omap_debugfs_cleanup, #endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 215a20d..27ca8f1 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -129,7 +129,6 @@ struct omap_drm_private {
#ifdef CONFIG_DEBUG_FS int omap_debugfs_init(struct drm_minor *minor); -void omap_debugfs_cleanup(struct drm_minor *minor); void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m); void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
On Sun, Jul 7, 2013 at 3:02 PM, Chris Wilson chris@chris-wilson.co.uk wrote:
All inode removal is handled for us by the core.
Acked-by: Rob Clark robdclark@gmail.com
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Rob Clark robdclark@gmail.com
drivers/gpu/drm/omapdrm/omap_debugfs.c | 10 ---------- drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/omapdrm/omap_drv.h | 1 - 3 files changed, 12 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c index c27f59d..6a11c2c 100644 --- a/drivers/gpu/drm/omapdrm/omap_debugfs.c +++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c @@ -112,14 +112,4 @@ int omap_debugfs_init(struct drm_minor *minor)
return ret;
}
-void omap_debugfs_cleanup(struct drm_minor *minor) -{
drm_debugfs_remove_files(omap_debugfs_list,
ARRAY_SIZE(omap_debugfs_list), minor);
if (dmm_is_available())
drm_debugfs_remove_files(omap_dmm_debugfs_list,
ARRAY_SIZE(omap_dmm_debugfs_list), minor);
-}
#endif diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 826586f..9a08219 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -607,7 +607,6 @@ static struct drm_driver omap_drm_driver = { .irq_handler = omap_irq_handler, #ifdef CONFIG_DEBUG_FS .debugfs_init = omap_debugfs_init,
.debugfs_cleanup = omap_debugfs_cleanup,
#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 215a20d..27ca8f1 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -129,7 +129,6 @@ struct omap_drm_private {
#ifdef CONFIG_DEBUG_FS int omap_debugfs_init(struct drm_minor *minor); -void omap_debugfs_cleanup(struct drm_minor *minor); void omap_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m); void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); -- 1.8.3.2
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Dave Airlie airlied@redhat.com --- drivers/gpu/drm/qxl/qxl_debugfs.c | 9 --------- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.h | 1 - 3 files changed, 11 deletions(-)
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c index c3c2bbd..6c0899a 100644 --- a/drivers/gpu/drm/qxl/qxl_debugfs.c +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c @@ -82,15 +82,6 @@ qxl_debugfs_init(struct drm_minor *minor) return 0; }
-void -qxl_debugfs_takedown(struct drm_minor *minor) -{ -#if defined(CONFIG_DEBUG_FS) - drm_debugfs_remove_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES, - minor); -#endif -} - int qxl_debugfs_add_files(struct qxl_device *qdev, struct drm_info_list *files, unsigned nfiles) diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index aa291d8..d2f0b12 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -102,7 +102,6 @@ static struct drm_driver qxl_driver = { .dumb_destroy = qxl_mode_dumb_destroy, #if defined(CONFIG_DEBUG_FS) .debugfs_init = qxl_debugfs_init, - .debugfs_cleanup = qxl_debugfs_takedown, #endif .gem_init_object = qxl_gem_object_init, .gem_free_object = qxl_gem_object_free, diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 43d06ab..e58f3b7 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -520,7 +520,6 @@ int qxl_garbage_collect(struct qxl_device *qdev); /* debugfs */
int qxl_debugfs_init(struct drm_minor *minor); -void qxl_debugfs_takedown(struct drm_minor *minor);
/* qxl_irq.c */ int qxl_irq_init(struct qxl_device *qdev);
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Alex Deucher alexander.deucher@amd.com Cc: Jerome Glisse jglisse@redhat.com --- drivers/gpu/drm/radeon/radeon_device.c | 4 ---- drivers/gpu/drm/radeon/radeon_drv.c | 2 -- 2 files changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 82335e3..319d66b 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1635,8 +1635,4 @@ int radeon_debugfs_init(struct drm_minor *minor) { return 0; } - -void radeon_debugfs_cleanup(struct drm_minor *minor) -{ -} #endif diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index e5419b3..f8de877 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -136,7 +136,6 @@ extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd,
#if defined(CONFIG_DEBUG_FS) int radeon_debugfs_init(struct drm_minor *minor); -void radeon_debugfs_cleanup(struct drm_minor *minor); #endif
/* atpx handler */ @@ -406,7 +405,6 @@ static struct drm_driver kms_driver = { .get_scanout_position = radeon_get_crtc_scanoutpos, #if defined(CONFIG_DEBUG_FS) .debugfs_init = radeon_debugfs_init, - .debugfs_cleanup = radeon_debugfs_cleanup, #endif .irq_preinstall = radeon_driver_irq_preinstall_kms, .irq_postinstall = radeon_driver_irq_postinstall_kms,
All inode removal is handled for us by the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Darren Etheridge detheridge@ti.com Cc: Benoit Parrot bparrot@ti.com Cc: Rob Clark robdclark@gmail.com --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 12 ------------ drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 -- 2 files changed, 14 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 40b71da..c481843 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -474,17 +474,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
return ret; } - -static void tilcdc_debugfs_cleanup(struct drm_minor *minor) -{ - struct tilcdc_module *mod; - drm_debugfs_remove_files(tilcdc_debugfs_list, - ARRAY_SIZE(tilcdc_debugfs_list), minor); - - list_for_each_entry(mod, &module_list, list) - if (mod->funcs->debugfs_cleanup) - mod->funcs->debugfs_cleanup(mod, minor); -} #endif
static const struct file_operations fops = { @@ -522,7 +511,6 @@ static struct drm_driver tilcdc_driver = { .dumb_destroy = drm_gem_cma_dumb_destroy, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init, - .debugfs_cleanup = tilcdc_debugfs_cleanup, #endif .fops = &fops, .name = "tilcdc", diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index 0938036..56fe122 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h @@ -102,8 +102,6 @@ struct tilcdc_module_ops { #ifdef CONFIG_DEBUG_FS /* create debugfs nodes (can be NULL): */ int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor); - /* cleanup debugfs nodes (can be NULL): */ - void (*debugfs_cleanup)(struct tilcdc_module *mod, struct drm_minor *minor); #endif };
On Sun, Jul 7, 2013 at 3:02 PM, Chris Wilson chris@chris-wilson.co.uk wrote:
All inode removal is handled for us by the core.
Acked-by: Rob Clark robdclark@gmail.com
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Darren Etheridge detheridge@ti.com Cc: Benoit Parrot bparrot@ti.com Cc: Rob Clark robdclark@gmail.com
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 12 ------------ drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 -- 2 files changed, 14 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 40b71da..c481843 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -474,17 +474,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
return ret;
}
-static void tilcdc_debugfs_cleanup(struct drm_minor *minor) -{
struct tilcdc_module *mod;
drm_debugfs_remove_files(tilcdc_debugfs_list,
ARRAY_SIZE(tilcdc_debugfs_list), minor);
list_for_each_entry(mod, &module_list, list)
if (mod->funcs->debugfs_cleanup)
mod->funcs->debugfs_cleanup(mod, minor);
-} #endif
static const struct file_operations fops = { @@ -522,7 +511,6 @@ static struct drm_driver tilcdc_driver = { .dumb_destroy = drm_gem_cma_dumb_destroy, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init,
.debugfs_cleanup = tilcdc_debugfs_cleanup,
#endif .fops = &fops, .name = "tilcdc", diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index 0938036..56fe122 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h @@ -102,8 +102,6 @@ struct tilcdc_module_ops { #ifdef CONFIG_DEBUG_FS /* create debugfs nodes (can be NULL): */ int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor);
/* cleanup debugfs nodes (can be NULL): */
void (*debugfs_cleanup)(struct tilcdc_module *mod, struct drm_minor *minor);
#endif };
-- 1.8.3.2
No driver did anything other than remove its lists of debugfs inodes which is now handled by the core. So having removed all the driver callbacks, we can now remove the hook from the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Dave Airlie airlied@redhat.com --- drivers/gpu/drm/drm_debugfs.c | 5 ----- include/drm/drmP.h | 1 - 2 files changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index b855fd7..c09406e 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -221,14 +221,9 @@ EXPORT_SYMBOL(drm_debugfs_remove_files); */ 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); - while (!list_empty(&minor->debugfs_list)) { struct drm_info_node *node = list_first_entry(&minor->debugfs_list, diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 82670ac..a493f77 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -902,7 +902,6 @@ struct drm_driver { bool from_release);
int (*debugfs_init)(struct drm_minor *minor); - void (*debugfs_cleanup)(struct drm_minor *minor);
/** * Driver-specific constructor for drm_gem_objects, to set up
On Sun, Jul 07, 2013 at 08:02:25PM +0100, Chris Wilson wrote:
No driver did anything other than remove its lists of debugfs inodes which is now handled by the core. So having removed all the driver callbacks, we can now remove the hook from the core.
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Dave Airlie airlied@redhat.com
Don't we have an unused drm_debugfs_remove_files function now? Otherwise this makes tons of sense imo, so on the series:
Acked-by: Daniel Vetter daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_debugfs.c | 5 ----- include/drm/drmP.h | 1 - 2 files changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index b855fd7..c09406e 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -221,14 +221,9 @@ EXPORT_SYMBOL(drm_debugfs_remove_files); */ 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);
while (!list_empty(&minor->debugfs_list)) { struct drm_info_node *node = list_first_entry(&minor->debugfs_list,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 82670ac..a493f77 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -902,7 +902,6 @@ struct drm_driver { bool from_release);
int (*debugfs_init)(struct drm_minor *minor);
void (*debugfs_cleanup)(struct drm_minor *minor);
/**
- Driver-specific constructor for drm_gem_objects, to set up
-- 1.8.3.2
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
On Sun, Jul 7, 2013 at 3:02 PM, Chris Wilson chris@chris-wilson.co.uk wrote:
Driver authors are a forgetful breed, and having to manually clean up all inodes from debugfs during module unload is tedious and rarely encountered by users; leftover inodes fester. But behold, the drm core already tracks all inodes created under the DRI debugfs minor so that we can do all the teardown ourselves.
Seems like a pretty sane idea.
Reviewed-by: Rob Clark robdclark@gmail.com
Signed-off-by: Chris Wilson chris@chris-wilson.co.uk Cc: Dave Airlie airlied@redhat.com
drivers/gpu/drm/drm_debugfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index a05087c..b855fd7 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -229,7 +229,16 @@ int drm_debugfs_cleanup(struct drm_minor *minor) if (dev->driver->debugfs_cleanup) dev->driver->debugfs_cleanup(minor);
drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
while (!list_empty(&minor->debugfs_list)) {
struct drm_info_node *node =
list_first_entry(&minor->debugfs_list,
struct drm_info_node,
list);
debugfs_remove(node->dent);
list_del(&node->list);
kfree(node);
} debugfs_remove(minor->debugfs_root); minor->debugfs_root = NULL;
-- 1.8.3.2
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
dri-devel@lists.freedesktop.org