[RFC Patch net-next 2/4] net: dsa: microchip: enable phy interrupts only if interrupt enabled in dts

Arun Ramadoss posted 4 patches 3 years, 3 months ago
There is a newer version of this series
[RFC Patch net-next 2/4] net: dsa: microchip: enable phy interrupts only if interrupt enabled in dts
Posted by Arun Ramadoss 3 years, 3 months ago
In the lan937x_mdio_register function, phy interrupts are enabled
irrespective of irq is enabled in the switch. Now, the check is added to
enable the phy interrupt only if the irq is enabled in the switch.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
 drivers/net/dsa/microchip/lan937x_main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
index 7136d9c55315..1f4472c90a1f 100644
--- a/drivers/net/dsa/microchip/lan937x_main.c
+++ b/drivers/net/dsa/microchip/lan937x_main.c
@@ -235,15 +235,18 @@ static int lan937x_mdio_register(struct ksz_device *dev)
 
 	ds->slave_mii_bus = bus;
 
-	ret = lan937x_irq_phy_setup(dev);
-	if (ret)
-		return ret;
+	if (dev->irq > 0) {
+		ret = lan937x_irq_phy_setup(dev);
+		if (ret)
+			return ret;
+	}
 
 	ret = devm_of_mdiobus_register(ds->dev, bus, mdio_np);
 	if (ret) {
 		dev_err(ds->dev, "unable to register MDIO bus %s\n",
 			bus->id);
-		lan937x_irq_phy_free(dev);
+		if (dev->irq > 0)
+			lan937x_irq_phy_free(dev);
 	}
 
 	of_node_put(mdio_np);
-- 
2.36.1
Re: [RFC Patch net-next 2/4] net: dsa: microchip: enable phy interrupts only if interrupt enabled in dts
Posted by Andrew Lunn 3 years, 3 months ago
On Fri, Sep 09, 2022 at 09:31:18PM +0530, Arun Ramadoss wrote:
> In the lan937x_mdio_register function, phy interrupts are enabled
> irrespective of irq is enabled in the switch. Now, the check is added to
> enable the phy interrupt only if the irq is enabled in the switch.
> 
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew