diff options
author | Christian König <ckoenig.leichtzumerken@gmail.com> | 2023-08-29 13:01:13 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2023-09-01 08:51:18 +0200 |
commit | 0b30d57acafcaa5374756d314ee54f80d0bcc860 (patch) | |
tree | 39096f84ff057c447719d6cb284578f149802c55 /drivers/accel/drm_accel.c | |
parent | 19ecbe8325a2a7ffda5ff4790955b84eaccba49f (diff) | |
download | lwn-0b30d57acafcaa5374756d314ee54f80d0bcc860.tar.gz lwn-0b30d57acafcaa5374756d314ee54f80d0bcc860.zip |
drm/debugfs: rework debugfs directory creation v5
Instead of the per minor directories only create a single debugfs
directory for the whole device directly when the device is initialized.
For DRM devices each minor gets a symlink to the per device directory
for now until we can be sure that this isn't useful any more in any way.
Accel devices create only the per device directory and also drops the mid
layer callback to create driver specific files.
v2: cleanup accel component as well
v3: fix typo when debugfs is disabled
v4: call drm_debugfs_dev_fini() during release as well,
some kerneldoc typos fixed
v5: rebased and one more kerneldoc fix
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829110115.3442-4-christian.koenig@amd.com
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Diffstat (limited to 'drivers/accel/drm_accel.c')
-rw-r--r-- | drivers/accel/drm_accel.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/accel/drm_accel.c b/drivers/accel/drm_accel.c index 01edf2c00b5a..8ba3db2ec5bb 100644 --- a/drivers/accel/drm_accel.c +++ b/drivers/accel/drm_accel.c @@ -79,26 +79,32 @@ static const struct drm_info_list accel_debugfs_list[] = { #define ACCEL_DEBUGFS_ENTRIES ARRAY_SIZE(accel_debugfs_list) /** - * accel_debugfs_init() - Initialize debugfs for accel minor - * @minor: Pointer to the drm_minor instance. - * @minor_id: The minor's id + * accel_debugfs_init() - Initialize debugfs for device + * @dev: Pointer to the device instance. * - * This function initializes the drm minor's debugfs members and creates - * a root directory for the minor in debugfs. It also creates common files - * for accelerators and calls the driver's debugfs init callback. + * This function creates a root directory for the device in debugfs. */ -void accel_debugfs_init(struct drm_minor *minor, int minor_id) +void accel_debugfs_init(struct drm_device *dev) { - struct drm_device *dev = minor->dev; - char name[64]; + drm_debugfs_dev_init(dev, accel_debugfs_root); +} + +/** + * accel_debugfs_register() - Register debugfs for device + * @dev: Pointer to the device instance. + * + * Creates common files for accelerators. + */ +void accel_debugfs_register(struct drm_device *dev) +{ + struct drm_minor *minor = dev->accel; INIT_LIST_HEAD(&minor->debugfs_list); mutex_init(&minor->debugfs_lock); - sprintf(name, "%d", minor_id); - minor->debugfs_root = debugfs_create_dir(name, accel_debugfs_root); + minor->debugfs_root = dev->debugfs_root; drm_debugfs_create_files(accel_debugfs_list, ACCEL_DEBUGFS_ENTRIES, - minor->debugfs_root, minor); + dev->debugfs_root, minor); } /** |