mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 12:43:55 +08:00
drm/armada: Remove armada_drm_debugfs_cleanup()
drm_debugfs_cleanup() now removes all minor->debugfs_list entries automatically, so no need to do this explicitly. Additionally it uses debugfs_remove_recursive() to clean up the debugfs files, so no need for adding fake drm_info_node entries. And finally there's no need to clean up on error, drm_debugfs_cleanup() is called in the error path. Cc: linux@armlinux.org.uk Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-6-noralf@tronnes.org
This commit is contained in:
parent
75bb485d74
commit
b516a6c954
@ -107,40 +107,9 @@ static struct drm_info_list armada_debugfs_list[] = {
|
||||
};
|
||||
#define ARMADA_DEBUGFS_ENTRIES ARRAY_SIZE(armada_debugfs_list)
|
||||
|
||||
static int drm_add_fake_info_node(struct drm_minor *minor, struct dentry *ent,
|
||||
const void *key)
|
||||
{
|
||||
struct drm_info_node *node;
|
||||
|
||||
node = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
|
||||
if (!node) {
|
||||
debugfs_remove(ent);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
node->minor = minor;
|
||||
node->dent = ent;
|
||||
node->info_ent = (void *) key;
|
||||
|
||||
mutex_lock(&minor->debugfs_lock);
|
||||
list_add(&node->list, &minor->debugfs_list);
|
||||
mutex_unlock(&minor->debugfs_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int armada_debugfs_create(struct dentry *root, struct drm_minor *minor,
|
||||
const char *name, umode_t mode, const struct file_operations *fops)
|
||||
{
|
||||
struct dentry *de;
|
||||
|
||||
de = debugfs_create_file(name, mode, root, minor->dev, fops);
|
||||
|
||||
return drm_add_fake_info_node(minor, de, fops);
|
||||
}
|
||||
|
||||
int armada_drm_debugfs_init(struct drm_minor *minor)
|
||||
{
|
||||
struct dentry *de;
|
||||
int ret;
|
||||
|
||||
ret = drm_debugfs_create_files(armada_debugfs_list,
|
||||
@ -149,29 +118,15 @@ int armada_drm_debugfs_init(struct drm_minor *minor)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = armada_debugfs_create(minor->debugfs_root, minor,
|
||||
"reg", S_IFREG | S_IRUSR, &fops_reg_r);
|
||||
if (ret)
|
||||
goto err_1;
|
||||
de = debugfs_create_file("reg", S_IFREG | S_IRUSR,
|
||||
minor->debugfs_root, minor->dev, &fops_reg_r);
|
||||
if (!de)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = armada_debugfs_create(minor->debugfs_root, minor,
|
||||
"reg_wr", S_IFREG | S_IWUSR, &fops_reg_w);
|
||||
if (ret)
|
||||
goto err_2;
|
||||
return ret;
|
||||
de = debugfs_create_file("reg_wr", S_IFREG | S_IWUSR,
|
||||
minor->debugfs_root, minor->dev, &fops_reg_w);
|
||||
if (!de)
|
||||
return -ENOMEM;
|
||||
|
||||
err_2:
|
||||
drm_debugfs_remove_files((struct drm_info_list *)&fops_reg_r, 1, minor);
|
||||
err_1:
|
||||
drm_debugfs_remove_files(armada_debugfs_list, ARMADA_DEBUGFS_ENTRIES,
|
||||
minor);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void armada_drm_debugfs_cleanup(struct drm_minor *minor)
|
||||
{
|
||||
drm_debugfs_remove_files((struct drm_info_list *)&fops_reg_w, 1, minor);
|
||||
drm_debugfs_remove_files((struct drm_info_list *)&fops_reg_r, 1, minor);
|
||||
drm_debugfs_remove_files(armada_debugfs_list, ARMADA_DEBUGFS_ENTRIES,
|
||||
minor);
|
||||
return 0;
|
||||
}
|
||||
|
@ -90,6 +90,5 @@ void armada_fbdev_fini(struct drm_device *);
|
||||
int armada_overlay_plane_create(struct drm_device *, unsigned long);
|
||||
|
||||
int armada_drm_debugfs_init(struct drm_minor *);
|
||||
void armada_drm_debugfs_cleanup(struct drm_minor *);
|
||||
|
||||
#endif
|
||||
|
@ -209,9 +209,6 @@ static void armada_drm_unbind(struct device *dev)
|
||||
drm_kms_helper_poll_fini(&priv->drm);
|
||||
armada_fbdev_fini(&priv->drm);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
armada_drm_debugfs_cleanup(priv->drm.primary);
|
||||
#endif
|
||||
drm_dev_unregister(&priv->drm);
|
||||
|
||||
component_unbind_all(dev, &priv->drm);
|
||||
|
Loading…
Reference in New Issue
Block a user