[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b867e24-6ed2-1fc7-057e-b583cca3639f@gmail.com>
Date: Sun, 16 Dec 2018 09:57:50 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Heiner Kallweit <hkallweit1@...il.com>,
Andrew Lunn <andrew@...n.ch>,
David Miller <davem@...emloft.net>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 net-next] net: phy: improve phy state checking
Le 12/16/18 à 9:30 AM, Heiner Kallweit a écrit :
> Add helpers phy_is_started() and __phy_is_started() to avoid open-coded
> checks whether PHY has been started. To make the check easier move
> PHY_HALTED before PHY_UP in enum phy_state. Further improvements:
>
> phy_start_aneg():
> Return -EBUSY and print warning if function is called from a non-started
> state (DOWN, READY, HALTED). Better check because function is exported
> and drivers may use it incorrectly.
>
> phy_interrupt():
> Return IRQ_NONE also if state is DOWN or READY. We should never receive
> an interrupt in one of these states, but better play safe.
>
> phy_stop():
> Just return and print a warning if PHY is in a non-started state.
> This warning should help to identify drivers with unbalanced calls to
> phy_start() / phy_stop().
>
> phy_state_machine():
> Schedule state machine run only if PHY is in a started state.
> E.g. if state is READY we don't need the state machine, it will be
> started by phy_start().
>
> v2:
> - don't use __func__ within phy_warn_state
> v3:
> - use WARN() instead of printing error message to facilitate debugging
>
> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
--
Florian
Powered by blists - more mailing lists