]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phy: export phy_queue_state_machine
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 30 May 2019 13:11:06 +0000 (15:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 22:02:33 +0000 (15:02 -0700)
We face the issue that link change interrupt and link status may be
reported by different PHY layers. As a result the link change
interrupt may occur before the link status changes.
Export phy_queue_state_machine to allow PHY drivers to specify a
delay between link status change interrupt and link status check.

v2:
- change jiffies parameter type to unsigned long

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c
include/linux/phy.h

index c6b0010a6d201c9836bf42fc4f286ea49aeb5a73..84671d868a80f39b7c2011c37ed0e9c1de0a866d 100644 (file)
@@ -29,6 +29,8 @@
 #include <linux/uaccess.h>
 #include <linux/atomic.h>
 
+#define PHY_STATE_TIME HZ
+
 #define PHY_STATE_STR(_state)                  \
        case PHY_##_state:                      \
                return __stringify(_state);     \
@@ -478,12 +480,12 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
 }
 EXPORT_SYMBOL(phy_mii_ioctl);
 
-static void phy_queue_state_machine(struct phy_device *phydev,
-                                   unsigned int secs)
+void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies)
 {
        mod_delayed_work(system_power_efficient_wq, &phydev->state_queue,
-                        secs * HZ);
+                        jiffies);
 }
+EXPORT_SYMBOL(phy_queue_state_machine);
 
 static void phy_trigger_machine(struct phy_device *phydev)
 {
index 16cd33915496d32f534f4d9ad0279fe6a90a134b..dc4b51060ebc65563e83221e7b131e754553230b 100644 (file)
@@ -188,7 +188,6 @@ static inline const char *phy_modes(phy_interface_t interface)
 
 
 #define PHY_INIT_TIMEOUT       100000
-#define PHY_STATE_TIME         1
 #define PHY_FORCE_TIMEOUT      10
 
 #define PHY_MAX_ADDR   32
@@ -1140,6 +1139,7 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner);
 int phy_drivers_register(struct phy_driver *new_driver, int n,
                         struct module *owner);
 void phy_state_machine(struct work_struct *work);
+void phy_queue_state_machine(struct phy_device *phydev, unsigned long jiffies);
 void phy_mac_interrupt(struct phy_device *phydev);
 void phy_start_machine(struct phy_device *phydev);
 void phy_stop_machine(struct phy_device *phydev);