Skip to content

Commit 8dc181f

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: don't hold clock reference while netdev open
Currently a clock reference is taken whenever the ->ndo_open callback for the modem netdev is called. That reference is dropped when the device is closed, in ipa_stop(). We no longer need this, because ipa_start_xmit() now handles the situation where the hardware power state is not active. Drop the clock reference in ipa_open() when we're done, and take a new reference in ipa_stop() before we begin closing the interface. Finally (and unrelated, but trivial), change the return type of ipa_start_xmit() to be netdev_tx_t instead of int. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8dcf8bb commit 8dc181f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

drivers/net/ipa/ipa_modem.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ static int ipa_open(struct net_device *netdev)
6565

6666
netif_start_queue(netdev);
6767

68+
(void)ipa_clock_put(ipa);
69+
6870
return 0;
6971

7072
err_disable_tx:
@@ -80,12 +82,17 @@ static int ipa_stop(struct net_device *netdev)
8082
{
8183
struct ipa_priv *priv = netdev_priv(netdev);
8284
struct ipa *ipa = priv->ipa;
85+
int ret;
86+
87+
ret = ipa_clock_get(ipa);
88+
if (WARN_ON(ret < 0))
89+
goto out_clock_put;
8390

8491
netif_stop_queue(netdev);
8592

8693
ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]);
8794
ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]);
88-
95+
out_clock_put:
8996
(void)ipa_clock_put(ipa);
9097

9198
return 0;
@@ -99,7 +106,8 @@ static int ipa_stop(struct net_device *netdev)
99106
* NETDEV_TX_OK: Success
100107
* NETDEV_TX_BUSY: Error while transmitting the skb. Try again later
101108
*/
102-
static int ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev)
109+
static netdev_tx_t
110+
ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev)
103111
{
104112
struct net_device_stats *stats = &netdev->stats;
105113
struct ipa_priv *priv = netdev_priv(netdev);

0 commit comments

Comments
 (0)