rk30: hdmi: unregister earlysuspend when shutdown
author黄涛 <huangtao@rock-chips.com>
Thu, 31 May 2012 01:35:41 +0000 (09:35 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 31 May 2012 01:43:26 +0000 (09:43 +0800)
drivers/video/rockchip/hdmi/rk30_hdmi.c
drivers/video/rockchip/hdmi/rk30_hdmi.h

index 50c9b6783a6c5956a81c7c94791fa330f51360af..37a05d07b71dd2e23e59cfc7193d375fd8ba4fb6 100755 (executable)
@@ -198,6 +198,7 @@ err1:
 err0:\r
        hdmi_dbg(hdmi->dev, "rk30 hdmi probe error.\n");\r
        kfree(hdmi);\r
+       hdmi = NULL;\r
        return ret;\r
 }\r
 \r
@@ -221,7 +222,18 @@ static int __devexit rk30_hdmi_remove(struct platform_device *pdev)
 \r
 static void rk30_hdmi_shutdown(struct platform_device *pdev)\r
 {\r
+       /* this func is called twice, bug? */\r
+       static bool first = true;\r
 \r
+       if (first) {\r
+               first = false;\r
+               return;\r
+       }\r
+       if (!hdmi)\r
+               return;\r
+#ifdef CONFIG_HAS_EARLYSUSPEND\r
+       unregister_early_suspend(&hdmi->early_suspend);\r
+#endif\r
 }\r
 \r
 static struct platform_driver rk30_hdmi_driver = {\r
@@ -247,4 +259,4 @@ static void __exit rk30_hdmi_exit(void)
 \r
 //fs_initcall(rk30_hdmi_init);\r
 module_init(rk30_hdmi_init);\r
-module_exit(rk30_hdmi_exit);
\ No newline at end of file
+module_exit(rk30_hdmi_exit);\r
index f59b887b89b5e4e3ce6474ce76354327ce385c2d..83acb6c86e583417f8d62ef78613679c8d8668d4 100755 (executable)
@@ -60,8 +60,8 @@ struct hdmi {
        int wait;
        struct completion       complete;
        
-#ifdef CONFIG_HAS_EARLYSUSPEND
        int suspend;
+#ifdef CONFIG_HAS_EARLYSUSPEND
        struct early_suspend    early_suspend;
 #endif
        
@@ -93,4 +93,4 @@ extern int hdmi_find_best_mode(struct hdmi* hdmi, int vic);
 extern int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok);
 extern int hdmi_switch_fb(struct hdmi *hdmi, int vic);
 extern void hdmi_sys_remove(void);
-#endif /* __RK30_HDMI_H__ */
\ No newline at end of file
+#endif /* __RK30_HDMI_H__ */