ramips: raeth: serialize ramips_link_adjust calls
[openwrt/openwrt.git] / target / linux / ramips / files / drivers / net / ramips.c
index 4a3f4c3b870a2b824a263318dc8b0f31426c6518..9f76779af45d26c69412ca2a7cf3397cc8d5e0da 100644 (file)
@@ -407,22 +407,30 @@ ramips_phy_disconnect(struct raeth_priv *re)
 static void
 ramips_phy_start(struct raeth_priv *re)
 {
+       unsigned long flags;
+
        if (re->phy_dev) {
                phy_start(re->phy_dev);
        } else {
+               spin_lock_irqsave(&re->phy_lock, flags);
                re->link = 1;
                ramips_link_adjust(re);
+               spin_unlock_irqrestore(&re->phy_lock, flags);
        }
 }
 
 static void
 ramips_phy_stop(struct raeth_priv *re)
 {
+       unsigned long flags;
+
        if (re->phy_dev) {
                phy_stop(re->phy_dev);
        } else {
+               spin_lock_irqsave(&re->phy_lock, flags);
                re->link = 0;
                ramips_link_adjust(re);
+               spin_unlock_irqrestore(&re->phy_lock, flags);
        }
 }
 #else