drm/ttm: Initialize debugfs from ttm_global_init()
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 21 Jul 2021 15:23:57 +0000 (10:23 -0500)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 22 Jul 2021 10:09:12 +0000 (12:09 +0200)
commit69de4421bb4c103ef42a32bafc596e23918c106f
tree5dfe71db4d7e26e856dd5ae628f65b686ac61025
parent7bbcb919e32d776ca8ddce08abb391ab92eef6a9
drm/ttm: Initialize debugfs from ttm_global_init()

We create a bunch of debugfs entries as a side-effect of
ttm_global_init() and then never clean them up.  This isn't usually a
problem because we free the whole debugfs directory on module unload.
However, if the global reference count ever goes to zero and then
ttm_global_init() is called again, we'll re-create those debugfs entries
and debugfs will complain in dmesg that we're creating entries that
already exist.  This patch fixes this problem by changing the lifetime
of the whole TTM debugfs directory to match that of the TTM global
state.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210721152358.2893314-6-jason@jlekstrand.net
drivers/gpu/drm/ttm/ttm_device.c
drivers/gpu/drm/ttm/ttm_module.c