]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: phy: Deduplicate interrupt disablement on PHY attach
authorLukas Wunner <lukas@wunner.de>
Wed, 27 Apr 2022 06:30:51 +0000 (08:30 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 Apr 2022 01:37:48 +0000 (18:37 -0700)
phy_attach_direct() first calls phy_init_hw() (which restores interrupt
settings through ->config_intr()), then calls phy_disable_interrupts().

So if phydev->interrupts was previously set to 1, interrupts are briefly
enabled, then disabled, which seems nonsensical.

If it was previously set to 0, interrupts are disabled twice, which is
equally nonsensical.

Deduplicate interrupt disablement.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/805ccdc606bd8898d59931bd4c7c68537ed6e550.1651040826.git.lukas@wunner.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_device.c

index 8406ac739def833b43544338b9843c87260a70e8..f867042b2eb4b4c7dd3fc55abfb855a6e262084d 100644 (file)
@@ -1449,6 +1449,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
 
        phydev->state = PHY_READY;
 
+       phydev->interrupts = PHY_INTERRUPT_DISABLED;
+
        /* Port is set to PORT_TP by default and the actual PHY driver will set
         * it to different value depending on the PHY configuration. If we have
         * the generic PHY driver we can't figure it out, thus set the old
@@ -1471,10 +1473,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
        if (err)
                goto error;
 
-       err = phy_disable_interrupts(phydev);
-       if (err)
-               return err;
-
        phy_resume(phydev);
        phy_led_triggers_register(phydev);