diff mbox series

[12/30] net: eepro100: Replace purge_tx_ring() with memset()

Message ID 20200523163837.407592-12-marek.vasut+renesas@gmail.com
State New
Delegated to: Joe Hershberger
Headers show
Series [01/30] net: eepro100: Remove EEPRO100_SROM_WRITE | expand

Commit Message

Marek Vasut May 23, 2020, 4:38 p.m. UTC
This function zeroes-out all the descriptors in the TX ring,
use memset() instead.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
---
 drivers/net/eepro100.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

Comments

Ramon Fried May 23, 2020, 5:15 p.m. UTC | #1
On Sat, May 23, 2020 at 7:41 PM Marek Vasut <marek.vasut@gmail.com> wrote:
>
> This function zeroes-out all the descriptors in the TX ring,
> use memset() instead.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> ---
>  drivers/net/eepro100.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
> index 5d11665fdc..6fb9192e81 100644
> --- a/drivers/net/eepro100.c
> +++ b/drivers/net/eepro100.c
> @@ -767,23 +767,9 @@ static void init_rx_ring(struct eth_device *dev)
>
>  static void purge_tx_ring(struct eth_device *dev)
>  {
> -       int i;
> -
>         tx_next = 0;
>         tx_threshold = 0x01208000;
> -
> -       for (i = 0; i < NUM_TX_DESC; i++) {
> -               tx_ring[i].status = 0;
> -               tx_ring[i].command = 0;
> -               tx_ring[i].link = 0;
> -               tx_ring[i].tx_desc_addr = 0;
> -               tx_ring[i].count = 0;
> -
> -               tx_ring[i].tx_buf_addr0 = 0;
> -               tx_ring[i].tx_buf_size0 = 0;
> -               tx_ring[i].tx_buf_addr1 = 0;
> -               tx_ring[i].tx_buf_size1 = 0;
> -       }
> +       memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC);
>  }
>
>  static void read_hw_addr(struct eth_device *dev, bd_t *bis)
> --
> 2.25.1
>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 5d11665fdc..6fb9192e81 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -767,23 +767,9 @@  static void init_rx_ring(struct eth_device *dev)
 
 static void purge_tx_ring(struct eth_device *dev)
 {
-	int i;
-
 	tx_next = 0;
 	tx_threshold = 0x01208000;
-
-	for (i = 0; i < NUM_TX_DESC; i++) {
-		tx_ring[i].status = 0;
-		tx_ring[i].command = 0;
-		tx_ring[i].link = 0;
-		tx_ring[i].tx_desc_addr = 0;
-		tx_ring[i].count = 0;
-
-		tx_ring[i].tx_buf_addr0 = 0;
-		tx_ring[i].tx_buf_size0 = 0;
-		tx_ring[i].tx_buf_addr1 = 0;
-		tx_ring[i].tx_buf_size1 = 0;
-	}
+	memset(tx_ring, 0, sizeof(*tx_ring) * NUM_TX_DESC);
 }
 
 static void read_hw_addr(struct eth_device *dev, bd_t *bis)