Commit dbb23cf5 authored by Maíra Canal's avatar Maíra Canal Committed by Maíra Canal
Browse files

drm/debugfs: create debugfs late register functions



Although the device-centered debugfs functions can track requests for
the addition of DRM debugfs files at any time and have them added all
at once during drm_dev_register(), they are not able to create debugfs
files for modeset components, as they are registered after the primary
and the render drm_minor are registered.

So, create a drm_debugfs_late_register() function, which is responsible
for dealing with the creation of all the debugfs files for modeset
components at once. Therefore, the functions drm_debugfs_add_file()
and drm_debugfs_add_files() can be used in late_register hooks.

Signed-off-by: default avatarMaíra Canal <mcanal@igalia.com>
Reviewed-by: default avatarMelissa Wen <mwen@igalia.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarMaíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20221219120621.15086-4-mcanal@igalia.com
parent 6fd80729
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -254,6 +254,20 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
	return 0;
}

void drm_debugfs_late_register(struct drm_device *dev)
{
	struct drm_minor *minor = dev->primary;
	struct drm_debugfs_entry *entry, *tmp;

	if (!minor)
		return;

	list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) {
		debugfs_create_file(entry->file.name, S_IFREG | S_IRUGO,
				    minor->debugfs_root, entry, &drm_debugfs_entry_fops);
		list_del(&entry->list);
	}
}

int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
			     struct drm_minor *minor)
+5 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
int drm_debugfs_init(struct drm_minor *minor, int minor_id,
		     struct dentry *root);
void drm_debugfs_cleanup(struct drm_minor *minor);
void drm_debugfs_late_register(struct drm_device *dev);
void drm_debugfs_connector_add(struct drm_connector *connector);
void drm_debugfs_connector_remove(struct drm_connector *connector);
void drm_debugfs_crtc_add(struct drm_crtc *crtc);
@@ -202,6 +203,10 @@ static inline void drm_debugfs_cleanup(struct drm_minor *minor)
{
}

static inline void drm_debugfs_late_register(struct drm_device *dev)
{
}

static inline void drm_debugfs_connector_add(struct drm_connector *connector)
{
}
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ int drm_modeset_register_all(struct drm_device *dev)
	if (ret)
		goto err_connector;

	drm_debugfs_late_register(dev);

	return 0;

err_connector: