0001
0002
0003
0004
0005
0006
0007 #ifndef CFSRVL_H_
0008 #define CFSRVL_H_
0009 #include <linux/list.h>
0010 #include <linux/stddef.h>
0011 #include <linux/types.h>
0012 #include <linux/kref.h>
0013 #include <linux/rculist.h>
0014
0015 struct cfsrvl {
0016 struct cflayer layer;
0017 bool open;
0018 bool phy_flow_on;
0019 bool modem_flow_on;
0020 bool supports_flowctrl;
0021 void (*release)(struct cflayer *layer);
0022 struct dev_info dev_info;
0023 void (*hold)(struct cflayer *lyr);
0024 void (*put)(struct cflayer *lyr);
0025 struct rcu_head rcu;
0026 };
0027
0028 struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
0029 struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
0030 struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
0031 struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
0032 struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
0033 int mtu_size);
0034 struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
0035
0036 void cfsrvl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
0037 int phyid);
0038
0039 bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
0040
0041 void cfsrvl_init(struct cfsrvl *service,
0042 u8 channel_id,
0043 struct dev_info *dev_info,
0044 bool supports_flowctrl);
0045 bool cfsrvl_ready(struct cfsrvl *service, int *err);
0046 u8 cfsrvl_getphyid(struct cflayer *layer);
0047
0048 static inline void cfsrvl_get(struct cflayer *layr)
0049 {
0050 struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
0051 if (layr == NULL || layr->up == NULL || s->hold == NULL)
0052 return;
0053
0054 s->hold(layr->up);
0055 }
0056
0057 static inline void cfsrvl_put(struct cflayer *layr)
0058 {
0059 struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
0060 if (layr == NULL || layr->up == NULL || s->hold == NULL)
0061 return;
0062
0063 s->put(layr->up);
0064 }
0065 #endif