extcon: unregister compat link on cleanup
authorPeter Huewe <peterhuewe@gmx.de>
Mon, 24 Sep 2012 06:36:24 +0000 (15:36 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 23 Oct 2012 07:32:12 +0000 (16:32 +0900)
Since extcon registers this compat link at device registration
(extcon_dev_register), we should probably remove them at deregistration/cleanup.

Cc: stable@vger.kernel.org
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/extcon-class.c

index 63715cd..54dc00b 100644 (file)
@@ -570,6 +570,10 @@ static void extcon_cleanup(struct extcon_dev *edev, bool skip)
                        kfree(edev->cables);
                }
 
+#if defined(CONFIG_ANDROID)
+               if (switch_class)
+                       class_compat_remove_link(switch_class, edev->dev, NULL);
+#endif
                device_unregister(edev->dev);
                put_device(edev->dev);
        }