aboutsummaryrefslogtreecommitdiffstats
path: root/net/caif/cfctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/caif/cfctrl.c')
-rw-r--r--net/caif/cfctrl.c75
1 files changed, 7 insertions, 68 deletions
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index 3cd8f978e309..397a2c099e2c 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -58,7 +58,8 @@ struct cflayer *cfctrl_create(void)
58 return &this->serv.layer; 58 return &this->serv.layer;
59} 59}
60 60
61static bool param_eq(struct cfctrl_link_param *p1, struct cfctrl_link_param *p2) 61static bool param_eq(const struct cfctrl_link_param *p1,
62 const struct cfctrl_link_param *p2)
62{ 63{
63 bool eq = 64 bool eq =
64 p1->linktype == p2->linktype && 65 p1->linktype == p2->linktype &&
@@ -100,8 +101,8 @@ static bool param_eq(struct cfctrl_link_param *p1, struct cfctrl_link_param *p2)
100 return false; 101 return false;
101} 102}
102 103
103bool cfctrl_req_eq(struct cfctrl_request_info *r1, 104static bool cfctrl_req_eq(const struct cfctrl_request_info *r1,
104 struct cfctrl_request_info *r2) 105 const struct cfctrl_request_info *r2)
105{ 106{
106 if (r1->cmd != r2->cmd) 107 if (r1->cmd != r2->cmd)
107 return false; 108 return false;
@@ -112,7 +113,7 @@ bool cfctrl_req_eq(struct cfctrl_request_info *r1,
112} 113}
113 114
114/* Insert request at the end */ 115/* Insert request at the end */
115void cfctrl_insert_req(struct cfctrl *ctrl, 116static void cfctrl_insert_req(struct cfctrl *ctrl,
116 struct cfctrl_request_info *req) 117 struct cfctrl_request_info *req)
117{ 118{
118 spin_lock(&ctrl->info_list_lock); 119 spin_lock(&ctrl->info_list_lock);
@@ -123,8 +124,8 @@ void cfctrl_insert_req(struct cfctrl *ctrl,
123} 124}
124 125
125/* Compare and remove request */ 126/* Compare and remove request */
126struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, 127static struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
127 struct cfctrl_request_info *req) 128 struct cfctrl_request_info *req)
128{ 129{
129 struct cfctrl_request_info *p, *tmp, *first; 130 struct cfctrl_request_info *p, *tmp, *first;
130 131
@@ -154,16 +155,6 @@ struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer)
154 return &this->res; 155 return &this->res;
155} 156}
156 157
157void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn)
158{
159 this->dn = dn;
160}
161
162void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up)
163{
164 this->up = up;
165}
166
167static void init_info(struct caif_payload_info *info, struct cfctrl *cfctrl) 158static void init_info(struct caif_payload_info *info, struct cfctrl *cfctrl)
168{ 159{
169 info->hdr_len = 0; 160 info->hdr_len = 0;
@@ -304,58 +295,6 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid,
304 return ret; 295 return ret;
305} 296}
306 297
307void cfctrl_sleep_req(struct cflayer *layer)
308{
309 int ret;
310 struct cfctrl *cfctrl = container_obj(layer);
311 struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
312 if (!pkt) {
313 pr_warn("Out of memory\n");
314 return;
315 }
316 cfpkt_addbdy(pkt, CFCTRL_CMD_SLEEP);
317 init_info(cfpkt_info(pkt), cfctrl);
318 ret =
319 cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
320 if (ret < 0)
321 cfpkt_destroy(pkt);
322}
323
324void cfctrl_wake_req(struct cflayer *layer)
325{
326 int ret;
327 struct cfctrl *cfctrl = container_obj(layer);
328 struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
329 if (!pkt) {
330 pr_warn("Out of memory\n");
331 return;
332 }
333 cfpkt_addbdy(pkt, CFCTRL_CMD_WAKE);
334 init_info(cfpkt_info(pkt), cfctrl);
335 ret =
336 cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
337 if (ret < 0)
338 cfpkt_destroy(pkt);
339}
340
341void cfctrl_getstartreason_req(struct cflayer *layer)
342{
343 int ret;
344 struct cfctrl *cfctrl = container_obj(layer);
345 struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
346 if (!pkt) {
347 pr_warn("Out of memory\n");
348 return;
349 }
350 cfpkt_addbdy(pkt, CFCTRL_CMD_START_REASON);
351 init_info(cfpkt_info(pkt), cfctrl);
352 ret =
353 cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
354 if (ret < 0)
355 cfpkt_destroy(pkt);
356}
357
358
359void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) 298void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer)
360{ 299{
361 struct cfctrl_request_info *p, *tmp; 300 struct cfctrl_request_info *p, *tmp;