drm: bridge: dw-hdmi: add debugfs_remove_recursive when unbind
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / bridge / dw-hdmi.c
index 168c2765b03568ce54cf5d8e04b293354239c4c3..1ad15af799a31cc575b28a7d754f19af06ff5e16 100644 (file)
@@ -236,6 +236,7 @@ struct dw_hdmi {
 
        spinlock_t audio_lock;
        struct mutex audio_mutex;
+       struct dentry *debugfs_dir;
        unsigned int sample_rate;
        unsigned int audio_cts;
        unsigned int audio_n;
@@ -2766,16 +2767,14 @@ static const struct file_operations dw_hdmi_phy_fops = {
 
 static void dw_hdmi_register_debugfs(struct device *dev, struct dw_hdmi *hdmi)
 {
-       struct dentry *debugfs_dir;
-
-       debugfs_dir = debugfs_create_dir("dw-hdmi", NULL);
-       if (IS_ERR(debugfs_dir)) {
+       hdmi->debugfs_dir = debugfs_create_dir("dw-hdmi", NULL);
+       if (IS_ERR(hdmi->debugfs_dir)) {
                dev_err(dev, "failed to create debugfs dir!\n");
                return;
        }
-       debugfs_create_file("ctrl", 0400, debugfs_dir,
+       debugfs_create_file("ctrl", 0400, hdmi->debugfs_dir,
                            hdmi, &dw_hdmi_ctrl_fops);
-       debugfs_create_file("phy", 0400, debugfs_dir,
+       debugfs_create_file("phy", 0400, hdmi->debugfs_dir,
                            hdmi, &dw_hdmi_phy_fops);
 }
 
@@ -3059,6 +3058,8 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
        flush_workqueue(hdmi->workqueue);
        destroy_workqueue(hdmi->workqueue);
 
+       debugfs_remove_recursive(hdmi->debugfs_dir);
+
        if (hdmi->audio && !IS_ERR(hdmi->audio))
                platform_device_unregister(hdmi->audio);