[PATCH v1 17/17] j1939: rename jsk_fifo to sk_session_queue_entry

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

 



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

diff --git a/net/can/j1939/j1939-priv.h b/net/can/j1939/j1939-priv.h
index 29cfe9d7f9ae..21bee33fdbf4 100644
--- a/net/can/j1939/j1939-priv.h
+++ b/net/can/j1939/j1939-priv.h
@@ -214,7 +214,7 @@ enum j1939_session_state {
 struct j1939_session {
 	struct j1939_priv *priv;
 	struct list_head active_session_list_entry;
-	struct list_head jsk_fifo;
+	struct list_head sk_session_queue_entry;
 	struct kref kref;
 	spinlock_t lock;
 	struct sock *sk;
@@ -290,8 +290,8 @@ struct j1939_sock {
 	atomic_t skb_pending;
 	wait_queue_head_t waitq;
 
-	spinlock_t session_fifo_lock;
-	struct list_head session_fifo;
+	spinlock_t sk_session_queue_lock;
+	struct list_head sk_session_queue;
 };
 
 static inline struct j1939_sock *j1939_sk(const struct sock *sk)
diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 80ef2329c921..f7ade3c9a5af 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -74,11 +74,11 @@ static bool j1939_sk_queue_session(struct j1939_session *session)
 	struct j1939_sock *jsk = j1939_sk(session->sk);
 	bool empty;
 
-	spin_lock_bh(&jsk->session_fifo_lock);
-	empty = list_empty(&jsk->session_fifo);
+	spin_lock_bh(&jsk->sk_session_queue_lock);
+	empty = list_empty(&jsk->sk_session_queue);
 	j1939_session_get(session);
-	list_add_tail(&session->jsk_fifo, &jsk->session_fifo);
-	spin_unlock_bh(&jsk->session_fifo_lock);
+	list_add_tail(&session->sk_session_queue_entry, &jsk->sk_session_queue);
+	spin_unlock_bh(&jsk->sk_session_queue_lock);
 	j1939_sock_pending_add(&jsk->sk);
 
 	return empty;
@@ -89,16 +89,17 @@ j1939_session *j1939_sk_get_incomplete_session(struct j1939_sock *jsk)
 {
 	struct j1939_session *session = NULL;
 
-	spin_lock_bh(&jsk->session_fifo_lock);
-	if (!list_empty(&jsk->session_fifo)) {
-		session = list_last_entry(&jsk->session_fifo,
-					  struct j1939_session, jsk_fifo);
+	spin_lock_bh(&jsk->sk_session_queue_lock);
+	if (!list_empty(&jsk->sk_session_queue)) {
+		session = list_last_entry(&jsk->sk_session_queue,
+					  struct j1939_session,
+					  sk_session_queue_entry);
 		if (session->total_queued_size == session->total_message_size)
 			session = NULL;
 		else
 			j1939_session_get(session);
 	}
-	spin_unlock_bh(&jsk->session_fifo_lock);
+	spin_unlock_bh(&jsk->sk_session_queue_lock);
 
 	return session;
 }
@@ -107,15 +108,15 @@ static void j1939_sk_queue_drop_all(struct j1939_sock *jsk)
 {
 	struct j1939_session *session, *tmp;
 
-	spin_lock_bh(&jsk->session_fifo_lock);
-	list_for_each_entry_safe_reverse(session, tmp, &jsk->session_fifo,
-					 jsk_fifo) {
-		list_del_init(&session->jsk_fifo);
+	spin_lock_bh(&jsk->sk_session_queue_lock);
+	list_for_each_entry_safe_reverse(session, tmp, &jsk->sk_session_queue,
+					 sk_session_queue_entry) {
+		list_del_init(&session->sk_session_queue_entry);
 		j1939_session_timers_cancel(session);
 		j1939_session_deactivate(session);
 		j1939_session_put(session);
 	}
-	spin_unlock_bh(&jsk->session_fifo_lock);
+	spin_unlock_bh(&jsk->sk_session_queue_lock);
 }
 
 void j1939_sk_queue_activate_next_locked(struct j1939_session *session)
@@ -128,17 +129,19 @@ void j1939_sk_queue_activate_next_locked(struct j1939_session *session)
 		return;
 
 	jsk = j1939_sk(session->sk);
-	lockdep_assert_held(&jsk->session_fifo_lock);
+	lockdep_assert_held(&jsk->sk_session_queue_lock);
 
 	err = session->err;
 
-	cur = list_first_entry_or_null(&jsk->session_fifo,
-					struct j1939_session, jsk_fifo);
+	cur = list_first_entry_or_null(&jsk->sk_session_queue,
+					struct j1939_session,
+					sk_session_queue_entry);
 	if (cur == session) {
-		list_del_init(&session->jsk_fifo);
+		list_del_init(&session->sk_session_queue_entry);
 		j1939_session_put(session);
-		next = list_first_entry_or_null(&jsk->session_fifo,
-						struct j1939_session, jsk_fifo);
+		next = list_first_entry_or_null(&jsk->sk_session_queue,
+						struct j1939_session,
+						sk_session_queue_entry);
 		if (next) {
 			/* Give receiver some time (arbitrary chosen) to recover */
 			int time_ms = 0;
@@ -161,9 +164,9 @@ void j1939_sk_queue_activate_next(struct j1939_session *session)
 
 	jsk = j1939_sk(session->sk);
 
-	spin_lock_bh(&jsk->session_fifo_lock);
+	spin_lock_bh(&jsk->sk_session_queue_lock);
 	j1939_sk_queue_activate_next_locked(session);
-	spin_unlock_bh(&jsk->session_fifo_lock);
+	spin_unlock_bh(&jsk->sk_session_queue_lock);
 }
 
 static bool j1939_sk_match_dst(struct j1939_sock *jsk,
@@ -301,8 +304,8 @@ static int j1939_sk_init(struct sock *sk)
 	jsk->addr.pgn = J1939_NO_PGN;
 	jsk->pgn_rx_filter = J1939_NO_PGN;
 	atomic_set(&jsk->skb_pending, 0);
-	spin_lock_init(&jsk->session_fifo_lock);
-	INIT_LIST_HEAD(&jsk->session_fifo);
+	spin_lock_init(&jsk->sk_session_queue_lock);
+	INIT_LIST_HEAD(&jsk->sk_session_queue);
 
 	return 0;
 }
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index c7d80ac13f20..88fe995a9716 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1093,7 +1093,7 @@ static struct j1939_session *j1939_session_new(struct j1939_priv *priv,
 	if (!session)
 		return NULL;
 	INIT_LIST_HEAD(&session->active_session_list_entry);
-	INIT_LIST_HEAD(&session->jsk_fifo);
+	INIT_LIST_HEAD(&session->sk_session_queue_entry);
 	spin_lock_init(&session->lock);
 	kref_init(&session->kref);
 
-- 
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