mirror of https://gitee.com/openkylin/linux.git
drm/nouveau/debugfs: we need a ctrl object for debugfs
Signed-off-by: Karol Herbst <nouveau@karolherbst.de> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
56c101af40
commit
b126a200e9
|
@ -29,6 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
|
#include <nvif/class.h>
|
||||||
#include "nouveau_debugfs.h"
|
#include "nouveau_debugfs.h"
|
||||||
#include "nouveau_drm.h"
|
#include "nouveau_drm.h"
|
||||||
|
|
||||||
|
@ -112,3 +113,30 @@ nouveau_drm_debugfs_cleanup(struct drm_minor *minor)
|
||||||
1, minor);
|
1, minor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
nouveau_debugfs_init(struct nouveau_drm *drm)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
drm->debugfs = kzalloc(sizeof(*drm->debugfs), GFP_KERNEL);
|
||||||
|
if (!drm->debugfs)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ret = nvif_object_init(&drm->device.object, 0, NVIF_CLASS_CONTROL,
|
||||||
|
NULL, 0, &drm->debugfs->ctrl);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nouveau_debugfs_fini(struct nouveau_drm *drm)
|
||||||
|
{
|
||||||
|
if (drm->debugfs && drm->debugfs->ctrl.priv)
|
||||||
|
nvif_object_fini(&drm->debugfs->ctrl);
|
||||||
|
|
||||||
|
kfree(drm->debugfs);
|
||||||
|
drm->debugfs = NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -4,8 +4,23 @@
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
|
||||||
#if defined(CONFIG_DEBUG_FS)
|
#if defined(CONFIG_DEBUG_FS)
|
||||||
|
|
||||||
|
#include "nouveau_drm.h"
|
||||||
|
|
||||||
|
struct nouveau_debugfs {
|
||||||
|
struct nvif_object ctrl;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct nouveau_debugfs *
|
||||||
|
nouveau_debugfs(struct drm_device *dev)
|
||||||
|
{
|
||||||
|
return nouveau_drm(dev)->debugfs;
|
||||||
|
}
|
||||||
|
|
||||||
extern int nouveau_drm_debugfs_init(struct drm_minor *);
|
extern int nouveau_drm_debugfs_init(struct drm_minor *);
|
||||||
extern void nouveau_drm_debugfs_cleanup(struct drm_minor *);
|
extern void nouveau_drm_debugfs_cleanup(struct drm_minor *);
|
||||||
|
extern int nouveau_debugfs_init(struct nouveau_drm *);
|
||||||
|
extern void nouveau_debugfs_fini(struct nouveau_drm *);
|
||||||
#else
|
#else
|
||||||
static inline int
|
static inline int
|
||||||
nouveau_drm_debugfs_init(struct drm_minor *minor)
|
nouveau_drm_debugfs_init(struct drm_minor *minor)
|
||||||
|
@ -18,6 +33,17 @@ nouveau_drm_debugfs_cleanup(struct drm_minor *minor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
nouveau_debugfs_init(struct nouveau_drm *)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
nouveau_debugfs_fini(struct nouveau_drm *)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -453,6 +453,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
|
||||||
goto fail_dispinit;
|
goto fail_dispinit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nouveau_debugfs_init(drm);
|
||||||
nouveau_sysfs_init(dev);
|
nouveau_sysfs_init(dev);
|
||||||
nouveau_hwmon_init(dev);
|
nouveau_hwmon_init(dev);
|
||||||
nouveau_accel_init(drm);
|
nouveau_accel_init(drm);
|
||||||
|
@ -492,6 +493,7 @@ nouveau_drm_unload(struct drm_device *dev)
|
||||||
nouveau_accel_fini(drm);
|
nouveau_accel_fini(drm);
|
||||||
nouveau_hwmon_fini(dev);
|
nouveau_hwmon_fini(dev);
|
||||||
nouveau_sysfs_fini(dev);
|
nouveau_sysfs_fini(dev);
|
||||||
|
nouveau_debugfs_fini(drm);
|
||||||
|
|
||||||
if (dev->mode_config.num_crtc)
|
if (dev->mode_config.num_crtc)
|
||||||
nouveau_display_fini(dev);
|
nouveau_display_fini(dev);
|
||||||
|
|
|
@ -165,6 +165,7 @@ struct nouveau_drm {
|
||||||
/* power management */
|
/* power management */
|
||||||
struct nouveau_hwmon *hwmon;
|
struct nouveau_hwmon *hwmon;
|
||||||
struct nouveau_sysfs *sysfs;
|
struct nouveau_sysfs *sysfs;
|
||||||
|
struct nouveau_debugfs *debugfs;
|
||||||
|
|
||||||
/* display power reference */
|
/* display power reference */
|
||||||
bool have_disp_power_ref;
|
bool have_disp_power_ref;
|
||||||
|
|
Loading…
Reference in New Issue