[PATCH 5/9] fifo8: rename fifo8_pop_buf() to fifo8_peekpop_buf()

Mark Cave-Ayland posted 9 patches 2 months, 3 weeks ago
[PATCH 5/9] fifo8: rename fifo8_pop_buf() to fifo8_peekpop_buf()
Posted by Mark Cave-Ayland 2 months, 3 weeks ago
The fifo8_pop_buf() function will soon also be used for peek operations, so rename
the function accordingly. Create a new fifo8_pop_buf() wrapper function that can
be used by existing callers.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 util/fifo8.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/util/fifo8.c b/util/fifo8.c
index efe0117b1f..5453cbc1b0 100644
--- a/util/fifo8.c
+++ b/util/fifo8.c
@@ -105,7 +105,8 @@ const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
     return fifo8_peekpop_bufptr(fifo, max, 0, numptr, true);
 }
 
-uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
+static uint32_t fifo8_peekpop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen,
+                                  bool do_pop)
 {
     const uint8_t *buf;
     uint32_t n1, n2 = 0;
@@ -134,6 +135,11 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
     return n1 + n2;
 }
 
+uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
+{
+    return fifo8_peekpop_buf(fifo, dest, destlen, true);
+}
+
 void fifo8_drop(Fifo8 *fifo, uint32_t len)
 {
     len -= fifo8_pop_buf(fifo, NULL, len);
-- 
2.39.2
Re: [PATCH 5/9] fifo8: rename fifo8_pop_buf() to fifo8_peekpop_buf()
Posted by Octavian Purdila 2 months, 3 weeks ago
On Wed, Aug 28, 2024 at 5:23 AM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The fifo8_pop_buf() function will soon also be used for peek operations, so rename
> the function accordingly. Create a new fifo8_pop_buf() wrapper function that can
> be used by existing callers.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Octavian Purdila <tavip@google.com>

> ---
>  util/fifo8.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/util/fifo8.c b/util/fifo8.c
> index efe0117b1f..5453cbc1b0 100644
> --- a/util/fifo8.c
> +++ b/util/fifo8.c
> @@ -105,7 +105,8 @@ const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
>      return fifo8_peekpop_bufptr(fifo, max, 0, numptr, true);
>  }
>
> -uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
> +static uint32_t fifo8_peekpop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen,
> +                                  bool do_pop)
>  {
>      const uint8_t *buf;
>      uint32_t n1, n2 = 0;
> @@ -134,6 +135,11 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      return n1 + n2;
>  }
>
> +uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
> +{
> +    return fifo8_peekpop_buf(fifo, dest, destlen, true);
> +}
> +
>  void fifo8_drop(Fifo8 *fifo, uint32_t len)
>  {
>      len -= fifo8_pop_buf(fifo, NULL, len);
> --
> 2.39.2
>
Re: [PATCH 5/9] fifo8: rename fifo8_pop_buf() to fifo8_peekpop_buf()
Posted by Alistair Francis 2 months, 3 weeks ago
On Wed, Aug 28, 2024 at 10:25 PM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The fifo8_pop_buf() function will soon also be used for peek operations, so rename
> the function accordingly. Create a new fifo8_pop_buf() wrapper function that can
> be used by existing callers.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  util/fifo8.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/util/fifo8.c b/util/fifo8.c
> index efe0117b1f..5453cbc1b0 100644
> --- a/util/fifo8.c
> +++ b/util/fifo8.c
> @@ -105,7 +105,8 @@ const uint8_t *fifo8_pop_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
>      return fifo8_peekpop_bufptr(fifo, max, 0, numptr, true);
>  }
>
> -uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
> +static uint32_t fifo8_peekpop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen,
> +                                  bool do_pop)
>  {
>      const uint8_t *buf;
>      uint32_t n1, n2 = 0;
> @@ -134,6 +135,11 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      return n1 + n2;
>  }
>
> +uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
> +{
> +    return fifo8_peekpop_buf(fifo, dest, destlen, true);
> +}
> +
>  void fifo8_drop(Fifo8 *fifo, uint32_t len)
>  {
>      len -= fifo8_pop_buf(fifo, NULL, len);
> --
> 2.39.2
>
>