[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8bc78a5-1641-3949-437d-2cd8918c1691@gmail.com>
Date: Mon, 27 May 2019 12:19:42 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Heiner Kallweit <hkallweit1@...il.com>,
Russell King - ARM Linux <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
David Miller <davem@...emloft.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 1/3] net: phy: export phy_queue_state_machine
On 5/27/2019 11:28 AM, Heiner Kallweit wrote:
> We face the issue that link change interrupt and link status may be
> reported by different 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.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
> Suggested-by: Russell King - ARM Linux admin <linux@...linux.org.uk>
> ---
> drivers/net/phy/phy.c | 8 +++++---
> include/linux/phy.h | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index e88854292..20955836c 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -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 int jiffies)
mod_delayed_work() takes an unsigned long delay argument, so I would
replicate that here as well. Other than that, making PHY_STATE_TIME
local to phy.c is definitively a good idea.
> {
> 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)
> {
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 7180b1d1e..b133d59f3 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -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
> @@ -1137,6 +1136,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 int 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);
>
--
Florian
Powered by blists - more mailing lists