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>
This commit is contained in:

committed by
David S. Miller

vanhempi
e539d83cc8
commit
5b20865675
@@ -9,14 +9,18 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kref.h>
|
||||
|
||||
struct cfsrvl {
|
||||
struct cflayer layer;
|
||||
bool open;
|
||||
bool phy_flow_on;
|
||||
bool modem_flow_on;
|
||||
struct dev_info dev_info;
|
||||
struct kref ref;
|
||||
};
|
||||
|
||||
void cfsrvl_release(struct kref *kref);
|
||||
struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
|
||||
struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
|
||||
struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
|
||||
@@ -31,4 +35,22 @@ void cfsrvl_init(struct cfsrvl *service,
|
||||
bool cfsrvl_ready(struct cfsrvl *service, int *err);
|
||||
u8 cfsrvl_getphyid(struct cflayer *layer);
|
||||
|
||||
static inline void cfsrvl_get(struct cflayer *layr)
|
||||
{
|
||||
struct cfsrvl *s;
|
||||
if (layr == NULL)
|
||||
return;
|
||||
s = container_of(layr, struct cfsrvl, layer);
|
||||
kref_get(&s->ref);
|
||||
}
|
||||
|
||||
static inline void cfsrvl_put(struct cflayer *layr)
|
||||
{
|
||||
struct cfsrvl *s;
|
||||
if (layr == NULL)
|
||||
return;
|
||||
s = container_of(layr, struct cfsrvl, layer);
|
||||
kref_put(&s->ref, cfsrvl_release);
|
||||
}
|
||||
|
||||
#endif /* CFSRVL_H_ */
|
||||
|
Viittaa uudesa ongelmassa
Block a user