diff mbox series

[v2,19/42] esp: remove buf parameter from do_cmd()

Message ID 20210209193018.31339-20-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series esp: consolidate PDMA transfer buffers and other fixes | expand

Commit Message

Mark Cave-Ayland Feb. 9, 2021, 7:29 p.m. UTC
Now that all SCSI commands are accumulated in cmdbuf, remove the buf parameter
from do_cmd() since this always points to cmdbuf.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/scsi/esp.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 23, 2021, 6:27 p.m. UTC | #1
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote:
> Now that all SCSI commands are accumulated in cmdbuf, remove the buf parameter
> from do_cmd() since this always points to cmdbuf.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/scsi/esp.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Laurent Vivier March 2, 2021, 5:03 p.m. UTC | #2
Le 09/02/2021 à 20:29, Mark Cave-Ayland a écrit :
> Now that all SCSI commands are accumulated in cmdbuf, remove the buf parameter
> from do_cmd() since this always points to cmdbuf.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/scsi/esp.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
> index b846f022fb..bb467fbcdf 100644
> --- a/hw/scsi/esp.c
> +++ b/hw/scsi/esp.c
> @@ -297,8 +297,9 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)
>      esp_raise_irq(s);
>  }
>  
> -static void do_cmd(ESPState *s, uint8_t *buf)
> +static void do_cmd(ESPState *s)
>  {
> +    uint8_t *buf = s->cmdbuf;
>      uint8_t busid = buf[0];
>  
>      do_busid_cmd(s, &buf[1], busid);
> @@ -311,7 +312,7 @@ static void satn_pdma_cb(ESPState *s)
>      }
>      s->do_cmd = 0;
>      if (s->cmdlen) {
> -        do_cmd(s, s->cmdbuf);
> +        do_cmd(s);
>      }
>  }
>  
> @@ -324,7 +325,7 @@ static void handle_satn(ESPState *s)
>      s->pdma_cb = satn_pdma_cb;
>      s->cmdlen = get_cmd(s, s->cmdbuf, sizeof(s->cmdbuf));
>      if (s->cmdlen) {
> -        do_cmd(s, s->cmdbuf);
> +        do_cmd(s);
>      } else {
>          s->do_cmd = 1;
>      }
> @@ -445,7 +446,7 @@ static void do_dma_pdma_cb(ESPState *s)
>          s->ti_size = 0;
>          s->cmdlen = 0;
>          s->do_cmd = 0;
> -        do_cmd(s, s->cmdbuf);
> +        do_cmd(s);
>          return;
>      }
>      s->async_buf += len;
> @@ -497,7 +498,7 @@ static void esp_do_dma(ESPState *s)
>          s->ti_size = 0;
>          s->cmdlen = 0;
>          s->do_cmd = 0;
> -        do_cmd(s, s->cmdbuf);
> +        do_cmd(s);
>          return;
>      }
>      if (s->async_len == 0) {
> @@ -628,7 +629,7 @@ static void handle_ti(ESPState *s)
>          s->ti_size = 0;
>          s->cmdlen = 0;
>          s->do_cmd = 0;
> -        do_cmd(s, s->cmdbuf);
> +        do_cmd(s);
>      }
>  }
>  
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index b846f022fb..bb467fbcdf 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -297,8 +297,9 @@  static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)
     esp_raise_irq(s);
 }
 
-static void do_cmd(ESPState *s, uint8_t *buf)
+static void do_cmd(ESPState *s)
 {
+    uint8_t *buf = s->cmdbuf;
     uint8_t busid = buf[0];
 
     do_busid_cmd(s, &buf[1], busid);
@@ -311,7 +312,7 @@  static void satn_pdma_cb(ESPState *s)
     }
     s->do_cmd = 0;
     if (s->cmdlen) {
-        do_cmd(s, s->cmdbuf);
+        do_cmd(s);
     }
 }
 
@@ -324,7 +325,7 @@  static void handle_satn(ESPState *s)
     s->pdma_cb = satn_pdma_cb;
     s->cmdlen = get_cmd(s, s->cmdbuf, sizeof(s->cmdbuf));
     if (s->cmdlen) {
-        do_cmd(s, s->cmdbuf);
+        do_cmd(s);
     } else {
         s->do_cmd = 1;
     }
@@ -445,7 +446,7 @@  static void do_dma_pdma_cb(ESPState *s)
         s->ti_size = 0;
         s->cmdlen = 0;
         s->do_cmd = 0;
-        do_cmd(s, s->cmdbuf);
+        do_cmd(s);
         return;
     }
     s->async_buf += len;
@@ -497,7 +498,7 @@  static void esp_do_dma(ESPState *s)
         s->ti_size = 0;
         s->cmdlen = 0;
         s->do_cmd = 0;
-        do_cmd(s, s->cmdbuf);
+        do_cmd(s);
         return;
     }
     if (s->async_len == 0) {
@@ -628,7 +629,7 @@  static void handle_ti(ESPState *s)
         s->ti_size = 0;
         s->cmdlen = 0;
         s->do_cmd = 0;
-        do_cmd(s, s->cmdbuf);
+        do_cmd(s);
     }
 }