Re: usb: storage: what is the correct sequence for? sd_probe| storage_probe/1/2 and uas_probe | scsi_scan_host

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

 



On Tue, 15 May 2018, Tushar Nimkar wrote:

> Everyone,
> 
> Please help me in understanding sd_probe| storage_probe/1/2 and 
> uas_probe | scsi_scan_host :)
> Basically want to know the correct sequence for them? How 
> sd_probe_async() is called (ASYNC_DOMAIN(scsi_sd_probe_domain))?

Very briefly:

The probe routine for usb-storage is storage_probe(), which calls
usb_stor_probe1() and usb_stor_probe2().  Similarly, the probe routine 
for uas is uas_probe().  Each driver's probe routine is called by the 
driver core (drivers/base/dd.c) when a new device of the appropriate 
type is detected.

usb_stor_probe2() starts a workqueue routine, usb_stor_scan_dwork(), 
which calls scsi_scan_host(), whereas uas_probe() calls 
scsi_scan_host() directly.  Either way, scsi_scan_host() usually sets 
up an async worker to carry out the actual scanning.  The scanning is 
started by scsi_scan_target() and the various routines it calls.

When the scanning procedure registers a SCSI device that is a 
disk-drive-like device, the sd driver's sd_probe() routine is called by 
the driver core.  sd_probe() does some of the initial work needed to 
probe the device, and it defers the rest of the work to the async 
worker routine sd_probe_async().

> Is there any document which say it in detail ?

No.  UTSL.  You might concentrate on include/linux/async.h and
kernel/async.c (and you should be able to figure that much out for
yourself without asking the mailing list).

Alan Stern

--
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