From a51e9948d16815d900d994732e1d348106814ad0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 25 Sep 2026 11:25:44 -0700 Subject: [PATCH] scsi: NCR5380: Prepare for enabling lock context analysis Pass the struct NCR5380_hostdata pointer directly to NCR5380_select() and NCR5380_information_transfer() instead of the struct Scsi_Host pointer. This ensures that the lock context annotations (__releases(&hostdata->lock) and __acquires(&hostdata->lock)) refer to a function argument. Update callers and function prototypes accordingly. Cc: Finn Thain Cc: Michael Schmitz Signed-off-by: Bart Van Assche Acked-by: Finn Thain Link: https://patch.msgid.link/a9d1b960868ac4dae9c5a9b98aea5dcf6713fb97.1790360262.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/NCR5380.c | 19 ++++++++++--------- drivers/scsi/NCR5380.h | 5 +++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 006dcf981218..6afbd5936892 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -718,7 +718,7 @@ static void NCR5380_main(struct work_struct *work) * entire unit. */ - if (!NCR5380_select(instance, cmd)) { + if (!NCR5380_select(hostdata, cmd)) { dsprintk(NDEBUG_MAIN, instance, "main: select complete\n"); } else { dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance, @@ -728,7 +728,7 @@ static void NCR5380_main(struct work_struct *work) } if (hostdata->connected && !hostdata->dma_len) { dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n"); - NCR5380_information_transfer(instance); + NCR5380_information_transfer(hostdata); done = 0; } if (!hostdata->connected) { @@ -937,7 +937,7 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) /** * NCR5380_select - attempt arbitration and selection for a given command - * @instance: the Scsi_Host instance + * @hostdata: host private data * @cmd: the scsi_cmnd to execute * * This routine establishes an I_T_L nexus for a SCSI command. This involves @@ -960,10 +960,11 @@ static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id) * cmd->result host byte set to DID_BAD_TARGET. */ -static bool NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) +static bool NCR5380_select(struct NCR5380_hostdata *hostdata, + struct scsi_cmnd *cmd) __releases(&hostdata->lock) __acquires(&hostdata->lock) { - struct NCR5380_hostdata *hostdata = shost_priv(instance); + struct Scsi_Host *instance = hostdata->host; unsigned char tmp[3], phase; unsigned char *data; int len; @@ -1643,23 +1644,23 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, } /* - * Function : NCR5380_information_transfer (struct Scsi_Host *instance) + * Function : NCR5380_information_transfer(struct NCR5380_hostdata *hostdata) * * Purpose : run through the various SCSI phases and do as the target * directs us to. Operates on the currently connected command, * instance->connected. * - * Inputs : instance, instance for which we are doing commands + * Inputs : hostdata, the private host data * * Side effects : SCSI things happen, the disconnected queue will be * modified if a command disconnects, *instance->connected will * change. */ -static void NCR5380_information_transfer(struct Scsi_Host *instance) +static void NCR5380_information_transfer(struct NCR5380_hostdata *hostdata) __releases(&hostdata->lock) __acquires(&hostdata->lock) { - struct NCR5380_hostdata *hostdata = shost_priv(instance); + struct Scsi_Host *instance = hostdata->host; unsigned char msgout = NOP; int sink = 0; int len; diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index d402d4bffcb2..450b08da5858 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h @@ -278,12 +278,13 @@ static void NCR5380_print(struct Scsi_Host *instance); static int NCR5380_init(struct Scsi_Host *instance, int flags); static int NCR5380_maybe_reset_bus(struct Scsi_Host *); static void NCR5380_exit(struct Scsi_Host *instance); -static void NCR5380_information_transfer(struct Scsi_Host *instance); +static void NCR5380_information_transfer(struct NCR5380_hostdata *hostdata); static irqreturn_t NCR5380_intr(int irq, void *dev_id); static void NCR5380_main(struct work_struct *work); static const char *NCR5380_info(struct Scsi_Host *instance); static void NCR5380_reselect(struct Scsi_Host *instance); -static bool NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *); +static bool NCR5380_select(struct NCR5380_hostdata *hostdata, + struct scsi_cmnd *); static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); static void NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count,