Re: [PATCH v5 3/6] scsi: core: Pass the SCSI host pointer directly to scanning functions

John Garry <[email protected]> Thu, 6 Aug 2026 10:02:04 +0100
Newsgroups gmane.linux.scsi
Organization Oracle Corporation
Message-ID <[email protected]>
On 05/08/2026 22:36, Bart Van Assche wrote:
> In the functions scsi_probe_and_add_lun(), scsi_sequential_lun_scan(),
> scsi_report_lun_scan() and __scsi_scan_target() the SCSI host pointer is
> derived from the SCSI target pointer. Pass the SCSI host pointer
> directly.
> 
> This patch prepares for enabling lock context analysis. With this patch
> applied, lock context annotations can refer to the SCSI host pointer
> directly, e.g. __must_hold(&shost->scan_mutex). Without this patch, the
> following annotation would have to be used:
> 	__must_hold(&dev_to_shost(starget->dev.parent)->scan_mutex)
> Additionally, in code that locks shost->scan_mutex, the following would
> have to be added to help the compiler understand that shost ==
> dev_to_shost(starget->dev.parent):
> 	__assume_ctx_lock(&dev_to_shost(starget->dev.parent)->scan_mutex);
> __assume_ctx_lock() statements should be avoided if there is a good
> alternative. Hence this patch. No functionality has been changed.
> 
> Signed-off-by: Bart Van Assche<[email protected]>

Reviewed-by: John Garry <[email protected]>