aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/port.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-07-15 01:42:19 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-15 01:42:19 -0400
commit0ea522416b658dedfc9d565b331624a55a6260ad (patch)
tree3cfa3e72bae112b76d5810bd55a9610b29e42f26 /net/tipc/port.c
parent3cb29b1bca00736e984ea8ab368af40394a1bca0 (diff)
tipc: Remove unneeded parameter to tipc_createport_raw()
This patch eliminates an unneeded parameter when creating a low-level TIPC port object. Instead of returning both the pointer to the port structure and the port's reference ID, it now returns only the pointer since the port structure contains the reference ID as one of its fields. Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r--net/tipc/port.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 2e0cff408ff9..ffba1e7f06d2 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -2,7 +2,7 @@
2 * net/tipc/port.c: TIPC port code 2 * net/tipc/port.c: TIPC port code
3 * 3 *
4 * Copyright (c) 1992-2007, Ericsson AB 4 * Copyright (c) 1992-2007, Ericsson AB
5 * Copyright (c) 2004-2007, Wind River Systems 5 * Copyright (c) 2004-2008, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -213,16 +213,13 @@ exit:
213/** 213/**
214 * tipc_createport_raw - create a generic TIPC port 214 * tipc_createport_raw - create a generic TIPC port
215 * 215 *
216 * Returns port reference, or 0 if unable to create it 216 * Returns pointer to (locked) TIPC port, or NULL if unable to create it
217 *
218 * Note: The newly created port is returned in the locked state.
219 */ 217 */
220 218
221u32 tipc_createport_raw(void *usr_handle, 219struct tipc_port *tipc_createport_raw(void *usr_handle,
222 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *), 220 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
223 void (*wakeup)(struct tipc_port *), 221 void (*wakeup)(struct tipc_port *),
224 const u32 importance, 222 const u32 importance)
225 struct tipc_port **tp_ptr)
226{ 223{
227 struct port *p_ptr; 224 struct port *p_ptr;
228 struct tipc_msg *msg; 225 struct tipc_msg *msg;
@@ -231,13 +228,13 @@ u32 tipc_createport_raw(void *usr_handle,
231 p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC); 228 p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC);
232 if (!p_ptr) { 229 if (!p_ptr) {
233 warn("Port creation failed, no memory\n"); 230 warn("Port creation failed, no memory\n");
234 return 0; 231 return NULL;
235 } 232 }
236 ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock); 233 ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
237 if (!ref) { 234 if (!ref) {
238 warn("Port creation failed, reference table exhausted\n"); 235 warn("Port creation failed, reference table exhausted\n");
239 kfree(p_ptr); 236 kfree(p_ptr);
240 return 0; 237 return NULL;
241 } 238 }
242 239
243 p_ptr->publ.usr_handle = usr_handle; 240 p_ptr->publ.usr_handle = usr_handle;
@@ -260,8 +257,7 @@ u32 tipc_createport_raw(void *usr_handle,
260 INIT_LIST_HEAD(&p_ptr->port_list); 257 INIT_LIST_HEAD(&p_ptr->port_list);
261 list_add_tail(&p_ptr->port_list, &ports); 258 list_add_tail(&p_ptr->port_list, &ports);
262 spin_unlock_bh(&tipc_port_list_lock); 259 spin_unlock_bh(&tipc_port_list_lock);
263 *tp_ptr = &p_ptr->publ; 260 return &(p_ptr->publ);
264 return ref;
265} 261}
266 262
267int tipc_deleteport(u32 ref) 263int tipc_deleteport(u32 ref)
@@ -1044,21 +1040,18 @@ int tipc_createport(u32 user_ref,
1044{ 1040{
1045 struct user_port *up_ptr; 1041 struct user_port *up_ptr;
1046 struct port *p_ptr; 1042 struct port *p_ptr;
1047 struct tipc_port *tp_ptr;
1048 u32 ref;
1049 1043
1050 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC); 1044 up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
1051 if (!up_ptr) { 1045 if (!up_ptr) {
1052 warn("Port creation failed, no memory\n"); 1046 warn("Port creation failed, no memory\n");
1053 return -ENOMEM; 1047 return -ENOMEM;
1054 } 1048 }
1055 ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup, 1049 p_ptr = (struct port *)tipc_createport_raw(NULL, port_dispatcher,
1056 importance, &tp_ptr); 1050 port_wakeup, importance);
1057 if (ref == 0) { 1051 if (!p_ptr) {
1058 kfree(up_ptr); 1052 kfree(up_ptr);
1059 return -ENOMEM; 1053 return -ENOMEM;
1060 } 1054 }
1061 p_ptr = (struct port *)tp_ptr;
1062 1055
1063 p_ptr->user_port = up_ptr; 1056 p_ptr->user_port = up_ptr;
1064 up_ptr->user_ref = user_ref; 1057 up_ptr->user_ref = user_ref;
@@ -1074,7 +1067,6 @@ int tipc_createport(u32 user_ref,
1074 INIT_LIST_HEAD(&up_ptr->uport_list); 1067 INIT_LIST_HEAD(&up_ptr->uport_list);
1075 tipc_reg_add_port(up_ptr); 1068 tipc_reg_add_port(up_ptr);
1076 *portref = p_ptr->publ.ref; 1069 *portref = p_ptr->publ.ref;
1077 dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref);
1078 tipc_port_unlock(p_ptr); 1070 tipc_port_unlock(p_ptr);
1079 return TIPC_OK; 1071 return TIPC_OK;
1080} 1072}