diff options
Diffstat (limited to 'net/caif/cfcnfg.c')
-rw-r--r-- | net/caif/cfcnfg.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 1c29189b344d..ef93a131310b 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com | 3 | * Author: Sjur Brendeland/sjur.brandeland@stericsson.com |
4 | * License terms: GNU General Public License (GPL) version 2 | 4 | * License terms: GNU General Public License (GPL) version 2 |
5 | */ | 5 | */ |
6 | |||
7 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__ | ||
8 | |||
6 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
7 | #include <linux/stddef.h> | 10 | #include <linux/stddef.h> |
8 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
@@ -78,7 +81,7 @@ struct cfcnfg *cfcnfg_create(void) | |||
78 | /* Initiate this layer */ | 81 | /* Initiate this layer */ |
79 | this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC); | 82 | this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC); |
80 | if (!this) { | 83 | if (!this) { |
81 | pr_warning("CAIF: %s(): Out of memory\n", __func__); | 84 | pr_warn("Out of memory\n"); |
82 | return NULL; | 85 | return NULL; |
83 | } | 86 | } |
84 | this->mux = cfmuxl_create(); | 87 | this->mux = cfmuxl_create(); |
@@ -106,7 +109,7 @@ struct cfcnfg *cfcnfg_create(void) | |||
106 | layer_set_up(this->ctrl, this); | 109 | layer_set_up(this->ctrl, this); |
107 | return this; | 110 | return this; |
108 | out_of_mem: | 111 | out_of_mem: |
109 | pr_warning("CAIF: %s(): Out of memory\n", __func__); | 112 | pr_warn("Out of memory\n"); |
110 | kfree(this->mux); | 113 | kfree(this->mux); |
111 | kfree(this->ctrl); | 114 | kfree(this->ctrl); |
112 | kfree(this); | 115 | kfree(this); |
@@ -194,7 +197,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | |||
194 | caif_assert(adap_layer != NULL); | 197 | caif_assert(adap_layer != NULL); |
195 | channel_id = adap_layer->id; | 198 | channel_id = adap_layer->id; |
196 | if (adap_layer->dn == NULL || channel_id == 0) { | 199 | if (adap_layer->dn == NULL || channel_id == 0) { |
197 | pr_err("CAIF: %s():adap_layer->id is 0\n", __func__); | 200 | pr_err("adap_layer->id is 0\n"); |
198 | ret = -ENOTCONN; | 201 | ret = -ENOTCONN; |
199 | goto end; | 202 | goto end; |
200 | } | 203 | } |
@@ -204,9 +207,8 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | |||
204 | layer_set_up(servl, NULL); | 207 | layer_set_up(servl, NULL); |
205 | ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer); | 208 | ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer); |
206 | if (servl == NULL) { | 209 | if (servl == NULL) { |
207 | pr_err("CAIF: %s(): PROTOCOL ERROR " | 210 | pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)", |
208 | "- Error removing service_layer Channel_Id(%d)", | 211 | channel_id); |
209 | __func__, channel_id); | ||
210 | ret = -EINVAL; | 212 | ret = -EINVAL; |
211 | goto end; | 213 | goto end; |
212 | } | 214 | } |
@@ -216,18 +218,14 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) | |||
216 | 218 | ||
217 | phyinfo = cfcnfg_get_phyinfo(cnfg, phyid); | 219 | phyinfo = cfcnfg_get_phyinfo(cnfg, phyid); |
218 | if (phyinfo == NULL) { | 220 | if (phyinfo == NULL) { |
219 | pr_warning("CAIF: %s(): " | 221 | pr_warn("No interface to send disconnect to\n"); |
220 | "No interface to send disconnect to\n", | ||
221 | __func__); | ||
222 | ret = -ENODEV; | 222 | ret = -ENODEV; |
223 | goto end; | 223 | goto end; |
224 | } | 224 | } |
225 | if (phyinfo->id != phyid || | 225 | if (phyinfo->id != phyid || |
226 | phyinfo->phy_layer->id != phyid || | 226 | phyinfo->phy_layer->id != phyid || |
227 | phyinfo->frm_layer->id != phyid) { | 227 | phyinfo->frm_layer->id != phyid) { |
228 | pr_err("CAIF: %s(): " | 228 | pr_err("Inconsistency in phy registration\n"); |
229 | "Inconsistency in phy registration\n", | ||
230 | __func__); | ||
231 | ret = -EINVAL; | 229 | ret = -EINVAL; |
232 | goto end; | 230 | goto end; |
233 | } | 231 | } |
@@ -276,21 +274,20 @@ int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, | |||
276 | { | 274 | { |
277 | struct cflayer *frml; | 275 | struct cflayer *frml; |
278 | if (adap_layer == NULL) { | 276 | if (adap_layer == NULL) { |
279 | pr_err("CAIF: %s(): adap_layer is zero", __func__); | 277 | pr_err("adap_layer is zero\n"); |
280 | return -EINVAL; | 278 | return -EINVAL; |
281 | } | 279 | } |
282 | if (adap_layer->receive == NULL) { | 280 | if (adap_layer->receive == NULL) { |
283 | pr_err("CAIF: %s(): adap_layer->receive is NULL", __func__); | 281 | pr_err("adap_layer->receive is NULL\n"); |
284 | return -EINVAL; | 282 | return -EINVAL; |
285 | } | 283 | } |
286 | if (adap_layer->ctrlcmd == NULL) { | 284 | if (adap_layer->ctrlcmd == NULL) { |
287 | pr_err("CAIF: %s(): adap_layer->ctrlcmd == NULL", __func__); | 285 | pr_err("adap_layer->ctrlcmd == NULL\n"); |
288 | return -EINVAL; | 286 | return -EINVAL; |
289 | } | 287 | } |
290 | frml = cnfg->phy_layers[param->phyid].frm_layer; | 288 | frml = cnfg->phy_layers[param->phyid].frm_layer; |
291 | if (frml == NULL) { | 289 | if (frml == NULL) { |
292 | pr_err("CAIF: %s(): Specified PHY type does not exist!", | 290 | pr_err("Specified PHY type does not exist!\n"); |
293 | __func__); | ||
294 | return -ENODEV; | 291 | return -ENODEV; |
295 | } | 292 | } |
296 | caif_assert(param->phyid == cnfg->phy_layers[param->phyid].id); | 293 | caif_assert(param->phyid == cnfg->phy_layers[param->phyid].id); |
@@ -330,9 +327,7 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, | |||
330 | struct net_device *netdev; | 327 | struct net_device *netdev; |
331 | 328 | ||
332 | if (adapt_layer == NULL) { | 329 | if (adapt_layer == NULL) { |
333 | pr_debug("CAIF: %s(): link setup response " | 330 | pr_debug("link setup response but no client exist, send linkdown back\n"); |
334 | "but no client exist, send linkdown back\n", | ||
335 | __func__); | ||
336 | cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL); | 331 | cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL); |
337 | return; | 332 | return; |
338 | } | 333 | } |
@@ -374,13 +369,11 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, | |||
374 | servicel = cfdbgl_create(channel_id, &phyinfo->dev_info); | 369 | servicel = cfdbgl_create(channel_id, &phyinfo->dev_info); |
375 | break; | 370 | break; |
376 | default: | 371 | default: |
377 | pr_err("CAIF: %s(): Protocol error. " | 372 | pr_err("Protocol error. Link setup response - unknown channel type\n"); |
378 | "Link setup response - unknown channel type\n", | ||
379 | __func__); | ||
380 | return; | 373 | return; |
381 | } | 374 | } |
382 | if (!servicel) { | 375 | if (!servicel) { |
383 | pr_warning("CAIF: %s(): Out of memory\n", __func__); | 376 | pr_warn("Out of memory\n"); |
384 | return; | 377 | return; |
385 | } | 378 | } |
386 | layer_set_dn(servicel, cnfg->mux); | 379 | layer_set_dn(servicel, cnfg->mux); |
@@ -418,7 +411,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
418 | } | 411 | } |
419 | } | 412 | } |
420 | if (*phyid == 0) { | 413 | if (*phyid == 0) { |
421 | pr_err("CAIF: %s(): No Available PHY ID\n", __func__); | 414 | pr_err("No Available PHY ID\n"); |
422 | return; | 415 | return; |
423 | } | 416 | } |
424 | 417 | ||
@@ -427,7 +420,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
427 | phy_driver = | 420 | phy_driver = |
428 | cfserl_create(CFPHYTYPE_FRAG, *phyid, stx); | 421 | cfserl_create(CFPHYTYPE_FRAG, *phyid, stx); |
429 | if (!phy_driver) { | 422 | if (!phy_driver) { |
430 | pr_warning("CAIF: %s(): Out of memory\n", __func__); | 423 | pr_warn("Out of memory\n"); |
431 | return; | 424 | return; |
432 | } | 425 | } |
433 | 426 | ||
@@ -436,7 +429,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
436 | phy_driver = NULL; | 429 | phy_driver = NULL; |
437 | break; | 430 | break; |
438 | default: | 431 | default: |
439 | pr_err("CAIF: %s(): %d", __func__, phy_type); | 432 | pr_err("%d\n", phy_type); |
440 | return; | 433 | return; |
441 | break; | 434 | break; |
442 | } | 435 | } |
@@ -455,7 +448,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
455 | phy_layer->type = phy_type; | 448 | phy_layer->type = phy_type; |
456 | frml = cffrml_create(*phyid, fcs); | 449 | frml = cffrml_create(*phyid, fcs); |
457 | if (!frml) { | 450 | if (!frml) { |
458 | pr_warning("CAIF: %s(): Out of memory\n", __func__); | 451 | pr_warn("Out of memory\n"); |
459 | return; | 452 | return; |
460 | } | 453 | } |
461 | cnfg->phy_layers[*phyid].frm_layer = frml; | 454 | cnfg->phy_layers[*phyid].frm_layer = frml; |