|
51 | 51 | static DEFINE_MUTEX(deferred_probe_mutex);
|
52 | 52 | static LIST_HEAD(deferred_probe_pending_list);
|
53 | 53 | static LIST_HEAD(deferred_probe_active_list);
|
| 54 | +static struct workqueue_struct *deferred_wq; |
54 | 55 | static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
|
55 | 56 |
|
56 | 57 | /*
|
@@ -174,7 +175,7 @@ static void driver_deferred_probe_trigger(void)
|
174 | 175 | * Kick the re-probe thread. It may already be scheduled, but it is
|
175 | 176 | * safe to kick it again.
|
176 | 177 | */
|
177 |
| - schedule_work(&deferred_probe_work); |
| 178 | + queue_work(deferred_wq, &deferred_probe_work); |
178 | 179 | }
|
179 | 180 |
|
180 | 181 | /**
|
@@ -210,10 +211,14 @@ void device_unblock_probing(void)
|
210 | 211 | */
|
211 | 212 | static int deferred_probe_initcall(void)
|
212 | 213 | {
|
| 214 | + deferred_wq = create_singlethread_workqueue("deferwq"); |
| 215 | + if (WARN_ON(!deferred_wq)) |
| 216 | + return -ENOMEM; |
| 217 | + |
213 | 218 | driver_deferred_probe_enable = true;
|
214 | 219 | driver_deferred_probe_trigger();
|
215 | 220 | /* Sort as many dependencies as possible before exiting initcalls */
|
216 |
| - flush_work(&deferred_probe_work); |
| 221 | + flush_workqueue(deferred_wq); |
217 | 222 | return 0;
|
218 | 223 | }
|
219 | 224 | late_initcall(deferred_probe_initcall);
|
@@ -477,7 +482,8 @@ int driver_probe_done(void)
|
477 | 482 | void wait_for_device_probe(void)
|
478 | 483 | {
|
479 | 484 | /* wait for the deferred probe workqueue to finish */
|
480 |
| - flush_work(&deferred_probe_work); |
| 485 | + if (driver_deferred_probe_enable) |
| 486 | + flush_workqueue(deferred_wq); |
481 | 487 |
|
482 | 488 | /* wait for the known devices to complete their probing */
|
483 | 489 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
|
|
0 commit comments