aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif/cfsrvl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/caif/cfsrvl.c')
-rw-r--r--net/caif/cfsrvl.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/net/caif/cfsrvl.c b/net/caif/cfsrvl.c
index 6e5b7079a68..f40939a9121 100644
--- a/net/caif/cfsrvl.c
+++ b/net/caif/cfsrvl.c
@@ -24,8 +24,10 @@ static void cfservl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
24 int phyid) 24 int phyid)
25{ 25{
26 struct cfsrvl *service = container_obj(layr); 26 struct cfsrvl *service = container_obj(layr);
27
27 caif_assert(layr->up != NULL); 28 caif_assert(layr->up != NULL);
28 caif_assert(layr->up->ctrlcmd != NULL); 29 caif_assert(layr->up->ctrlcmd != NULL);
30
29 switch (ctrl) { 31 switch (ctrl) {
30 case CAIF_CTRLCMD_INIT_RSP: 32 case CAIF_CTRLCMD_INIT_RSP:
31 service->open = true; 33 service->open = true;
@@ -89,9 +91,14 @@ static void cfservl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
89static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) 91static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl)
90{ 92{
91 struct cfsrvl *service = container_obj(layr); 93 struct cfsrvl *service = container_obj(layr);
94
92 caif_assert(layr != NULL); 95 caif_assert(layr != NULL);
93 caif_assert(layr->dn != NULL); 96 caif_assert(layr->dn != NULL);
94 caif_assert(layr->dn->transmit != NULL); 97 caif_assert(layr->dn->transmit != NULL);
98
99 if (!service->supports_flowctrl)
100 return 0;
101
95 switch (ctrl) { 102 switch (ctrl) {
96 case CAIF_MODEMCMD_FLOW_ON_REQ: 103 case CAIF_MODEMCMD_FLOW_ON_REQ:
97 { 104 {
@@ -152,9 +159,17 @@ void cfservl_destroy(struct cflayer *layer)
152 kfree(layer); 159 kfree(layer);
153} 160}
154 161
162void cfsrvl_release(struct kref *kref)
163{
164 struct cfsrvl *service = container_of(kref, struct cfsrvl, ref);
165 kfree(service);
166}
167
155void cfsrvl_init(struct cfsrvl *service, 168void cfsrvl_init(struct cfsrvl *service,
156 u8 channel_id, 169 u8 channel_id,
157 struct dev_info *dev_info) 170 struct dev_info *dev_info,
171 bool supports_flowctrl
172 )
158{ 173{
159 caif_assert(offsetof(struct cfsrvl, layer) == 0); 174 caif_assert(offsetof(struct cfsrvl, layer) == 0);
160 service->open = false; 175 service->open = false;
@@ -164,14 +179,11 @@ void cfsrvl_init(struct cfsrvl *service,
164 service->layer.ctrlcmd = cfservl_ctrlcmd; 179 service->layer.ctrlcmd = cfservl_ctrlcmd;
165 service->layer.modemcmd = cfservl_modemcmd; 180 service->layer.modemcmd = cfservl_modemcmd;
166 service->dev_info = *dev_info; 181 service->dev_info = *dev_info;
182 service->supports_flowctrl = supports_flowctrl;
183 service->release = cfsrvl_release;
167 kref_init(&service->ref); 184 kref_init(&service->ref);
168} 185}
169 186
170void cfsrvl_release(struct kref *kref)
171{
172 struct cfsrvl *service = container_of(kref, struct cfsrvl, ref);
173 kfree(service);
174}
175 187
176bool cfsrvl_ready(struct cfsrvl *service, int *err) 188bool cfsrvl_ready(struct cfsrvl *service, int *err)
177{ 189{