usb: renesas_usbhs: remove callback when module removed.
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 21 Apr 2011 05:10:16 +0000 (14:10 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 30 Apr 2011 00:24:32 +0000 (17:24 -0700)
The callback function which is called from platform must be removed
if module removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/renesas_usbhs/common.c
include/linux/usb/renesas_usbhs.h

index d9ad60d1c156f340f586f40707e8bd78d4918da7..fda586d1f7d835ff2f9457e21bbcc848713cf0b7 100644 (file)
@@ -352,9 +352,13 @@ probe_end_kfree:
 static int __devexit usbhs_remove(struct platform_device *pdev)
 {
        struct usbhs_priv *priv = usbhsc_pdev_to_priv(pdev);
+       struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;
+       struct renesas_usbhs_driver_callback *dfunc = &info->driver_callback;
 
        dev_dbg(&pdev->dev, "usb remove\n");
 
+       dfunc->notify_hotplug = NULL;
+
        pm_runtime_disable(&pdev->dev);
 
        usbhsc_bus_ctrl(priv, 0);
index 565bca3aa4400d9602e3879f41996ea31f86bd8a..66bbdd12d153f5853eabda480ae8c9930ebbb469 100644 (file)
@@ -143,7 +143,7 @@ struct renesas_usbhs_platform_info {
        ({                                                              \
                struct renesas_usbhs_driver_callback *dc;               \
                dc = &(renesas_usbhs_get_info(pdev)->driver_callback);  \
-               if (dc)                                                 \
+               if (dc && dc->notify_hotplug)                           \
                        dc->notify_hotplug(pdev);                       \
        })
 #endif /* RENESAS_USB_H */