diff options
author | Noralf Trønnes <noralf@tronnes.org> | 2017-01-26 17:56:15 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-01-27 09:27:06 -0500 |
commit | fc3706ea00303fd57cb0a47a75c956c24725e291 (patch) | |
tree | b334d2616def4febfd223d3d14bd75c1cba3b896 | |
parent | c8e73d1a2645db6eddda0d30b891f7f719f2b987 (diff) |
drm/sti: Remove drm_debugfs_remove_files() calls
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
-rw-r--r-- | drivers/gpu/drm/sti/sti_drv.c | 48 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_dvo.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_hda.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_hdmi.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_tvout.c | 8 |
5 files changed, 6 insertions, 82 deletions
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index ff71e25ab5bf..d3db22488f96 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c | |||
@@ -89,38 +89,9 @@ static struct drm_info_list sti_drm_dbg_list[] = { | |||
89 | {"fps_get", sti_drm_fps_dbg_show, 0}, | 89 | {"fps_get", sti_drm_fps_dbg_show, 0}, |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static int sti_drm_debugfs_create(struct dentry *root, | ||
93 | struct drm_minor *minor, | ||
94 | const char *name, | ||
95 | const struct file_operations *fops) | ||
96 | { | ||
97 | struct drm_device *dev = minor->dev; | ||
98 | struct drm_info_node *node; | ||
99 | struct dentry *ent; | ||
100 | |||
101 | ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops); | ||
102 | if (IS_ERR(ent)) | ||
103 | return PTR_ERR(ent); | ||
104 | |||
105 | node = kmalloc(sizeof(*node), GFP_KERNEL); | ||
106 | if (!node) { | ||
107 | debugfs_remove(ent); | ||
108 | return -ENOMEM; | ||
109 | } | ||
110 | |||
111 | node->minor = minor; | ||
112 | node->dent = ent; | ||
113 | node->info_ent = (void *)fops; | ||
114 | |||
115 | mutex_lock(&minor->debugfs_lock); | ||
116 | list_add(&node->list, &minor->debugfs_list); | ||
117 | mutex_unlock(&minor->debugfs_lock); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static int sti_drm_dbg_init(struct drm_minor *minor) | 92 | static int sti_drm_dbg_init(struct drm_minor *minor) |
123 | { | 93 | { |
94 | struct dentry *dentry; | ||
124 | int ret; | 95 | int ret; |
125 | 96 | ||
126 | ret = drm_debugfs_create_files(sti_drm_dbg_list, | 97 | ret = drm_debugfs_create_files(sti_drm_dbg_list, |
@@ -129,10 +100,13 @@ static int sti_drm_dbg_init(struct drm_minor *minor) | |||
129 | if (ret) | 100 | if (ret) |
130 | goto err; | 101 | goto err; |
131 | 102 | ||
132 | ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show", | 103 | dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, |
104 | minor->debugfs_root, minor->dev, | ||
133 | &sti_drm_fps_fops); | 105 | &sti_drm_fps_fops); |
134 | if (ret) | 106 | if (!dentry) { |
107 | ret = -ENOMEM; | ||
135 | goto err; | 108 | goto err; |
109 | } | ||
136 | 110 | ||
137 | DRM_INFO("%s: debugfs installed\n", DRIVER_NAME); | 111 | DRM_INFO("%s: debugfs installed\n", DRIVER_NAME); |
138 | return 0; | 112 | return 0; |
@@ -141,15 +115,6 @@ err: | |||
141 | return ret; | 115 | return ret; |
142 | } | 116 | } |
143 | 117 | ||
144 | static void sti_drm_dbg_cleanup(struct drm_minor *minor) | ||
145 | { | ||
146 | drm_debugfs_remove_files(sti_drm_dbg_list, | ||
147 | ARRAY_SIZE(sti_drm_dbg_list), minor); | ||
148 | |||
149 | drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops, | ||
150 | 1, minor); | ||
151 | } | ||
152 | |||
153 | static void sti_atomic_schedule(struct sti_private *private, | 118 | static void sti_atomic_schedule(struct sti_private *private, |
154 | struct drm_atomic_state *state) | 119 | struct drm_atomic_state *state) |
155 | { | 120 | { |
@@ -326,7 +291,6 @@ static struct drm_driver sti_driver = { | |||
326 | .gem_prime_mmap = drm_gem_cma_prime_mmap, | 291 | .gem_prime_mmap = drm_gem_cma_prime_mmap, |
327 | 292 | ||
328 | .debugfs_init = sti_drm_dbg_init, | 293 | .debugfs_init = sti_drm_dbg_init, |
329 | .debugfs_cleanup = sti_drm_dbg_cleanup, | ||
330 | 294 | ||
331 | .name = DRIVER_NAME, | 295 | .name = DRIVER_NAME, |
332 | .desc = DRIVER_DESC, | 296 | .desc = DRIVER_DESC, |
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index 411dc6ec976e..bb23318a44b7 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c | |||
@@ -195,13 +195,6 @@ static struct drm_info_list dvo_debugfs_files[] = { | |||
195 | { "dvo", dvo_dbg_show, 0, NULL }, | 195 | { "dvo", dvo_dbg_show, 0, NULL }, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor) | ||
199 | { | ||
200 | drm_debugfs_remove_files(dvo_debugfs_files, | ||
201 | ARRAY_SIZE(dvo_debugfs_files), | ||
202 | minor); | ||
203 | } | ||
204 | |||
205 | static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) | 198 | static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) |
206 | { | 199 | { |
207 | unsigned int i; | 200 | unsigned int i; |
@@ -514,9 +507,6 @@ static void sti_dvo_unbind(struct device *dev, | |||
514 | struct device *master, void *data) | 507 | struct device *master, void *data) |
515 | { | 508 | { |
516 | struct sti_dvo *dvo = dev_get_drvdata(dev); | 509 | struct sti_dvo *dvo = dev_get_drvdata(dev); |
517 | struct drm_device *drm_dev = data; | ||
518 | |||
519 | dvo_debugfs_exit(dvo, drm_dev->primary); | ||
520 | 510 | ||
521 | drm_bridge_remove(dvo->bridge); | 511 | drm_bridge_remove(dvo->bridge); |
522 | } | 512 | } |
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 66d37d78152a..0c0a75bc8bc3 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c | |||
@@ -365,13 +365,6 @@ static struct drm_info_list hda_debugfs_files[] = { | |||
365 | { "hda", hda_dbg_show, 0, NULL }, | 365 | { "hda", hda_dbg_show, 0, NULL }, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor) | ||
369 | { | ||
370 | drm_debugfs_remove_files(hda_debugfs_files, | ||
371 | ARRAY_SIZE(hda_debugfs_files), | ||
372 | minor); | ||
373 | } | ||
374 | |||
375 | static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) | 368 | static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor) |
376 | { | 369 | { |
377 | unsigned int i; | 370 | unsigned int i; |
@@ -739,10 +732,6 @@ err_sysfs: | |||
739 | static void sti_hda_unbind(struct device *dev, | 732 | static void sti_hda_unbind(struct device *dev, |
740 | struct device *master, void *data) | 733 | struct device *master, void *data) |
741 | { | 734 | { |
742 | struct sti_hda *hda = dev_get_drvdata(dev); | ||
743 | struct drm_device *drm_dev = data; | ||
744 | |||
745 | hda_debugfs_exit(hda, drm_dev->primary); | ||
746 | } | 735 | } |
747 | 736 | ||
748 | static const struct component_ops sti_hda_ops = { | 737 | static const struct component_ops sti_hda_ops = { |
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index f0af1ae82ee9..4a8bd620b90c 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -731,13 +731,6 @@ static struct drm_info_list hdmi_debugfs_files[] = { | |||
731 | { "hdmi", hdmi_dbg_show, 0, NULL }, | 731 | { "hdmi", hdmi_dbg_show, 0, NULL }, |
732 | }; | 732 | }; |
733 | 733 | ||
734 | static void hdmi_debugfs_exit(struct sti_hdmi *hdmi, struct drm_minor *minor) | ||
735 | { | ||
736 | drm_debugfs_remove_files(hdmi_debugfs_files, | ||
737 | ARRAY_SIZE(hdmi_debugfs_files), | ||
738 | minor); | ||
739 | } | ||
740 | |||
741 | static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor) | 734 | static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor) |
742 | { | 735 | { |
743 | unsigned int i; | 736 | unsigned int i; |
@@ -1359,10 +1352,6 @@ err_sysfs: | |||
1359 | static void sti_hdmi_unbind(struct device *dev, | 1352 | static void sti_hdmi_unbind(struct device *dev, |
1360 | struct device *master, void *data) | 1353 | struct device *master, void *data) |
1361 | { | 1354 | { |
1362 | struct sti_hdmi *hdmi = dev_get_drvdata(dev); | ||
1363 | struct drm_device *drm_dev = data; | ||
1364 | |||
1365 | hdmi_debugfs_exit(hdmi, drm_dev->primary); | ||
1366 | } | 1355 | } |
1367 | 1356 | ||
1368 | static const struct component_ops sti_hdmi_ops = { | 1357 | static const struct component_ops sti_hdmi_ops = { |
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index ad46d3558d91..8b8ea717c121 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c | |||
@@ -567,13 +567,6 @@ static struct drm_info_list tvout_debugfs_files[] = { | |||
567 | { "tvout", tvout_dbg_show, 0, NULL }, | 567 | { "tvout", tvout_dbg_show, 0, NULL }, |
568 | }; | 568 | }; |
569 | 569 | ||
570 | static void tvout_debugfs_exit(struct sti_tvout *tvout, struct drm_minor *minor) | ||
571 | { | ||
572 | drm_debugfs_remove_files(tvout_debugfs_files, | ||
573 | ARRAY_SIZE(tvout_debugfs_files), | ||
574 | minor); | ||
575 | } | ||
576 | |||
577 | static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) | 570 | static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor) |
578 | { | 571 | { |
579 | unsigned int i; | 572 | unsigned int i; |
@@ -627,7 +620,6 @@ static void sti_tvout_early_unregister(struct drm_encoder *encoder) | |||
627 | if (!tvout->debugfs_registered) | 620 | if (!tvout->debugfs_registered) |
628 | return; | 621 | return; |
629 | 622 | ||
630 | tvout_debugfs_exit(tvout, encoder->dev->primary); | ||
631 | tvout->debugfs_registered = false; | 623 | tvout->debugfs_registered = false; |
632 | } | 624 | } |
633 | 625 | ||