net: phy: change phy_start_interrupts to phy_request_interrupt
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 23 Jan 2019 06:31:58 +0000 (07:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Jan 2019 06:15:15 +0000 (22:15 -0800)
Now that we enable the interrupts in phy_start() we don't have to do it
before. Therefore remove enabling interrupts from phy_start_interrupts()
and rename this function to reflect the changed functionality.

v2:
- improve warning to clearly state that we fall back to polling

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/phy/phylink.c
include/linux/phy.h

index 079b6a617fc8f9f03fc0b14b48bd385ede3dcb8b..d12aa512b7f582b140a6e7db5cea16a27b451d17 100644 (file)
@@ -785,28 +785,27 @@ static int phy_enable_interrupts(struct phy_device *phydev)
 }
 
 /**
- * phy_start_interrupts - request and enable interrupts for a PHY device
+ * phy_request_interrupt - request interrupt for a PHY device
  * @phydev: target phy_device struct
  *
  * Description: Request the interrupt for the given PHY.
  *   If this fails, then we set irq to PHY_POLL.
- *   Otherwise, we enable the interrupts in the PHY.
  *   This should only be called with a valid IRQ number.
- *   Returns 0 on success or < 0 on error.
  */
-int phy_start_interrupts(struct phy_device *phydev)
+void phy_request_interrupt(struct phy_device *phydev)
 {
-       if (request_threaded_irq(phydev->irq, NULL, phy_interrupt,
-                                IRQF_ONESHOT | IRQF_SHARED,
-                                phydev_name(phydev), phydev) < 0) {
-               phydev_warn(phydev, "Can't get IRQ %d\n", phydev->irq);
+       int err;
+
+       err = request_threaded_irq(phydev->irq, NULL, phy_interrupt,
+                                  IRQF_ONESHOT | IRQF_SHARED,
+                                  phydev_name(phydev), phydev);
+       if (err) {
+               phydev_warn(phydev, "Error %d requesting IRQ %d, falling back to polling\n",
+                           err, phydev->irq);
                phydev->irq = PHY_POLL;
-               return 0;
        }
-
-       return phy_enable_interrupts(phydev);
 }
-EXPORT_SYMBOL(phy_start_interrupts);
+EXPORT_SYMBOL(phy_request_interrupt);
 
 /**
  * phy_stop - Bring down the PHY link, and stop checking the status
index 64c25a0684ac5177c546af4e58cdd037e209f05b..891e0178b97f830e0431b7fd79ab493e70cd32fc 100644 (file)
@@ -951,8 +951,8 @@ int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
                return rc;
 
        phy_prepare_link(phydev, handler);
-       if (phydev->irq > 0)
-               phy_start_interrupts(phydev);
+       if (phy_interrupt_is_valid(phydev))
+               phy_request_interrupt(phydev);
 
        return 0;
 }
index c1b6e05ba60cd8ca96877f57d78e296980c92a83..2e21ce42e38861159cdd9ea42644b5885d8bae1d 100644 (file)
@@ -676,8 +676,8 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
                   __ETHTOOL_LINK_MODE_MASK_NBITS, pl->supported,
                   __ETHTOOL_LINK_MODE_MASK_NBITS, phy->advertising);
 
-       if (phy->irq > 0)
-               phy_start_interrupts(phy);
+       if (phy_interrupt_is_valid(phy))
+               phy_request_interrupt(phy);
 
        return 0;
 }
index 1f3873a2ff29e20d308b8fc0a8ba3054d9e70ae2..70f83d0d7469a5432d3e9dbcd4e0b60f26fe0799 100644 (file)
@@ -1047,7 +1047,7 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev,
 int phy_ethtool_ksettings_set(struct phy_device *phydev,
                              const struct ethtool_link_ksettings *cmd);
 int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
-int phy_start_interrupts(struct phy_device *phydev);
+void phy_request_interrupt(struct phy_device *phydev);
 void phy_print_status(struct phy_device *phydev);
 int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
 void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode);