aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif/cfmuxl.c
diff options
context:
space:
mode:
authorSjur Braendeland <sjur.brandeland@stericsson.com>2010-04-28 04:54:36 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-28 15:55:12 -0400
commit5b2086567503f9b55136642031ec0067319f58e0 (patch)
tree00c4264ed7a8a989b398166c2c5f98175f5c28a5 /net/caif/cfmuxl.c
parente539d83cc8a4fa581cbf8ed288fdadb19a692cb0 (diff)
caif: Add reference counting to service layer
Changes: o Added functions cfsrvl_get and cfsrvl_put. o Added support release_client to use by socket and net device. o Increase reference counting for in-flight packets from cfmuxl Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/cfmuxl.c')
-rw-r--r--net/caif/cfmuxl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/caif/cfmuxl.c b/net/caif/cfmuxl.c
index 6fb9f9e96cf8..7372f27f1d32 100644
--- a/net/caif/cfmuxl.c
+++ b/net/caif/cfmuxl.c
@@ -62,6 +62,7 @@ int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid)
62{ 62{
63 struct cfmuxl *muxl = container_obj(layr); 63 struct cfmuxl *muxl = container_obj(layr);
64 spin_lock(&muxl->receive_lock); 64 spin_lock(&muxl->receive_lock);
65 cfsrvl_get(up);
65 list_add(&up->node, &muxl->srvl_list); 66 list_add(&up->node, &muxl->srvl_list);
66 spin_unlock(&muxl->receive_lock); 67 spin_unlock(&muxl->receive_lock);
67 return 0; 68 return 0;
@@ -172,8 +173,11 @@ struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 id)
172 struct cfmuxl *muxl = container_obj(layr); 173 struct cfmuxl *muxl = container_obj(layr);
173 spin_lock(&muxl->receive_lock); 174 spin_lock(&muxl->receive_lock);
174 up = get_up(muxl, id); 175 up = get_up(muxl, id);
176 if (up == NULL)
177 return NULL;
175 memset(muxl->up_cache, 0, sizeof(muxl->up_cache)); 178 memset(muxl->up_cache, 0, sizeof(muxl->up_cache));
176 list_del(&up->node); 179 list_del(&up->node);
180 cfsrvl_put(up);
177 spin_unlock(&muxl->receive_lock); 181 spin_unlock(&muxl->receive_lock);
178 return up; 182 return up;
179} 183}
@@ -203,8 +207,9 @@ static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt)
203 */ 207 */
204 return /* CFGLU_EPROT; */ 0; 208 return /* CFGLU_EPROT; */ 0;
205 } 209 }
206 210 cfsrvl_get(up);
207 ret = up->receive(up, pkt); 211 ret = up->receive(up, pkt);
212 cfsrvl_put(up);
208 return ret; 213 return ret;
209} 214}
210 215