On Fri, 4 Jul 2014, loody wrote: > hi all: > when I trace kernel driver source about usb scsi storage driver, I > have below 2 questions: > 1. in sd.c -> static int sd_probe(struct device *dev) > we use below macro to get scsi_device. > struct scsi_device *sdp = to_scsi_device(dev); > > take usb for example, is usb storage driver allocate memory for > scsi_device then calling sd_probe? No. > I am looking for usb_stor_probe1 and usb_stor_probe2 but not find > where it is. Because it's not there. The memory is allocated by drivers/scsi/scsi_scan.c:scsi_alloc_sdev(). > 2. at the end of sd.c -> sd_probe, why we call async_schedule_domain like below > async_schedule_domain(sd_probe_async, sdkp, &scsi_sd_probe_domain); > to finish scsi device initialization? > Couldn't we put what sd_probe_async directly in sd_probe? > is there any benefit to do so? Like Maurizio said, the benefit is that the probe routine will return quickly so that other devices can be probed while the drive spins up. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html