aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2013-06-17 10:54:46 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-17 18:53:01 -0400
commitc0fee8aca7206264d5e3dcc4e60aaf86501f4ea1 (patch)
tree2e58d96d9afd483a5aaf9711360bd5d82fa3cd76
parent28e5297281ab85d636aa814a9b65cfb99375d092 (diff)
tipc: save sock structure pointer instead of void pointer to tipc_port
Directly save sock structure pointer instead of void pointer to avoid unnecessary cast conversions. Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tipc/port.c4
-rw-r--r--net/tipc/port.h6
-rw-r--r--net/tipc/socket.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 84b2a574f161..0bb185a3ed4a 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -206,7 +206,7 @@ exit:
206 * 206 *
207 * Returns pointer to (locked) TIPC port, or NULL if unable to create it 207 * Returns pointer to (locked) TIPC port, or NULL if unable to create it
208 */ 208 */
209struct tipc_port *tipc_createport(void *usr_handle, 209struct tipc_port *tipc_createport(struct sock *sk,
210 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), 210 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
211 void (*wakeup)(struct tipc_port *), 211 void (*wakeup)(struct tipc_port *),
212 const u32 importance) 212 const u32 importance)
@@ -227,7 +227,7 @@ struct tipc_port *tipc_createport(void *usr_handle,
227 return NULL; 227 return NULL;
228 } 228 }
229 229
230 p_ptr->usr_handle = usr_handle; 230 p_ptr->sk = sk;
231 p_ptr->max_pkt = MAX_PKT_DEFAULT; 231 p_ptr->max_pkt = MAX_PKT_DEFAULT;
232 p_ptr->ref = ref; 232 p_ptr->ref = ref;
233 INIT_LIST_HEAD(&p_ptr->wait_list); 233 INIT_LIST_HEAD(&p_ptr->wait_list);
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 45838826f2f8..241f529db942 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -48,7 +48,7 @@
48 48
49/** 49/**
50 * struct tipc_port - TIPC port structure 50 * struct tipc_port - TIPC port structure
51 * @usr_handle: pointer to additional user-defined information about port 51 * @sk: pointer to socket handle
52 * @lock: pointer to spinlock for controlling access to port 52 * @lock: pointer to spinlock for controlling access to port
53 * @connected: non-zero if port is currently connected to a peer port 53 * @connected: non-zero if port is currently connected to a peer port
54 * @conn_type: TIPC type used when connection was established 54 * @conn_type: TIPC type used when connection was established
@@ -74,7 +74,7 @@
74 * @subscription: "node down" subscription used to terminate failed connections 74 * @subscription: "node down" subscription used to terminate failed connections
75 */ 75 */
76struct tipc_port { 76struct tipc_port {
77 void *usr_handle; 77 struct sock *sk;
78 spinlock_t *lock; 78 spinlock_t *lock;
79 int connected; 79 int connected;
80 u32 conn_type; 80 u32 conn_type;
@@ -106,7 +106,7 @@ struct tipc_port_list;
106/* 106/*
107 * TIPC port manipulation routines 107 * TIPC port manipulation routines
108 */ 108 */
109struct tipc_port *tipc_createport(void *usr_handle, 109struct tipc_port *tipc_createport(struct sock *sk,
110 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), 110 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
111 void (*wakeup)(struct tipc_port *), const u32 importance); 111 void (*wakeup)(struct tipc_port *), const u32 importance);
112 112
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 67f4e1fbf5a1..14ed54e961b6 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1406,7 +1406,7 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
1406 */ 1406 */
1407static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) 1407static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1408{ 1408{
1409 struct sock *sk = (struct sock *)tport->usr_handle; 1409 struct sock *sk = tport->sk;
1410 u32 res; 1410 u32 res;
1411 1411
1412 /* 1412 /*
@@ -1437,7 +1437,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
1437 */ 1437 */
1438static void wakeupdispatch(struct tipc_port *tport) 1438static void wakeupdispatch(struct tipc_port *tport)
1439{ 1439{
1440 struct sock *sk = (struct sock *)tport->usr_handle; 1440 struct sock *sk = tport->sk;
1441 1441
1442 sk->sk_write_space(sk); 1442 sk->sk_write_space(sk);
1443} 1443}