Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0-only OR MIT
2/* Copyright (c) 2023 Imagination Technologies Ltd. */
3
4#include "pvr_debugfs.h"
5
6#include "pvr_device.h"
7#include "pvr_fw_trace.h"
8
9#include <linux/dcache.h>
10#include <linux/debugfs.h>
11#include <linux/err.h>
12#include <linux/kernel.h>
13#include <linux/types.h>
14
15#include <drm/drm_device.h>
16#include <drm/drm_file.h>
17#include <drm/drm_print.h>
18
19static const struct pvr_debugfs_entry pvr_debugfs_entries[] = {
20 {"pvr_fw", pvr_fw_trace_debugfs_init},
21};
22
23void
24pvr_debugfs_init(struct drm_minor *minor)
25{
26 struct drm_device *drm_dev = minor->dev;
27 struct pvr_device *pvr_dev = to_pvr_device(drm_dev);
28 struct dentry *root = minor->debugfs_root;
29
30 for (size_t i = 0; i < ARRAY_SIZE(pvr_debugfs_entries); ++i) {
31 const struct pvr_debugfs_entry *entry = &pvr_debugfs_entries[i];
32 struct dentry *dir;
33
34 dir = debugfs_create_dir(entry->name, root);
35 if (IS_ERR(dir)) {
36 drm_warn(drm_dev,
37 "failed to create debugfs dir '%s' (err=%d)",
38 entry->name, (int)PTR_ERR(dir));
39 continue;
40 }
41
42 entry->init(pvr_dev, dir);
43 }
44}
45
46/*
47 * Since all entries are created under &drm_minor->debugfs_root, there's no
48 * need for a pvr_debugfs_fini() as DRM will clean up everything under its root
49 * automatically.
50 */