aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/caif/cfsrvl.h
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 /include/net/caif/cfsrvl.h
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 'include/net/caif/cfsrvl.h')
-rw-r--r--include/net/caif/cfsrvl.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
index b2a12db20cd2..2dc9eb193ecf 100644
--- a/include/net/caif/cfsrvl.h
+++ b/include/net/caif/cfsrvl.h
@@ -9,14 +9,18 @@
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/stddef.h> 10#include <linux/stddef.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/kref.h>
13
12struct cfsrvl { 14struct cfsrvl {
13 struct cflayer layer; 15 struct cflayer layer;
14 bool open; 16 bool open;
15 bool phy_flow_on; 17 bool phy_flow_on;
16 bool modem_flow_on; 18 bool modem_flow_on;
17 struct dev_info dev_info; 19 struct dev_info dev_info;
20 struct kref ref;
18}; 21};
19 22
23void cfsrvl_release(struct kref *kref);
20struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info); 24struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
21struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); 25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
22struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); 26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
@@ -31,4 +35,22 @@ void cfsrvl_init(struct cfsrvl *service,
31bool cfsrvl_ready(struct cfsrvl *service, int *err); 35bool cfsrvl_ready(struct cfsrvl *service, int *err);
32u8 cfsrvl_getphyid(struct cflayer *layer); 36u8 cfsrvl_getphyid(struct cflayer *layer);
33 37
38static inline void cfsrvl_get(struct cflayer *layr)
39{
40 struct cfsrvl *s;
41 if (layr == NULL)
42 return;
43 s = container_of(layr, struct cfsrvl, layer);
44 kref_get(&s->ref);
45}
46
47static inline void cfsrvl_put(struct cflayer *layr)
48{
49 struct cfsrvl *s;
50 if (layr == NULL)
51 return;
52 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release);
54}
55
34#endif /* CFSRVL_H_ */ 56#endif /* CFSRVL_H_ */