All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 79/84] xen-scsifront: Call scsi_done() directly
@ 2021-09-21 17:34 Bart Van Assche
  2021-09-21 17:34 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

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

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 0204e314b482..12c10a5e3d93 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -276,7 +276,7 @@ static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info,
 	if (sense_len)
 		memcpy(sc->sense_buffer, ring_rsp->sense_buffer, sense_len);
 
-	sc->scsi_done(sc);
+	scsi_done(sc);
 }
 
 static void scsifront_sync_cmd_done(struct vscsifrnt_info *info,
@@ -558,7 +558,7 @@ static int scsifront_queuecommand(struct Scsi_Host *shost,
 		if (err == -ENOMEM)
 			return SCSI_MLQUEUE_HOST_BUSY;
 		sc->result = DID_ERROR << 16;
-		sc->scsi_done(sc);
+		scsi_done(sc);
 		return 0;
 	}
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 80/84] staging: rts5208: Call scsi_done() directly
  2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
@ 2021-09-21 17:34 ` Bart Van Assche
  2021-09-22  6:30   ` Greg Kroah-Hartman
  2021-09-21 17:34 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley, Greg Kroah-Hartman

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/staging/rts5208/rtsx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 898add4d1fc8..f1136f6bcee2 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 	}
 
 	/* enqueue the command and wake up the control thread */
-	srb->scsi_done = done;
 	chip->srb = srb;
 	complete(&dev->cmnd_ready);
 
@@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
 
 		/* indicate that the command is done */
 		else if (chip->srb->result != DID_ABORT << 16) {
-			chip->srb->scsi_done(chip->srb);
+			scsi_done(chip->srb);
 		} else {
 skip_for_abort:
 			dev_err(&dev->pci->dev, "scsi command aborted\n");
@@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
 	if (chip->srb) {
 		chip->srb->result = DID_NO_CONNECT << 16;
 		scsi_lock(host);
-		chip->srb->scsi_done(dev->chip->srb);
+		scsi_done(dev->chip->srb);
 		chip->srb = NULL;
 		scsi_unlock(host);
 	}

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 81/84] staging: unisys: visorhba: Call scsi_done() directly
  2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
  2021-09-21 17:34 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
