Questions: SCSI host adapter detection and registration

Itai Nahshon (
Tue, 26 Mar 2002 03:51:27 +0200

I have some questions about SCSI host adapter detection
and registration.

I'm looking a the code in scsi/scsi.c, scsi/hosts.c and sample
scsi host adapter drivers.

For simplicity, I assume the host adapter driver is in a module and it's
just loaded (insights about hot-pluggable devices are welcome).

Here are the major steps as I understand them:
1. Module init code calling scsi_register_module() which
immediately calls scsi_register_hosts().
2. scsi_register_host() calls the driver's detect function.
3. The driver's detect function calls scsi_register() for each
host (or is it bus?) that it detects.
4. The driver's detect function returns 0 if nothing detected. non
zero if a host adapter was detected.

My questions:
a. Is any lock held when scsi_register_hosts() is called?
b. scsi_register_hosts() protects the detect call with io_request_lock
_only_ if use_new_eh_code. Why?
c. If a host was detected, there is a code that checks if next_scsi_host
was actually incremented... Are there drivers that do not call
scsi_register() ? Is it for historical or real reason?
Is it possible (at least in theory) that some driver will change
next_scsi_host behind our back (hot-pluggable devices)?

Thank you very much,
-- Itai

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at