Thread (24 messages) 24 messages, 8 authors, 2014-08-11

Re: [PATCH v2 2/4] driver core: enable drivers to use deferred probefrom init

From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: 2014-08-10 13:43:30
Also in: linux-scsi, lkml

Greg KH wrote:
Why doesn't it work?  Doesn't modprobe come right back and the init
sequence still takes a while to run?  What exactly fails?
I guess ...
quoted hunk ↗ jump to hunk
@@ -5429,9 +5429,19 @@ mptsas_init(void)
 	return error;
 }
 
+static struct task_struct *init_thread;
+
+static int __init
+mptsas_init(void)
+{
+	init_thread = kthread_run(mptsas_real_init, NULL, "mptsas_init");
+	return 0;
+}
+
 static void __exit
 mptsas_exit(void)
 {
+	kthread_stop(init_thread);
 	pci_unregister_driver(&mptsas_driver);
 	sas_release_transport(mptsas_transport_template);
 
kthread_run() can fail. sas_attach_transport() and/or pci_register_driver()
in mptsas_real_init() can fail. Caller process may fail to continue if
sas_attach_transport() and pci_register_driver() in mptsas_real_init() has
not completed yet.

kthread_stop() must not be called when kthread_run() failed.
pci_unregister_driver() and/or sas_release_transport() must not be called
when mptsas_real_init() did not return 0 (or has not returned 0 yet).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help