@ 2021-09-21 17:34 ` Bart Van Assche
  2021-09-23  6:49   ` Greg Kroah-Hartman
  2021-09-21 17:34 ` [PATCH 82/84] target/tcm_loop: " Bart Van Assche
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley, David Kershner, Greg Kroah-Hartman,
	Fabio M. De Francesco, Dan Carpenter, Song Chen

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 41f8a72a2a95..6a8fa0587280 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -327,7 +327,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
 	rtn = forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsidev);
 	if (rtn == SUCCESS) {
 		scsicmd->result = DID_ABORT << 16;
-		scsicmd->scsi_done(scsicmd);
+		scsi_done(scsicmd);
 	}
 	return rtn;
 }
@@ -354,7 +354,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)
 	rtn = forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsidev);
 	if (rtn == SUCCESS) {
 		scsicmd->result = DID_RESET << 16;
-		scsicmd->scsi_done(scsicmd);
+		scsi_done(scsicmd);
 	}
 	return rtn;
 }
@@ -383,7 +383,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)
 	rtn = forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsidev);
 	if (rtn == SUCCESS) {
 		scsicmd->result = DID_RESET << 16;
-		scsicmd->scsi_done(scsicmd);
+		scsi_done(scsicmd);
 	}
 	return rtn;
 }
@@ -476,8 +476,7 @@ static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
 	 */
 	cmdrsp->scsi.handle = insert_location;
 
-	/* save done function that we have call when cmd is complete */
-	scsicmd->scsi_done = visorhba_cmnd_done;
+	WARN_ON_ONCE(visorhba_cmnd_done != scsi_done);
 	/* save destination */
 	cmdrsp->scsi.vdest.channel = scsidev->channel;
 	cmdrsp->scsi.vdest.id = scsidev->id;
@@ -686,8 +685,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)
 		case CMD_SCSI_TYPE:
 			scsicmd = pendingdel->sent;
 			scsicmd->result = DID_RESET << 16;
-			if (scsicmd->scsi_done)
-				scsicmd->scsi_done(scsicmd);
+			scsi_done(scsicmd);
 			break;
 		case CMD_SCSITASKMGMT_TYPE:
 			cmdrsp = pendingdel->sent;
@@ -853,7 +851,7 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp,
 	else
 		do_scsi_nolinuxstat(cmdrsp, scsicmd);
 
-	scsicmd->scsi_done(scsicmd);
+	scsi_done(scsicmd);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 82/84] target/tcm_loop: Call scsi_done() directly
  2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
  2021-09-21 17:34 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
  2021-09-21 17:34 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
@ 2021-09-21 17:34 ` Bart Van Assche
  2021-09-21 17:34 ` [PATCH 83/84] usb: " Bart Van Assche
  2021-09-21 17:34 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
  4 siblings, 0 replies; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley, Mike Christie, Bjorn Andersson,
	Himanshu Madhani, Hannes Reinecke, Uwe Kleine-König,
	Colin Ian King

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/target/loopback/tcm_loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 52db28d868d5..4407b56aa6d1 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -71,7 +71,7 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd)
 	if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
 		kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
 	else
-		sc->scsi_done(sc);
+		scsi_done(sc);
 }
 
 static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host)
@@ -165,7 +165,7 @@ static void tcm_loop_target_queue_cmd(struct tcm_loop_cmd *tl_cmd)
 	return;
 
 out_done:
-	sc->scsi_done(sc);
+	scsi_done(sc);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 83/84] usb: Call scsi_done() directly
  2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
                   ` (2 preceding siblings ...)
  2021-09-21 17:34 ` [PATCH 82/84] target/tcm_loop: " Bart Van Assche
@ 2021-09-21 17:34 ` Bart Van Assche
  2021-09-21 17:34 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
  4 siblings, 0 replies; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley, Alan Stern, Greg Kroah-Hartman,
	Oliver Neukum

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/usb/storage/scsiglue.c |  1 -
 drivers/usb/storage/uas.c      | 10 ++++------
 drivers/usb/storage/usb.c      |  4 ++--
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index e5a971b83e3f..9dfea19e5a91 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -393,7 +393,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 	}
 
 	/* enqueue the command and wake up the control thread */
-	srb->scsi_done = done;
 	us->srb = srb;
 	complete(&us->cmnd_ready);
 
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index bef89c6bd1d7..774d18907f47 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -256,7 +256,7 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)
 		return -EBUSY;
 	devinfo->cmnd[cmdinfo->uas_tag - 1] = NULL;
 	uas_free_unsubmitted_urbs(cmnd);
-	cmnd->scsi_done(cmnd);
+	scsi_done(cmnd);
 	return 0;
 }
 
@@ -653,7 +653,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 		memcpy(cmnd->sense_buffer, usb_stor_sense_invalidCDB,
 		       sizeof(usb_stor_sense_invalidCDB));
 		cmnd->result = SAM_STAT_CHECK_CONDITION;
-		cmnd->scsi_done(cmnd);
+		scsi_done(cmnd);
 		return 0;
 	}
 
@@ -661,7 +661,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 
 	if (devinfo->resetting) {
 		set_host_byte(cmnd, DID_ERROR);
-		cmnd->scsi_done(cmnd);
+		scsi_done(cmnd);
 		goto zombie;
 	}
 
@@ -675,8 +675,6 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 	}
 
-	cmnd->scsi_done = done;
-
 	memset(cmdinfo, 0, sizeof(*cmdinfo));
 	cmdinfo->uas_tag = idx + 1; /* uas-tag == usb-stream-id, so 1 based */
 	cmdinfo->state = SUBMIT_STATUS_URB | ALLOC_CMD_URB | SUBMIT_CMD_URB;
