Matthew Wilcox | 3e082a9 | 2006-09-28 15:19:20 -0600 | [diff] [blame] | 1 | /* |
| 2 | * scsi_wait_scan.c |
| 3 | * |
| 4 | * Copyright (C) 2006 James Bottomley <James.Bottomley@SteelEye.com> |
| 5 | * |
| 6 | * This is a simple module to wait until all the async scans are |
| 7 | * complete. The idea is to use it in initrd/initramfs scripts. You |
| 8 | * modprobe it after all the modprobes of the root SCSI drivers and it |
| 9 | * will wait until they have all finished scanning their busses before |
| 10 | * allowing the boot to proceed |
| 11 | */ |
| 12 | |
| 13 | #include <linux/module.h> |
Arjan van de Ven | d4d5291 | 2009-04-21 13:32:54 -0700 | [diff] [blame] | 14 | #include <linux/device.h> |
Rafael J. Wysocki | c751085 | 2009-04-12 20:06:56 +0200 | [diff] [blame] | 15 | #include <scsi/scsi_scan.h> |
Matthew Wilcox | 3e082a9 | 2006-09-28 15:19:20 -0600 | [diff] [blame] | 16 | |
| 17 | static int __init wait_scan_init(void) |
| 18 | { |
Arjan van de Ven | d4d5291 | 2009-04-21 13:32:54 -0700 | [diff] [blame] | 19 | /* |
| 20 | * First we need to wait for device probing to finish; |
| 21 | * the drivers we just loaded might just still be probing |
| 22 | * and might not yet have reached the scsi async scanning |
| 23 | */ |
| 24 | wait_for_device_probe(); |
| 25 | /* |
| 26 | * and then we wait for the actual asynchronous scsi scan |
| 27 | * to finish. |
| 28 | */ |
Matthew Wilcox | 3e082a9 | 2006-09-28 15:19:20 -0600 | [diff] [blame] | 29 | scsi_complete_async_scans(); |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static void __exit wait_scan_exit(void) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | MODULE_DESCRIPTION("SCSI wait for scans"); |
| 38 | MODULE_AUTHOR("James Bottomley"); |
| 39 | MODULE_LICENSE("GPL"); |
| 40 | |
| 41 | late_initcall(wait_scan_init); |
| 42 | module_exit(wait_scan_exit); |