[PATCH v1 23/34] j1939: j1939_netdev_stop(): use priv instead of ndev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We already have a priv pointer. No need to seek it again.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/j1939-priv.h | 2 +-
 net/can/j1939/main.c       | 7 +------
 net/can/j1939/socket.c     | 6 +++---
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/net/can/j1939/j1939-priv.h b/net/can/j1939/j1939-priv.h
index d668658ef421..1e470a394fff 100644
--- a/net/can/j1939/j1939-priv.h
+++ b/net/can/j1939/j1939-priv.h
@@ -193,7 +193,7 @@ void j1939_ecu_timer_cancel(struct j1939_ecu *ecu);
 void j1939_ecu_unmap_all(struct j1939_priv *priv);
 
 struct j1939_priv *j1939_netdev_start(struct net *net, struct net_device *ndev);
-void j1939_netdev_stop(struct net_device *ndev);
+void j1939_netdev_stop(struct j1939_priv *priv);
 
 struct j1939_priv *j1939_priv_get_by_ndev(struct net_device *ndev);
 void j1939_priv_put(struct j1939_priv *priv);
diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 9a711ddeae0d..315166ef3eb1 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -271,15 +271,10 @@ struct j1939_priv *j1939_netdev_start(struct net *net, struct net_device *ndev)
 	return ERR_PTR(ret);
 }
 
-void j1939_netdev_stop(struct net_device *ndev)
+void j1939_netdev_stop(struct j1939_priv *priv)
 {
-	struct j1939_priv *priv;
-
-	spin_lock(&j1939_netdev_lock);
-	priv = j1939_ndev_to_priv(ndev);
 	kref_put(&priv->rx_kref, __j1939_rx_release);
 	j1939_priv_put(priv);
-	spin_unlock(&j1939_netdev_lock);
 }
 
 int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb)
diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 813aab534e91..41684cfd2eb7 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -436,7 +436,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len)
 	/* get new references */
 	ret = j1939_local_ecu_get(priv, jsk->addr.src_name, jsk->addr.sa);
 	if (ret) {
-		j1939_netdev_stop(ndev);
+		j1939_netdev_stop(priv);
 		goto out_dev_put;
 	}
 
@@ -563,7 +563,7 @@ static int j1939_sk_release(struct socket *sock)
 				    jsk->addr.sa);
 		j1939_priv_put(priv);
 
-		j1939_netdev_stop(ndev);
+		j1939_netdev_stop(priv);
 		dev_put(ndev);
 	}
 
@@ -1101,7 +1101,7 @@ void j1939_sk_netdev_event(struct net_device *ndev, int error_code)
 			j1939_local_ecu_put(priv, jsk->addr.src_name,
 					    jsk->addr.sa);
 
-			j1939_netdev_stop(ndev);
+			j1939_netdev_stop(priv);
 		}
 		/* do not remove filters here */
 	}
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux