drm: bridge: dw-hdmi: add debugfs_remove_recursive when unbind

On RK3328, dw-hdmi driver is reloaded after bind and unbind
then it will use the first register debugfs address if no run
debugfs_remove_recursive, and cause system crash.

Change-Id: Iafa6b4059962b62c79157a9cf6c3e1d56df48f03
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
This commit is contained in:
Huicong Xu
2017-06-24 18:10:00 +08:00
committed by Tao Huang
parent 6e144e13c0
commit be496ad4e1

View File

@@ -299,6 +299,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;
@@ -4029,18 +4030,16 @@ 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("status", 0400, debugfs_dir,
debugfs_create_file("status", 0400, hdmi->debugfs_dir,
hdmi, &dw_hdmi_status_fops);
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);
}
@@ -4419,6 +4418,8 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi)
flush_workqueue(hdmi->workqueue);
destroy_workqueue(hdmi->workqueue);
debugfs_remove_recursive(hdmi->debugfs_dir);
drm_bridge_remove(&hdmi->bridge);
if (hdmi->audio && !IS_ERR(hdmi->audio))