Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9762f531 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: stmmac: Use mutex instead of spinlock"

parents c2499856 aa338cd0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -96,7 +96,9 @@ struct stmmac_priv {
	struct net_device *dev;
	struct device *device;
	struct mac_device_info *hw;
	spinlock_t lock;

	/* Mutex lock */
	struct mutex lock;

	/* RX Queue */
	struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
+6 −6
Original line number Diff line number Diff line
@@ -392,13 +392,13 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev,
			ADVERTISED_10baseT_Half |
			ADVERTISED_10baseT_Full);

		spin_lock(&priv->lock);
		mutex_lock(&priv->lock);

		if (priv->hw->mac->pcs_ctrl_ane)
			priv->hw->mac->pcs_ctrl_ane(priv->ioaddr, 1,
						    priv->hw->ps, 0);

		spin_unlock(&priv->lock);
		mutex_unlock(&priv->lock);

		return 0;
	}
@@ -615,12 +615,12 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
	struct stmmac_priv *priv = netdev_priv(dev);

	spin_lock_irq(&priv->lock);
	mutex_lock(&priv->lock);
	if (device_can_wakeup(priv->device)) {
		wol->supported = WAKE_MAGIC | WAKE_UCAST;
		wol->wolopts = priv->wolopts;
	}
	spin_unlock_irq(&priv->lock);
	mutex_unlock(&priv->lock);
}

static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -649,9 +649,9 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
		disable_irq_wake(priv->wol_irq);
	}

	spin_lock_irq(&priv->lock);
	mutex_lock(&priv->lock);
	priv->wolopts = wol->wolopts;
	spin_unlock_irq(&priv->lock);
	mutex_unlock(&priv->lock);

	return 0;
}
+14 −13
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
			 * changed).
			 * In that case the driver disable own timers.
			 */
			spin_lock_irqsave(&priv->lock, flags);
			mutex_lock(&priv->lock);
			if (priv->eee_active) {
				netdev_dbg(priv->dev, "disable EEE\n");
				del_timer_sync(&priv->eee_ctrl_timer);
@@ -400,11 +400,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
							     tx_lpi_timer);
			}
			priv->eee_active = 0;
			spin_unlock_irqrestore(&priv->lock, flags);
			mutex_unlock(&priv->lock);
			goto out;
		}
		/* Activate the EEE and start timers */
		spin_lock_irqsave(&priv->lock, flags);
		mutex_lock(&priv->lock);
		if (!priv->eee_active) {
			priv->eee_active = 1;
			setup_timer(&priv->eee_ctrl_timer,
@@ -421,7 +421,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
		priv->hw->mac->set_eee_pls(priv->hw, ndev->phydev->link);

		ret = true;
		spin_unlock_irqrestore(&priv->lock, flags);
		mutex_unlock(&priv->lock);

		netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n");
	}
@@ -796,7 +796,7 @@ static void stmmac_adjust_link(struct net_device *dev)
	if (!phydev)
		return;

	spin_lock_irqsave(&priv->lock, flags);
	mutex_lock(&priv->lock);

	if (phydev->link) {
		u32 ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
@@ -855,7 +855,7 @@ static void stmmac_adjust_link(struct net_device *dev)
	if (new_state && netif_msg_link(priv))
		phy_print_status(phydev);

	spin_unlock_irqrestore(&priv->lock, flags);
	mutex_unlock(&priv->lock);

	if (phydev->is_pseudo_fixed_link)
		/* Stop PHY layer to call the hook to adjust the link in case
@@ -4259,7 +4259,7 @@ int stmmac_dvr_probe(struct device *device,
			       (8 * priv->plat->rx_queues_to_use));
	}

	spin_lock_init(&priv->lock);
	mutex_init(&priv->lock);

	/* If a specific clk_csr value is passed from the platform
	 * this means that the CSR Clock Range selection cannot be
@@ -4350,6 +4350,7 @@ int stmmac_dvr_remove(struct device *dev)
	    priv->hw->pcs != STMMAC_PCS_TBI &&
	    priv->hw->pcs != STMMAC_PCS_RTBI)
		stmmac_mdio_unregister(ndev);
	mutex_destroy(&priv->lock);
	free_netdev(ndev);

	return 0;
@@ -4375,7 +4376,7 @@ int stmmac_suspend(struct device *dev)
	if (ndev->phydev)
		phy_stop(ndev->phydev);

	spin_lock_irqsave(&priv->lock, flags);
	mutex_lock(&priv->lock);

	netif_device_detach(ndev);
	stmmac_stop_all_queues(priv);
@@ -4396,7 +4397,7 @@ int stmmac_suspend(struct device *dev)
		clk_disable(priv->plat->pclk);
		clk_disable(priv->plat->stmmac_clk);
	}
	spin_unlock_irqrestore(&priv->lock, flags);
	mutex_unlock(&priv->lock);

	priv->oldlink = false;
	priv->speed = SPEED_UNKNOWN;
@@ -4452,9 +4453,9 @@ int stmmac_resume(struct device *dev)
	 * from another devices (e.g. serial console).
	 */
	if (device_may_wakeup(priv->device)) {
		spin_lock_irqsave(&priv->lock, flags);
		mutex_lock(&priv->lock);
		priv->hw->mac->pmt(priv->hw, 0);
		spin_unlock_irqrestore(&priv->lock, flags);
		mutex_unlock(&priv->lock);
		priv->irq_wake = 0;
	} else {
		pinctrl_pm_select_default_state(priv->device);
@@ -4468,7 +4469,7 @@ int stmmac_resume(struct device *dev)

	netif_device_attach(ndev);

	spin_lock_irqsave(&priv->lock, flags);
	mutex_lock(&priv->lock);

	stmmac_reset_queues_param(priv);

@@ -4487,7 +4488,7 @@ int stmmac_resume(struct device *dev)

	stmmac_start_all_queues(priv);

	spin_unlock_irqrestore(&priv->lock, flags);
	mutex_unlock(&priv->lock);

	if (ndev->phydev)
		phy_start(ndev->phydev);