public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Subject: [PATCH 29/36] scsi: qla1280: Prepare for enabling lock context analysis
Date: Thu, 12 Mar 2026 14:15:40 -0700	[thread overview]
Message-ID: <20260312211636.3245119-30-bvanassche@acm.org> (raw)
In-Reply-To: <20260312211636.3245119-1-bvanassche@acm.org>

Document locking requirements with __must_hold().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla1280.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index cdd6fe002c32..ebc878068684 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -737,6 +737,7 @@ static void qla1280_mailbox_timeout(struct timer_list *t)
 static int
 _qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp,
 				 struct completion *wait)
+	__must_hold(ha->host->host_lock)
 {
 	int	status = FAILED;
 	struct scsi_cmnd *cmd = sp->cmd;
@@ -754,6 +755,7 @@ _qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp,
 
 static int
 qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp)
+	__must_hold(ha->host->host_lock)
 {
 	DECLARE_COMPLETION_ONSTACK(wait);
 
@@ -763,6 +765,7 @@ qla1280_wait_for_single_command(struct scsi_qla_host *ha, struct srb *sp)
 
 static int
 qla1280_wait_for_pending_commands(struct scsi_qla_host *ha, int bus, int target)
+	__must_hold(ha->host->host_lock)
 {
 	int		cnt;
 	int		status;
@@ -809,6 +812,7 @@ qla1280_wait_for_pending_commands(struct scsi_qla_host *ha, int bus, int target)
  **************************************************************************/
 static int
 qla1280_error_action(struct scsi_cmnd *cmd, enum action action)
+	__must_hold(cmd->device->host->host_lock)
 {
 	struct scsi_qla_host *ha;
 	int bus, target, lun;
@@ -822,6 +826,10 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action)
 	ENTER("qla1280_error_action");
 
 	ha = (struct scsi_qla_host *)(CMD_HOST(cmd)->hostdata);
+
+	/* Tell the compiler that ha->host == cmd->device->host. */
+	__assume_ctx_lock(ha->host->host_lock);
+
 	sp = scsi_cmd_priv(cmd);
 	bus = SCSI_BUS_32(cmd);
 	target = SCSI_TCN_32(cmd);
@@ -1490,6 +1498,7 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha)
  */
 static const struct firmware *
 qla1280_request_firmware(struct scsi_qla_host *ha)
+	__must_hold(ha->host->host_lock)
 {
 	const struct firmware *fw;
 	int err;
@@ -1655,6 +1664,7 @@ qla1280_chip_diag(struct scsi_qla_host *ha)
 
 static int
 qla1280_load_firmware_pio(struct scsi_qla_host *ha)
+	__must_hold(ha->host->host_lock)
 {
 	/* enter with host_lock acquired */
 
@@ -1705,6 +1715,7 @@ qla1280_load_firmware_pio(struct scsi_qla_host *ha)
 #define DUMP_IT_BACK 0		/* for debug of RISC loading */
 static int
 qla1280_load_firmware_dma(struct scsi_qla_host *ha)
+	__must_hold(ha->host->host_lock)
 {
 	/* enter with host_lock acquired */
 	const struct firmware *fw;
@@ -1844,6 +1855,7 @@ qla1280_start_firmware(struct scsi_qla_host *ha)
 
 static int
 qla1280_load_firmware(struct scsi_qla_host *ha)
+	__must_hold(ha->host->host_lock)
 {
 	/* enter with host_lock taken */
 	int err;
@@ -2413,6 +2425,7 @@ qla1280_nv_write(struct scsi_qla_host *ha, uint16_t data)
  */
 static int
 qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
+	__must_hold(ha->host->host_lock)
 {
 	struct device_reg __iomem *reg = ha->iobase;
 	int status = 0;
@@ -2538,6 +2551,7 @@ qla1280_poll(struct scsi_qla_host *ha)
  */
 static int
 qla1280_bus_reset(struct scsi_qla_host *ha, int bus)
+	__must_hold(ha->host->host_lock)
 {
 	uint16_t mb[MAILBOX_REGISTER_COUNT];
 	uint16_t reset_delay;
@@ -2598,6 +2612,7 @@ qla1280_bus_reset(struct scsi_qla_host *ha, int bus)
  */
 static int
 qla1280_device_reset(struct scsi_qla_host *ha, int bus, int target)
+	__must_hold(ha->host->host_lock)
 {
 	uint16_t mb[MAILBOX_REGISTER_COUNT];
 	int status;
@@ -2632,6 +2647,7 @@ qla1280_device_reset(struct scsi_qla_host *ha, int bus, int target)
  */
 static int
 qla1280_abort_command(struct scsi_qla_host *ha, struct srb * sp, int handle)
+	__must_hold(ha->host->host_lock)
 {
 	uint16_t mb[MAILBOX_REGISTER_COUNT];
 	unsigned int bus, target, lun;
@@ -3749,6 +3765,7 @@ qla1280_error_entry(struct scsi_qla_host *ha, struct response *pkt,
  */
 static int
 qla1280_abort_isp(struct scsi_qla_host *ha)
+	__must_hold(ha->host->host_lock)
 {
 	struct device_reg __iomem *reg = ha->iobase;
 	struct srb *sp;
@@ -3881,6 +3898,7 @@ qla1280_check_for_dead_scsi_bus(struct scsi_qla_host *ha, unsigned int bus)
 static void
 qla1280_get_target_parameters(struct scsi_qla_host *ha,
 			      struct scsi_device *device)
+	__must_hold(ha->host->host_lock)
 {
 	uint16_t mb[MAILBOX_REGISTER_COUNT];
 	int bus, target, lun;

  parent reply	other threads:[~2026-03-12 21:18 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 21:15 [PATCH 00/36] Enable lock context analysis for most SCSI drivers Bart Van Assche
2026-03-12 21:15 ` [PATCH 01/36] scsi: core: Prepare for enabling lock context analysis Bart Van Assche
2026-03-12 21:15 ` [PATCH 02/36] scsi: scsi_debug: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 03/36] scsi: sg: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 04/36] scsi: st: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 05/36] scsi: BusLogic: Introduce a local variable Bart Van Assche
2026-03-26 20:50   ` Khalid Aziz
2026-03-12 21:15 ` [PATCH 06/36] scsi: BusLogic: Prepare for enabling lock context analysis Bart Van Assche
2026-03-26 20:59   ` Khalid Aziz
2026-03-12 21:15 ` [PATCH 07/36] scsi: NCR5380: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 08/36] scsi: aacraid: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 09/36] scsi: aha152x: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 10/36] scsi: aic7xxx: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 11/36] scsi: be2iscsi: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 12/36] scsi: bnx2fc: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 13/36] scsi: bnx2i: Introduce a local variable Bart Van Assche
2026-03-12 21:15 ` [PATCH 14/36] scsi: bnx2i: Prepare for enabling lock context analysis Bart Van Assche
2026-03-12 21:15 ` [PATCH 15/36] scsi: csiostor: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 16/36] scsi: fnic: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 17/36] scsi: hpsa: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 18/36] scsi: ibmvscsi_tgt: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 19/36] scsi: ipr: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 20/36] scsi: ips: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 21/36] scsi: libfc: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 22/36] scsi: libiscsi: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 23/36] scsi: libsas: " Bart Van Assche
2026-03-13  1:35   ` Jason Yan
2026-03-12 21:15 ` [PATCH 24/36] scsi: lpfc: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 25/36] scsi: megaraid_sas: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 26/36] scsi: mvsas: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 27/36] scsi: pm8001: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 28/36] scsi: qedi: " Bart Van Assche
2026-03-12 21:15 ` Bart Van Assche [this message]
2026-03-12 21:15 ` [PATCH 30/36] scsi: qla2xxx: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 31/36] scsi: qla4xxx: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 32/36] scsi: ufs: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 33/36] scsi: iSCSI transport: " Bart Van Assche
2026-03-12 21:15 ` [PATCH 34/36] scsi: smartpqi: " Bart Van Assche
2026-03-16 15:36   ` Don.Brace
2026-03-12 21:15 ` [PATCH 35/36] scsi: Enable " Bart Van Assche
2026-03-12 21:15 ` [PATCH 36/36] scsi: core: Protect host state changes with the host lock Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260312211636.3245119-30-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox