[PATCH 5/6] usb: renesas_usbhs: remove callback when module removed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The callback function which is called from platform must be removed
if module removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 drivers/usb/renesas_usbhs/common.c |    4 ++++
 include/linux/usb/renesas_usbhs.h  |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index d9ad60d..fda586d 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -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);
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 565bca3..66bbdd1 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -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 */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux