aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2025-05-05 10:43:39 +0200
committerDavid S. Miller <davem@davemloft.net>2025-05-07 12:57:05 +0100
commitf485849a381f829234143e044663f35330d0b71a (patch)
tree8dfd617d4ee4dfef14721675937d7aa05a5a1b79
parentnet: usb: lan78xx: move LED DT configuration to helper (diff)
downloadwireguard-linux-f485849a381f829234143e044663f35330d0b71a.tar.xz
wireguard-linux-f485849a381f829234143e044663f35330d0b71a.zip
net: usb: lan78xx: Extract PHY interrupt acknowledgment to helper
Move the PHY interrupt acknowledgment logic from lan78xx_link_reset() to a new helper function lan78xx_phy_int_ack(). This simplifies the code and prepares for reusing the acknowledgment logic independently from the full link reset process, such as when using phylink. No functional change intended. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Thangaraj Samynathan <thangaraj.s@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/lan78xx.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 07530eef82cb..de2b429e906e 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1636,6 +1636,20 @@ exit_unlock:
return ret;
}
+/**
+ * lan78xx_phy_int_ack - Acknowledge PHY interrupt
+ * @dev: pointer to the LAN78xx device structure
+ *
+ * This function acknowledges the PHY interrupt by setting the
+ * INT_STS_PHY_INT_ bit in the interrupt status register (INT_STS).
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+static int lan78xx_phy_int_ack(struct lan78xx_net *dev)
+{
+ return lan78xx_write_reg(dev, INT_STS, INT_STS_PHY_INT_);
+}
+
static int lan78xx_link_reset(struct lan78xx_net *dev)
{
struct phy_device *phydev = dev->net->phydev;
@@ -1644,7 +1658,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev)
u32 buf;
/* clear LAN78xx interrupt status */
- ret = lan78xx_write_reg(dev, INT_STS, INT_STS_PHY_INT_);
+ ret = lan78xx_phy_int_ack(dev);
if (unlikely(ret < 0))
return ret;