@@ -706,7 +704,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 	 */
 	if (err == -ENODEV) {
 		set_host_byte(cmnd, DID_ERROR);
-		cmnd->scsi_done(cmnd);
+		scsi_done(cmnd);
 		goto zombie;
 	}
 	if (err) {
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 90aa9c12ffac..8b543f2c9857 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -388,7 +388,7 @@ static int usb_stor_control_thread(void * __us)
 		if (srb->result == DID_ABORT << 16) {
 SkipForAbort:
 			usb_stor_dbg(us, "scsi command aborted\n");
-			srb = NULL;	/* Don't call srb->scsi_done() */
+			srb = NULL;	/* Don't call scsi_done() */
 		}
 
 		/*
@@ -417,7 +417,7 @@ static int usb_stor_control_thread(void * __us)
 		if (srb) {
 			usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
 					srb->result);
-			srb->scsi_done(srb);
+			scsi_done(srb);
 		}
 	} /* for (;;) */
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 84/84] scsi_lib: Call scsi_done() directly
  2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
                   ` (3 preceding siblings ...)
  2021-09-21 17:34 ` [PATCH 83/84] usb: " Bart Van Assche
@ 2021-09-21 17:34 ` Bart Van Assche
  4 siblings, 0 replies; 11+ messages in thread
From: Bart Van Assche @ 2021-09-21 17:34 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly. Since this patch removes the last user of the
scsi_done member, also remove that data structure member.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c  | 3 +--
 include/scsi/scsi_cmnd.h | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c3a0283dbff0..be1a21cec54b 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1520,7 +1520,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 
 	return rtn;
  done:
-	cmd->scsi_done(cmd);
+	scsi_done(cmd);
 	return 0;
 }
 
@@ -1693,7 +1693,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
 
 	scsi_set_resid(cmd, 0);
 	memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-	cmd->scsi_done = scsi_done;
 
 	blk_mq_start_request(req);
 	reason = scsi_dispatch_cmd(cmd);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 5b230d06527f..045f8c08ab70 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -124,10 +124,6 @@ struct scsi_cmnd {
 				 * command (auto-sense). Length must be
 				 * SCSI_SENSE_BUFFERSIZE bytes. */
 
-	/* Low-level done function - can be used by low-level driver to point
-	 *        to completion function.  Not used by mid/upper level code. */
-	void (*scsi_done) (struct scsi_cmnd *);
-
 	/*
 	 * The following fields can be written to by the host specific code. 
 	 * Everything else should be left alone. 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 80/84] staging: rts5208: Call scsi_done() directly
  2021-09-21 17:34 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
@ 2021-09-22  6:30   ` Greg Kroah-Hartman
  2021-09-22 16:31     ` Bart Van Assche
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-22  6:30 UTC (permalink / raw)
  To: 20210918000607.450448-1-bvanassche
  Cc: Martin K . Petersen, linux-scsi, Bart Van Assche,
	Boris Ostrovsky, Juergen Gross, James E.J. Bottomley

On Tue, Sep 21, 2021 at 10:34:32AM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/staging/rts5208/rtsx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> index 898add4d1fc8..f1136f6bcee2 100644
> --- a/drivers/staging/rts5208/rtsx.c
> +++ b/drivers/staging/rts5208/rtsx.c
> @@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
>  	}
>  
>  	/* enqueue the command and wake up the control thread */
> -	srb->scsi_done = done;
>  	chip->srb = srb;
>  	complete(&dev->cmnd_ready);
>  
> @@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
>  
>  		/* indicate that the command is done */
>  		else if (chip->srb->result != DID_ABORT << 16) {
> -			chip->srb->scsi_done(chip->srb);
> +			scsi_done(chip->srb);
>  		} else {
>  skip_for_abort:
>  			dev_err(&dev->pci->dev, "scsi command aborted\n");
> @@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
>  	if (chip->srb) {
>  		chip->srb->result = DID_NO_CONNECT << 16;
>  		scsi_lock(host);
> -		chip->srb->scsi_done(dev->chip->srb);
> +		scsi_done(dev->chip->srb);
>  		chip->srb = NULL;
>  		scsi_unlock(host);
>  	}

I do not see the whole thread of this series on any mailing list (or
lore.kernel.org), so I do not know if you are wanting these to go
through the individual subsystem trees, or if they have to go through
the scsi tree as one large series due to dependancies.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 80/84] staging: rts5208: Call scsi_done() directly
  2021-09-22  6:30   ` Greg Kroah-Hartman
