diff mbox series

scsi/NCR5380: Reduce NCR5380_maybe_release_dma_irq() call sites

Message ID c1317ae8fdcb498460de5d7ea0bd62a42f5eeca8.1605847196.git.fthain@telegraphics.com.au (mailing list archive)
State Accepted
Headers show
Series scsi/NCR5380: Reduce NCR5380_maybe_release_dma_irq() call sites | expand

Commit Message

Finn Thain Nov. 20, 2020, 4:39 a.m. UTC
Refactor to avoid needless calls to NCR5380_maybe_release_dma_irq().
This makes the machine code smaller and the source more readable.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 drivers/scsi/NCR5380.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Michael Schmitz Nov. 20, 2020, 7:33 a.m. UTC | #1
Hi Finn,

thanks for your patch!

Tested on Atari Falcon (with falconide, and pata_falcon modules).

Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>

Am 20.11.2020 um 17:39 schrieb Finn Thain:
> Refactor to avoid needless calls to NCR5380_maybe_release_dma_irq().
> This makes the machine code smaller and the source more readable.
>
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> ---
>  drivers/scsi/NCR5380.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index ea4b5749e7da..d597d7493a62 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c
> @@ -725,7 +725,6 @@ static void NCR5380_main(struct work_struct *work)
>
>  			if (!NCR5380_select(instance, cmd)) {
>  				dsprintk(NDEBUG_MAIN, instance, "main: select complete\n");
> -				maybe_release_dma_irq(instance);
>  			} else {
>  				dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance,
>  				         "main: select failed, returning %p to queue\n", cmd);
> @@ -737,8 +736,10 @@ static void NCR5380_main(struct work_struct *work)
>  			NCR5380_information_transfer(instance);
>  			done = 0;
>  		}
> -		if (!hostdata->connected)
> +		if (!hostdata->connected) {
>  			NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
> +			maybe_release_dma_irq(instance);
> +		}
>  		spin_unlock_irq(&hostdata->lock);
>  		if (!done)
>  			cond_resched();
> @@ -1844,7 +1845,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
>  					 */
>  					NCR5380_write(TARGET_COMMAND_REG, 0);
>
> -					maybe_release_dma_irq(instance);
>  					return;
>  				case MESSAGE_REJECT:
>  					/* Accept message by clearing ACK */
> @@ -1976,7 +1976,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
>  					hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
>  					cmd->result = DID_ERROR << 16;
>  					complete_cmd(instance, cmd);
> -					maybe_release_dma_irq(instance);
>  					return;
>  				}
>  				msgout = NOP;
> @@ -2312,7 +2311,6 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
>  	}
>
>  	queue_work(hostdata->work_q, &hostdata->main_task);
> -	maybe_release_dma_irq(instance);
>  	spin_unlock_irqrestore(&hostdata->lock, flags);
>
>  	return result;
> @@ -2368,7 +2366,6 @@ static void bus_reset_cleanup(struct Scsi_Host *instance)
>  	hostdata->dma_len = 0;
>
>  	queue_work(hostdata->work_q, &hostdata->main_task);
> -	maybe_release_dma_irq(instance);
>  }
>
>  /**
>
Martin K. Petersen Nov. 24, 2020, 3:14 a.m. UTC | #2
Finn,

> Refactor to avoid needless calls to NCR5380_maybe_release_dma_irq().
> This makes the machine code smaller and the source more readable.

Applied to 5.11/scsi-staging, thanks!
Martin K. Petersen Dec. 1, 2020, 5:04 a.m. UTC | #3
On Fri, 20 Nov 2020 15:39:56 +1100, Finn Thain wrote:

> Refactor to avoid needless calls to NCR5380_maybe_release_dma_irq().
> This makes the machine code smaller and the source more readable.

Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: NCR5380: Reduce NCR5380_maybe_release_dma_irq() call sites
      https://git.kernel.org/mkp/scsi/c/bdd1cc0377d3
diff mbox series

Patch

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index ea4b5749e7da..d597d7493a62 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -725,7 +725,6 @@  static void NCR5380_main(struct work_struct *work)
 
 			if (!NCR5380_select(instance, cmd)) {
 				dsprintk(NDEBUG_MAIN, instance, "main: select complete\n");
-				maybe_release_dma_irq(instance);
 			} else {
 				dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES, instance,
 				         "main: select failed, returning %p to queue\n", cmd);
@@ -737,8 +736,10 @@  static void NCR5380_main(struct work_struct *work)
 			NCR5380_information_transfer(instance);
 			done = 0;
 		}
-		if (!hostdata->connected)
+		if (!hostdata->connected) {
 			NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
+			maybe_release_dma_irq(instance);
+		}
 		spin_unlock_irq(&hostdata->lock);
 		if (!done)
 			cond_resched();
@@ -1844,7 +1845,6 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 					 */
 					NCR5380_write(TARGET_COMMAND_REG, 0);
 
-					maybe_release_dma_irq(instance);
 					return;
 				case MESSAGE_REJECT:
 					/* Accept message by clearing ACK */
@@ -1976,7 +1976,6 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 					hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
 					cmd->result = DID_ERROR << 16;
 					complete_cmd(instance, cmd);
-					maybe_release_dma_irq(instance);
 					return;
 				}
 				msgout = NOP;
@@ -2312,7 +2311,6 @@  static int NCR5380_abort(struct scsi_cmnd *cmd)
 	}
 
 	queue_work(hostdata->work_q, &hostdata->main_task);
-	maybe_release_dma_irq(instance);
 	spin_unlock_irqrestore(&hostdata->lock, flags);
 
 	return result;
@@ -2368,7 +2366,6 @@  static void bus_reset_cleanup(struct Scsi_Host *instance)
 	hostdata->dma_len = 0;
 
 	queue_work(hostdata->work_q, &hostdata->main_task);
-	maybe_release_dma_irq(instance);
 }
 
 /**