[PATCH 1/1] usb: gadget: mark init as late_initcall

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

 



Since we introduce -EPROBE_DEFER for udc driver, it will be
probed at late_initcall if it is defered. When the gadget
is built in, it will return "couldn't find an available UDC"
at such case. That's the problem we met at below link:

http://marc.info/?l=linux-usb&m=137706435611447&w=2

We have no driver's probe at gadget driver, so we can't return
-EPROBE_DEFER. And it is also not suitable to defer udc_bind_to_driver
if the udc is not found temporarily, since it is hard to decide the
return value for usb_gadget_probe_driver.

Due to above reasons, mark gadget's init as late_initcall may be a
moderate solution.

Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
---
 drivers/usb/gadget/acm_ms.c       |    2 +-
 drivers/usb/gadget/audio.c        |    2 +-
 drivers/usb/gadget/cdc2.c         |    2 +-
 drivers/usb/gadget/ether.c        |    2 +-
 drivers/usb/gadget/gmidi.c        |    2 +-
 drivers/usb/gadget/hid.c          |    2 +-
 drivers/usb/gadget/mass_storage.c |    2 +-
 drivers/usb/gadget/multi.c        |    2 +-
 drivers/usb/gadget/ncm.c          |    2 +-
 drivers/usb/gadget/nokia.c        |    2 +-
 drivers/usb/gadget/printer.c      |    2 +-
 drivers/usb/gadget/serial.c       |    2 +-
 drivers/usb/gadget/webcam.c       |    2 +-
 drivers/usb/gadget/zero.c         |    2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/gadget/acm_ms.c b/drivers/usb/gadget/acm_ms.c
index 4b947bb..d712962 100644
--- a/drivers/usb/gadget/acm_ms.c
+++ b/drivers/usb/gadget/acm_ms.c
@@ -224,7 +224,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&acm_ms_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 231b0ef..04345a4 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -176,7 +176,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&audio_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index 5a5acf2..a4a3407 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -256,7 +256,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&cdc_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index c1c113e..e0722e9 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -483,7 +483,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&eth_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index e879e2c..67bd00a 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -167,7 +167,7 @@ static int __init midi_init(void)
 {
 	return usb_composite_probe(&midi_driver);
 }
-module_init(midi_init);
+late_initcall(midi_init);
 
 static void __exit midi_cleanup(void)
 {
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c
index 778613e..42756a0 100644
--- a/drivers/usb/gadget/hid.c
+++ b/drivers/usb/gadget/hid.c
@@ -256,7 +256,7 @@ static int __init hidg_init(void)
 
 	return status;
 }
-module_init(hidg_init);
+late_initcall(hidg_init);
 
 static void __exit hidg_cleanup(void)
 {
diff --git a/drivers/usb/gadget/mass_storage.c b/drivers/usb/gadget/mass_storage.c
index 080e577..fd26fc8 100644
--- a/drivers/usb/gadget/mass_storage.c
+++ b/drivers/usb/gadget/mass_storage.c
@@ -189,7 +189,7 @@ static int __init msg_init(void)
 {
 	return usb_composite_probe(&msg_driver);
 }
-module_init(msg_init);
+late_initcall(msg_init);
 
 static void msg_cleanup(void)
 {
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 2a1ebef..c5956bf 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -365,7 +365,7 @@ static int __init multi_init(void)
 {
 	return usb_composite_probe(&multi_driver);
 }
-module_init(multi_init);
+late_initcall(multi_init);
 
 static void __exit multi_exit(void)
 {
diff --git a/drivers/usb/gadget/ncm.c b/drivers/usb/gadget/ncm.c
index 81956fe..6be75d4 100644
--- a/drivers/usb/gadget/ncm.c
+++ b/drivers/usb/gadget/ncm.c
@@ -212,7 +212,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&ncm_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/nokia.c b/drivers/usb/gadget/nokia.c
index 0a8099a..b07451e 100644
--- a/drivers/usb/gadget/nokia.c
+++ b/drivers/usb/gadget/nokia.c
@@ -351,7 +351,7 @@ static int __init nokia_init(void)
 {
 	return usb_composite_probe(&nokia_driver);
 }
-module_init(nokia_init);
+late_initcall(nokia_init);
 
 static void __exit nokia_cleanup(void)
 {
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index bf7a56b..1b54f04 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -1281,7 +1281,7 @@ init(void)
 
 	return status;
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit
 cleanup(void)
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 1f5f978..0c7b826 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -267,7 +267,7 @@ static int __init init(void)
 
 	return usb_composite_probe(&gserial_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index 8cef1e6..79655b9 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -402,7 +402,7 @@ webcam_cleanup(void)
 	usb_composite_unregister(&webcam_driver);
 }
 
-module_init(webcam_init);
+late_initcall(webcam_init);
 module_exit(webcam_cleanup);
 
 MODULE_AUTHOR("Laurent Pinchart");
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 0dd07ae..4cce258 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -418,7 +418,7 @@ static int __init init(void)
 {
 	return usb_composite_probe(&zero_driver);
 }
-module_init(init);
+late_initcall(init);
 
 static void __exit cleanup(void)
 {
-- 
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