@ 2021-09-22 16:31     ` Bart Van Assche
  0 siblings, 0 replies; 11+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman, 20210918000607.450448-1-bvanassche
  Cc: Martin K . Petersen, linux-scsi, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley

On 9/21/21 11:30 PM, Greg Kroah-Hartman wrote:
> I do not see the whole thread of this series on any mailing list (or
> lore.kernel.org), so I do not know if you are wanting these to go
> through the individual subsystem trees, or if they have to go through
> the scsi tree as one large series due to dependancies.

Hi Greg,

Apparently the email service I'm using (gmail) does not support patch series
with more than 78 patches. These six patches are my (failed) attempt to amend
the remaining patches to the original patch series. Anyway, the entire patch
series is available here:

https://lore.kernel.org/linux-scsi/20210918000607.450448-1-bvanassche@acm.org/

Patch 84/84 depends on the previous patches in that series. Hence my request
for Martin to queue this series via the SCSI tree.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 81/84] staging: unisys: visorhba: Call scsi_done() directly
  2021-09-21 17:34 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
@ 2021-09-23  6:49   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-23  6:49 UTC (permalink / raw)
  To: 20210918000607.450448-1-bvanassche
  Cc: Martin K . Petersen, linux-scsi, Bart Van Assche,
	Boris Ostrovsky, Juergen Gross, James E.J. Bottomley,
	David Kershner, Fabio M. De Francesco, Dan Carpenter, Song Chen

On Tue, Sep 21, 2021 at 10:34:33AM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/staging/unisys/visorhba/visorhba_main.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
> index 41f8a72a2a95..6a8fa0587280 100644
> --- a/drivers/staging/unisys/visorhba/visorhba_main.c
> +++ b/drivers/staging/unisys/visorhba/visorhba_main.c
> @@ -327,7 +327,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
>  	rtn = forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsidev);
>  	if (rtn == SUCCESS) {
>  		scsicmd->result = DID_ABORT << 16;
> -		scsicmd->scsi_done(scsicmd);
> +		scsi_done(scsicmd);
>  	}
>  	return rtn;
>  }
> @@ -354,7 +354,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)
>  	rtn = forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsidev);
>  	if (rtn == SUCCESS) {
>  		scsicmd->result = DID_RESET << 16;
> -		scsicmd->scsi_done(scsicmd);
> +		scsi_done(scsicmd);
>  	}
>  	return rtn;
>  }
> @@ -383,7 +383,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)
>  	rtn = forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsidev);
>  	if (rtn == SUCCESS) {
>  		scsicmd->result = DID_RESET << 16;
> -		scsicmd->scsi_done(scsicmd);
> +		scsi_done(scsicmd);
>  	}
>  	return rtn;
>  }
> @@ -476,8 +476,7 @@ static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
>  	 */
>  	cmdrsp->scsi.handle = insert_location;
>  
> -	/* save done function that we have call when cmd is complete */
> -	scsicmd->scsi_done = visorhba_cmnd_done;
> +	WARN_ON_ONCE(visorhba_cmnd_done != scsi_done);
>  	/* save destination */
>  	cmdrsp->scsi.vdest.channel = scsidev->channel;
>  	cmdrsp->scsi.vdest.id = scsidev->id;
> @@ -686,8 +685,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)
>  		case CMD_SCSI_TYPE:
>  			scsicmd = pendingdel->sent;
>  			scsicmd->result = DID_RESET << 16;
> -			if (scsicmd->scsi_done)
> -				scsicmd->scsi_done(scsicmd);
> +			scsi_done(scsicmd);
>  			break;
>  		case CMD_SCSITASKMGMT_TYPE:
>  			cmdrsp = pendingdel->sent;
> @@ -853,7 +851,7 @@ static void complete_scsi_command(struct uiscmdrsp *cmdrsp,
>  	else
>  		do_scsi_nolinuxstat(cmdrsp, scsicmd);
>  
> -	scsicmd->scsi_done(scsicmd);
> +	scsi_done(scsicmd);
>  }
>  
>  /*

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 80/84] staging: rts5208: Call scsi_done() directly
  2021-09-22 16:25   ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
@ 2021-09-23  6:49     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-23  6:49 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley

On Wed, Sep 22, 2021 at 09:25:58AM -0700, Bart Van Assche wrote:
> Conditional statements are faster than indirect calls. Hence call
> scsi_done() directly.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/staging/rts5208/rtsx.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> index 898add4d1fc8..f1136f6bcee2 100644
> --- a/drivers/staging/rts5208/rtsx.c
> +++ b/drivers/staging/rts5208/rtsx.c
> @@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
>  	}
>  
>  	/* enqueue the command and wake up the control thread */
> -	srb->scsi_done = done;
>  	chip->srb = srb;
>  	complete(&dev->cmnd_ready);
>  
> @@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
>  
>  		/* indicate that the command is done */
>  		else if (chip->srb->result != DID_ABORT << 16) {
> -			chip->srb->scsi_done(chip->srb);
> +			scsi_done(chip->srb);
>  		} else {
>  skip_for_abort:
>  			dev_err(&dev->pci->dev, "scsi command aborted\n");
> @@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
>  	if (chip->srb) {
>  		chip->srb->result = DID_NO_CONNECT << 16;
>  		scsi_lock(host);
> -		chip->srb->scsi_done(dev->chip->srb);
> +		scsi_done(dev->chip->srb);
>  		chip->srb = NULL;
>  		scsi_unlock(host);
>  	}

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 80/84] staging: rts5208: Call scsi_done() directly
  2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
@ 2021-09-22 16:25   ` Bart Van Assche
  2021-09-23  6:49     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Van Assche @ 2021-09-22 16:25 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Boris Ostrovsky, Juergen Gross,
	James E.J. Bottomley, Greg Kroah-Hartman

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/staging/rts5208/rtsx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 898add4d1fc8..f1136f6bcee2 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -140,7 +140,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
 	}
 
 	/* enqueue the command and wake up the control thread */
