aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-02-15 15:38:38 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-15 15:38:38 -0500
commit3313da8188cc346a205783c22c37e821b4b7016d (patch)
tree5697cd985220def9bc2e35dfbb832dad04c2d051 /drivers/net/phy/phy.c
parent50f444aa50a4f3fab35a04f56d6bb83dc1e8c875 (diff)
parent24f0a48743a256bdec1bcb80708bc309da4aa261 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The netfilter conflicts were rather simple overlapping changes. However, the cls_tcindex.c stuff was a bit more complex. On the 'net' side, Cong is fixing several races and memory leaks. Whilst on the 'net-next' side we have Vlad adding the rtnl-ness support. What I've decided to do, in order to resolve this, is revert the conversion over to using a workqueue that Cong did, bringing us back to pure RCU. I did it this way because I believe that either Cong's races don't apply with have Vlad did things, or Cong will have to implement the race fix slightly differently. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 89ead29cec68..69dc64a4dbf8 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -543,7 +543,7 @@ int phy_start_aneg(struct phy_device *phydev)
543 if (err < 0) 543 if (err < 0)
544 goto out_unlock; 544 goto out_unlock;
545 545
546 if (__phy_is_started(phydev)) { 546 if (phy_is_started(phydev)) {
547 if (phydev->autoneg == AUTONEG_ENABLE) { 547 if (phydev->autoneg == AUTONEG_ENABLE) {
548 err = phy_check_link_status(phydev); 548 err = phy_check_link_status(phydev);
549 } else { 549 } else {
@@ -699,7 +699,7 @@ void phy_stop_machine(struct phy_device *phydev)
699 cancel_delayed_work_sync(&phydev->state_queue); 699 cancel_delayed_work_sync(&phydev->state_queue);
700 700
701 mutex_lock(&phydev->lock); 701 mutex_lock(&phydev->lock);
702 if (__phy_is_started(phydev)) 702 if (phy_is_started(phydev))
703 phydev->state = PHY_UP; 703 phydev->state = PHY_UP;
704 mutex_unlock(&phydev->lock); 704 mutex_unlock(&phydev->lock);
705} 705}
@@ -752,9 +752,6 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
752{ 752{
753 struct phy_device *phydev = phy_dat; 753 struct phy_device *phydev = phy_dat;
754 754
755 if (!phy_is_started(phydev))
756 return IRQ_NONE; /* It can't be ours. */
757
758 if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) 755 if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev))
759 return IRQ_NONE; 756 return IRQ_NONE;
760 757
@@ -813,15 +810,14 @@ EXPORT_SYMBOL(phy_request_interrupt);
813 */ 810 */
814void phy_stop(struct phy_device *phydev) 811void phy_stop(struct phy_device *phydev)
815{ 812{
816 mutex_lock(&phydev->lock); 813 if (!phy_is_started(phydev)) {
817
818 if (!__phy_is_started(phydev)) {
819 WARN(1, "called from state %s\n", 814 WARN(1, "called from state %s\n",
820 phy_state_to_str(phydev->state)); 815 phy_state_to_str(phydev->state));
821 mutex_unlock(&phydev->lock);
822 return; 816 return;
823 } 817 }
824 818
819 mutex_lock(&phydev->lock);
820
825 if (phy_interrupt_is_valid(phydev)) 821 if (phy_interrupt_is_valid(phydev))
826 phy_disable_interrupts(phydev); 822 phy_disable_interrupts(phydev);
827 823
@@ -961,8 +957,10 @@ void phy_state_machine(struct work_struct *work)
961 * state machine would be pointless and possibly error prone when 957 * state machine would be pointless and possibly error prone when
962 * called from phy_disconnect() synchronously. 958 * called from phy_disconnect() synchronously.
963 */ 959 */
960 mutex_lock(&phydev->lock);
964 if (phy_polling_mode(phydev) && phy_is_started(phydev)) 961 if (phy_polling_mode(phydev) && phy_is_started(phydev))
965 phy_queue_state_machine(phydev, PHY_STATE_TIME); 962 phy_queue_state_machine(phydev, PHY_STATE_TIME);
963 mutex_unlock(&phydev->lock);
966} 964}
967 965
968/** 966/**