net: phy: air_en8811h: reset netdev rules when LED is set manually
authorDaniel Golle <daniel@makrotopia.org>
Thu, 9 May 2024 10:00:42 +0000 (11:00 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 13 May 2024 20:51:17 +0000 (13:51 -0700)
Setting LED_OFF via brightness_set should deactivate hw control, so make
sure netdev trigger rules also get cleared in that case.
This fixes unwanted restoration of the default netdev trigger rules and
matches the behaviour when using the 'netdev' trigger without any
hardware offloading.

Fixes: 71e79430117d ("net: phy: air_en8811h: Add the Airoha EN8811H PHY driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://lore.kernel.org/r/5ed8ea615890a91fa4df59a7ae8311bbdf63cdcf.1715248281.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/air_en8811h.c

index 4c9a1c9c805e400b232ff87add6e02d5c6cd2de4..3cdc8c6b30b648fe33149438de8b078da4526d85 100644 (file)
@@ -544,6 +544,10 @@ static int air_hw_led_on_set(struct phy_device *phydev, u8 index, bool on)
 
        changed |= (priv->led[index].rules != 0);
 
+       /* clear netdev trigger rules in case LED_OFF has been set */
+       if (!on)
+               priv->led[index].rules = 0;
+
        if (changed)
                return phy_modify_mmd(phydev, MDIO_MMD_VEND2,
                                      AIR_PHY_LED_ON(index),