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

Commit deaa9369 authored by Bojun Pan's avatar Bojun Pan Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa3: Fix spin_unlock_bh warning in wan driver



spin_unlock_bh in ipa3_send unconditionally enable IRQ which is causing
spin_lock_irqsave(&wwan_ptr->lock, flags) in ipa3_wwan_xmit to be broken.
The fix here is to isolate the spin_unlock_bh and spin_lock_irqsave.

Change-Id: I777f643f8789876377d26d0a54c28289df064e40
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 94debfa6
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -1321,7 +1321,14 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
		spin_unlock_irqrestore(&wwan_ptr->lock, flags);
		spin_unlock_irqrestore(&wwan_ptr->lock, flags);
		return NETDEV_TX_OK;
		return NETDEV_TX_OK;
	}
	}
	/*
	 * increase the outstanding_pkts count first
	 * to avoid suspend happens in parallel
	 * after unlock
	 */
	atomic_inc(&wwan_ptr->outstanding_pkts);
	/* IPA_RM checking end */
	/* IPA_RM checking end */
	spin_unlock_irqrestore(&wwan_ptr->lock, flags);


	/*
	/*
	 * both data packets and command will be routed to
	 * both data packets and command will be routed to
@@ -1329,19 +1336,18 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
	 */
	 */
	ret = ipa3_tx_dp(IPA_CLIENT_APPS_WAN_PROD, skb, NULL);
	ret = ipa3_tx_dp(IPA_CLIENT_APPS_WAN_PROD, skb, NULL);
	if (ret) {
	if (ret) {
		atomic_dec(&wwan_ptr->outstanding_pkts);
		if (ret == -EPIPE) {
		if (ret == -EPIPE) {
			IPAWANERR_RL("[%s] fatal: pipe is not valid\n",
			IPAWANERR_RL("[%s] fatal: pipe is not valid\n",
				dev->name);
				dev->name);
			dev_kfree_skb_any(skb);
			dev_kfree_skb_any(skb);
			dev->stats.tx_dropped++;
			dev->stats.tx_dropped++;
			spin_unlock_irqrestore(&wwan_ptr->lock, flags);
			return NETDEV_TX_OK;
			return NETDEV_TX_OK;
		}
		}
		ret = NETDEV_TX_BUSY;
		ret = NETDEV_TX_BUSY;
		goto out;
		goto out;
	}
	}


	atomic_inc(&wwan_ptr->outstanding_pkts);
	dev->stats.tx_packets++;
	dev->stats.tx_packets++;
	dev->stats.tx_bytes += skb->len;
	dev->stats.tx_bytes += skb->len;
	ret = NETDEV_TX_OK;
	ret = NETDEV_TX_OK;
@@ -1355,7 +1361,6 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
				IPA_RM_RESOURCE_WWAN_0_PROD);
				IPA_RM_RESOURCE_WWAN_0_PROD);
		}
		}
	}
	}
	spin_unlock_irqrestore(&wwan_ptr->lock, flags);
	return ret;
	return ret;
}
}