From: xuhuicong Date: Sat, 24 Jun 2017 10:10:00 +0000 (+0800) Subject: drm: bridge: dw-hdmi: add debugfs_remove_recursive when unbind X-Git-Tag: release-20171130_firefly~4^2~319 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=185e3ecd1fc60198a7d5a308b357c9cf24bf695c;p=firefly-linux-kernel-4.4.55.git 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: xuhuicong --- diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index 168c2765b035..1ad15af799a3 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -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);