-	srb->scsi_done = done;
 	chip->srb = srb;
 	complete(&dev->cmnd_ready);
 
@@ -423,7 +422,7 @@ static int rtsx_control_thread(void *__dev)
 
 		/* indicate that the command is done */
 		else if (chip->srb->result != DID_ABORT << 16) {
-			chip->srb->scsi_done(chip->srb);
+			scsi_done(chip->srb);
 		} else {
 skip_for_abort:
 			dev_err(&dev->pci->dev, "scsi command aborted\n");
@@ -635,7 +634,7 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
 	if (chip->srb) {
 		chip->srb->result = DID_NO_CONNECT << 16;
 		scsi_lock(host);
-		chip->srb->scsi_done(dev->chip->srb);
+		scsi_done(dev->chip->srb);
 		chip->srb = NULL;
 		scsi_unlock(host);
 	}

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-23  6:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 17:34 [PATCH 79/84] xen-scsifront: Call scsi_done() directly Bart Van Assche
2021-09-21 17:34 ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
2021-09-22  6:30   ` Greg Kroah-Hartman
2021-09-22 16:31     ` Bart Van Assche
2021-09-21 17:34 ` [PATCH 81/84] staging: unisys: visorhba: " Bart Van Assche
2021-09-23  6:49   ` Greg Kroah-Hartman
2021-09-21 17:34 ` [PATCH 82/84] target/tcm_loop: " Bart Van Assche
2021-09-21 17:34 ` [PATCH 83/84] usb: " Bart Van Assche
2021-09-21 17:34 ` [PATCH 84/84] scsi_lib: " Bart Van Assche
  -- strict thread matches above, loose matches on Subject: below --
2021-09-18  0:04 [PATCH 00/84] " Bart Van Assche
2021-09-22 16:25 ` [PATCH 79/84] xen-scsifront: " Bart Van Assche
2021-09-22 16:25   ` [PATCH 80/84] staging: rts5208: " Bart Van Assche
2021-09-23  6:49     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.