From 0e17132f9f324631fe78b19475e40342c9025e69 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 12 Jun 2024 16:11:19 +0100
Subject: [PATCH] lan78xx: Return tx_lpi_timer even if disabled

Disabling tx_lpi or eee should not cause the value of tx_lpi_timer to
be lost, even though it is not useful until they are re-enabled.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 drivers/net/usb/lan78xx.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1702,14 +1702,11 @@ static int lan78xx_get_eee(struct net_de
 	if (ret < 0)
 		goto exit;
 
-	ret = lan78xx_read_reg(dev, MAC_CR, &buf);
-	if (buf & MAC_CR_EEE_EN_) {
-		/* EEE_TX_LPI_REQ_DLY & tx_lpi_timer are same uSec unit */
-		ret = lan78xx_read_reg(dev, EEE_TX_LPI_REQ_DLY, &buf);
+	ret = lan78xx_read_reg(dev, EEE_TX_LPI_REQ_DLY, &buf);
+	if (ret >= 0)
 		edata->tx_lpi_timer = buf;
-	} else {
+	else
 		edata->tx_lpi_timer = 0;
-	}
 
 	ret = 0;
 exit:
