drm/sti: Remove drm_debugfs_remove_files() calls
authorNoralf Trønnes <noralf@tronnes.org>
Thu, 26 Jan 2017 22:56:15 +0000 (23:56 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 27 Jan 2017 14:27:06 +0000 (15:27 +0100)
drm_debugfs_cleanup() now removes all minor->debugfs_list entries
automatically, so it's not necessary to call
drm_debugfs_remove_files(). Additionally it uses
debugfs_remove_recursive() to clean up the debugfs files, so no need
for adding fake drm_info_node entries.

Cc: benjamin.gaignard@linaro.org
Cc: vincent.abriou@st.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Vincent Abriou <vincent.abriou@st.com>
Tested-by: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-14-noralf@tronnes.org
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/sti/sti_dvo.c
drivers/gpu/drm/sti/sti_hda.c
drivers/gpu/drm/sti/sti_hdmi.c
drivers/gpu/drm/sti/sti_tvout.c

index ff71e25ab5bf30cb288c607fd5e03391172e0d8a..d3db22488f96c6bd8a80832e1566a317064d7b7b 100644 (file)
@@ -89,38 +89,9 @@ static struct drm_info_list sti_drm_dbg_list[] = {
        {"fps_get", sti_drm_fps_dbg_show, 0},
 };
 
-static int sti_drm_debugfs_create(struct dentry *root,
-                                 struct drm_minor *minor,
-                                 const char *name,
-                                 const struct file_operations *fops)
-{
-       struct drm_device *dev = minor->dev;
-       struct drm_info_node *node;
-       struct dentry *ent;
-
-       ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
-       if (IS_ERR(ent))
-               return PTR_ERR(ent);
-
-       node = kmalloc(sizeof(*node), GFP_KERNEL);
-       if (!node) {
-               debugfs_remove(ent);
-               return -ENOMEM;
-       }
-
-       node->minor = minor;
-       node->dent = ent;
-       node->info_ent = (void *)fops;
-
-       mutex_lock(&minor->debugfs_lock);
-       list_add(&node->list, &minor->debugfs_list);
-       mutex_unlock(&minor->debugfs_lock);
-
-       return 0;
-}
-
 static int sti_drm_dbg_init(struct drm_minor *minor)
 {
+       struct dentry *dentry;
        int ret;
 
        ret = drm_debugfs_create_files(sti_drm_dbg_list,
@@ -129,10 +100,13 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
        if (ret)
                goto err;
 
-       ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show",
+       dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
+                                    minor->debugfs_root, minor->dev,
                                     &sti_drm_fps_fops);
-       if (ret)
+       if (!dentry) {
+               ret = -ENOMEM;
                goto err;
+       }
 
        DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
        return 0;
@@ -141,15 +115,6 @@ err:
        return ret;
 }
 
-static void sti_drm_dbg_cleanup(struct drm_minor *minor)
-{
-       drm_debugfs_remove_files(sti_drm_dbg_list,
-                                ARRAY_SIZE(sti_drm_dbg_list), minor);
-
-       drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops,
-                                1, minor);
-}
-
 static void sti_atomic_schedule(struct sti_private *private,
                                struct drm_atomic_state *state)
 {
@@ -326,7 +291,6 @@ static struct drm_driver sti_driver = {
        .gem_prime_mmap = drm_gem_cma_prime_mmap,
 
        .debugfs_init = sti_drm_dbg_init,
-       .debugfs_cleanup = sti_drm_dbg_cleanup,
 
        .name = DRIVER_NAME,
        .desc = DRIVER_DESC,
index 411dc6ec976ecce8d45d79307a4f12c146a2fdfa..bb23318a44b714a3d5d98883fcdc00234ddd3f16 100644 (file)
@@ -195,13 +195,6 @@ static struct drm_info_list dvo_debugfs_files[] = {
        { "dvo", dvo_dbg_show, 0, NULL },
 };
 
-static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor)
-{
-       drm_debugfs_remove_files(dvo_debugfs_files,
-                                ARRAY_SIZE(dvo_debugfs_files),
-                                minor);
-}
-
 static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
 {
        unsigned int i;
@@ -514,9 +507,6 @@ static void sti_dvo_unbind(struct device *dev,
                           struct device *master, void *data)
 {
        struct sti_dvo *dvo = dev_get_drvdata(dev);
-       struct drm_device *drm_dev = data;
-
-       dvo_debugfs_exit(dvo, drm_dev->primary);
 
        drm_bridge_remove(dvo->bridge);
 }
index 66d37d78152a48648f0f7fec5c4ce04867379e08..0c0a75bc8bc3f6ae4f60a8fe15826dc34b11ce84 100644 (file)
@@ -365,13 +365,6 @@ static struct drm_info_list hda_debugfs_files[] = {
        { "hda", hda_dbg_show, 0, NULL },
 };
 
-static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor)
-{
-       drm_debugfs_remove_files(hda_debugfs_files,
-                                ARRAY_SIZE(hda_debugfs_files),
-                                minor);
-}
-
 static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
 {
        unsigned int i;
@@ -739,10 +732,6 @@ err_sysfs:
 static void sti_hda_unbind(struct device *dev,
                struct device *master, void *data)
 {
-       struct sti_hda *hda = dev_get_drvdata(dev);
-       struct drm_device *drm_dev = data;
-
-       hda_debugfs_exit(hda, drm_dev->primary);
 }
 
 static const struct component_ops sti_hda_ops = {
index f0af1ae82ee92e405d9c41a88940fef93607754c..4a8bd620b90c51322b2491c187b7d440e0a22e1b 100644 (file)
@@ -731,13 +731,6 @@ static struct drm_info_list hdmi_debugfs_files[] = {
        { "hdmi", hdmi_dbg_show, 0, NULL },
 };
 
-static void hdmi_debugfs_exit(struct sti_hdmi *hdmi, struct drm_minor *minor)
-{
-       drm_debugfs_remove_files(hdmi_debugfs_files,
-                                ARRAY_SIZE(hdmi_debugfs_files),
-                                minor);
-}
-
 static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
 {
        unsigned int i;
@@ -1359,10 +1352,6 @@ err_sysfs:
 static void sti_hdmi_unbind(struct device *dev,
                struct device *master, void *data)
 {
-       struct sti_hdmi *hdmi = dev_get_drvdata(dev);
-       struct drm_device *drm_dev = data;
-
-       hdmi_debugfs_exit(hdmi, drm_dev->primary);
 }
 
 static const struct component_ops sti_hdmi_ops = {
index ad46d3558d9161b20d4cde8bce57d85e4f01d30d..8b8ea717c121f0ba89809bcb0aa4caff31c16305 100644 (file)
@@ -567,13 +567,6 @@ static struct drm_info_list tvout_debugfs_files[] = {
        { "tvout", tvout_dbg_show, 0, NULL },
 };
 
-static void tvout_debugfs_exit(struct sti_tvout *tvout, struct drm_minor *minor)
-{
-       drm_debugfs_remove_files(tvout_debugfs_files,
-                                ARRAY_SIZE(tvout_debugfs_files),
-                                minor);
-}
-
 static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
 {
        unsigned int i;
@@ -627,7 +620,6 @@ static void sti_tvout_early_unregister(struct drm_encoder *encoder)
        if (!tvout->debugfs_registered)
                return;
 
-       tvout_debugfs_exit(tvout, encoder->dev->primary);
        tvout->debugfs_registered = false;
 }