* [PATCH net-next 1/2] net: phy: add helper phy_polling_mode
@ 2018-07-21 13:51 Heiner Kallweit
2018-07-21 13:53 ` [PATCH net-next 2/2] net: phy: use " Heiner Kallweit
2018-07-22 18:11 ` [PATCH net-next 1/2] net: phy: add " David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-07-21 13:51 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev
Add a helper for checking whether polling is used to detect PHY status
changes.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
include/linux/phy.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 075c2f77..cd6f637c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -824,6 +824,16 @@ static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
}
+/**
+ * phy_polling_mode - Convenience function for testing whether polling is
+ * used to detect PHY status changes
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_polling_mode(struct phy_device *phydev)
+{
+ return phydev->irq == PHY_POLL;
+}
+
/**
* phy_is_internal - Convenience function for testing if a PHY is internal
* @phydev: the phy_device struct
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: phy: use helper phy_polling_mode
2018-07-21 13:51 [PATCH net-next 1/2] net: phy: add helper phy_polling_mode Heiner Kallweit
@ 2018-07-21 13:53 ` Heiner Kallweit
2018-07-22 18:11 ` [PATCH net-next 1/2] net: phy: add " David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-07-21 13:53 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev
Make use of new helper phy_polling_mode().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 914fe8e6..7ade22a7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -519,7 +519,7 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
* negotiation may already be done and aneg interrupt may not be
* generated.
*/
- if (phydev->irq != PHY_POLL && phydev->state == PHY_AN) {
+ if (!phy_polling_mode(phydev) && phydev->state == PHY_AN) {
err = phy_aneg_done(phydev);
if (err > 0) {
trigger = true;
@@ -977,7 +977,7 @@ void phy_state_machine(struct work_struct *work)
needs_aneg = true;
break;
case PHY_NOLINK:
- if (phydev->irq != PHY_POLL)
+ if (!phy_polling_mode(phydev))
break;
err = phy_read_status(phydev);
@@ -1018,7 +1018,7 @@ void phy_state_machine(struct work_struct *work)
/* Only register a CHANGE if we are polling and link changed
* since latest checking.
*/
- if (phydev->irq == PHY_POLL) {
+ if (phy_polling_mode(phydev)) {
old_link = phydev->link;
err = phy_read_status(phydev);
if (err)
@@ -1117,7 +1117,7 @@ void phy_state_machine(struct work_struct *work)
* PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
* between states from phy_mac_interrupt()
*/
- if (phydev->irq == PHY_POLL)
+ if (phy_polling_mode(phydev))
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
PHY_STATE_TIME * HZ);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: add helper phy_polling_mode
2018-07-21 13:51 [PATCH net-next 1/2] net: phy: add helper phy_polling_mode Heiner Kallweit
2018-07-21 13:53 ` [PATCH net-next 2/2] net: phy: use " Heiner Kallweit
@ 2018-07-22 18:11 ` David Miller
2018-07-23 19:30 ` Heiner Kallweit
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2018-07-22 18:11 UTC (permalink / raw)
To: hkallweit1; +Cc: andrew, f.fainelli, netdev
I think you can combine these two patches into one.
Thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 1/2] net: phy: add helper phy_polling_mode
2018-07-22 18:11 ` [PATCH net-next 1/2] net: phy: add " David Miller
@ 2018-07-23 19:30 ` Heiner Kallweit
0 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-07-23 19:30 UTC (permalink / raw)
To: David Miller; +Cc: andrew, f.fainelli, netdev
On 22.07.2018 20:11, David Miller wrote:
>
> I think you can combine these two patches into one.
>
> Thank you.
>
Sure, will provide a v2.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-23 20:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-21 13:51 [PATCH net-next 1/2] net: phy: add helper phy_polling_mode Heiner Kallweit
2018-07-21 13:53 ` [PATCH net-next 2/2] net: phy: use " Heiner Kallweit
2018-07-22 18:11 ` [PATCH net-next 1/2] net: phy: add " David Miller
2018-07-23 19:30 ` Heiner Kallweit
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.