Commit b31fa5ba authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

net/caif: Use pr_fmt

This patch standardizes caif message logging prefixes.

Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
Add missing "\n"s to some logging messages
Convert pr_warning to pr_warn

This changes the logging message prefix from CAIF: to caif:
for all uses but caif_socket.c and chnl_net.c.  Those now use
their filename without extension.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a0ece285
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* and Sakari Ailus <sakari.ailus@nokia.com> * and Sakari Ailus <sakari.ailus@nokia.com>
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/version.h> #include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -214,7 +216,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -214,7 +216,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
switch (what) { switch (what) {
case NETDEV_REGISTER: case NETDEV_REGISTER:
pr_info("CAIF: %s():register %s\n", __func__, dev->name); pr_info("register %s\n", dev->name);
caifd = caif_device_alloc(dev); caifd = caif_device_alloc(dev);
if (caifd == NULL) if (caifd == NULL)
break; break;
...@@ -225,14 +227,13 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -225,14 +227,13 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
break; break;
case NETDEV_UP: case NETDEV_UP:
pr_info("CAIF: %s(): up %s\n", __func__, dev->name); pr_info("up %s\n", dev->name);
caifd = caif_get(dev); caifd = caif_get(dev);
if (caifd == NULL) if (caifd == NULL)
break; break;
caifdev = netdev_priv(dev); caifdev = netdev_priv(dev);
if (atomic_read(&caifd->state) == NETDEV_UP) { if (atomic_read(&caifd->state) == NETDEV_UP) {
pr_info("CAIF: %s():%s already up\n", pr_info("%s already up\n", dev->name);
__func__, dev->name);
break; break;
} }
atomic_set(&caifd->state, what); atomic_set(&caifd->state, what);
...@@ -273,7 +274,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -273,7 +274,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
caifd = caif_get(dev); caifd = caif_get(dev);
if (caifd == NULL) if (caifd == NULL)
break; break;
pr_info("CAIF: %s():going down %s\n", __func__, dev->name); pr_info("going down %s\n", dev->name);
if (atomic_read(&caifd->state) == NETDEV_GOING_DOWN || if (atomic_read(&caifd->state) == NETDEV_GOING_DOWN ||
atomic_read(&caifd->state) == NETDEV_DOWN) atomic_read(&caifd->state) == NETDEV_DOWN)
...@@ -295,11 +296,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -295,11 +296,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
caifd = caif_get(dev); caifd = caif_get(dev);
if (caifd == NULL) if (caifd == NULL)
break; break;
pr_info("CAIF: %s(): down %s\n", __func__, dev->name); pr_info("down %s\n", dev->name);
if (atomic_read(&caifd->in_use)) if (atomic_read(&caifd->in_use))
pr_warning("CAIF: %s(): " pr_warn("Unregistering an active CAIF device: %s\n",
"Unregistering an active CAIF device: %s\n", dev->name);
__func__, dev->name);
cfcnfg_del_phy_layer(get_caif_conf(), &caifd->layer); cfcnfg_del_phy_layer(get_caif_conf(), &caifd->layer);
dev_put(dev); dev_put(dev);
atomic_set(&caifd->state, what); atomic_set(&caifd->state, what);
...@@ -307,7 +307,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, ...@@ -307,7 +307,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
caifd = caif_get(dev); caifd = caif_get(dev);
pr_info("CAIF: %s(): unregister %s\n", __func__, dev->name); pr_info("unregister %s\n", dev->name);
atomic_set(&caifd->state, what); atomic_set(&caifd->state, what);
caif_device_destroy(dev); caif_device_destroy(dev);
break; break;
...@@ -391,7 +391,7 @@ static int __init caif_device_init(void) ...@@ -391,7 +391,7 @@ static int __init caif_device_init(void)
int result; int result;
cfg = cfcnfg_create(); cfg = cfcnfg_create();
if (!cfg) { if (!cfg) {
pr_warning("CAIF: %s(): can't create cfcnfg.\n", __func__); pr_warn("can't create cfcnfg\n");
goto err_cfcnfg_create_failed; goto err_cfcnfg_create_failed;
} }
result = register_pernet_device(&caif_net_ops); result = register_pernet_device(&caif_net_ops);
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -157,8 +159,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -157,8 +159,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
(unsigned)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) { (unsigned)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) {
trace_printk("CAIF: %s():" trace_printk("CAIF: %s(): "
" sending flow OFF (queue len = %d %d)\n", "sending flow OFF (queue len = %d %d)\n",
__func__, __func__,
atomic_read(&cf_sk->sk.sk_rmem_alloc), atomic_read(&cf_sk->sk.sk_rmem_alloc),
sk_rcvbuf_lowwater(cf_sk)); sk_rcvbuf_lowwater(cf_sk));
...@@ -172,8 +174,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -172,8 +174,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
return err; return err;
if (!sk_rmem_schedule(sk, skb->truesize) && rx_flow_is_on(cf_sk)) { if (!sk_rmem_schedule(sk, skb->truesize) && rx_flow_is_on(cf_sk)) {
set_rx_flow_off(cf_sk); set_rx_flow_off(cf_sk);
trace_printk("CAIF: %s():" trace_printk("CAIF: %s(): "
" sending flow OFF due to rmem_schedule\n", "sending flow OFF due to rmem_schedule\n",
__func__); __func__);
dbfs_atomic_inc(&cnt.num_rx_flow_off); dbfs_atomic_inc(&cnt.num_rx_flow_off);
caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ); caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ);
...@@ -275,8 +277,7 @@ static void caif_ctrl_cb(struct cflayer *layr, ...@@ -275,8 +277,7 @@ static void caif_ctrl_cb(struct cflayer *layr,
break; break;
default: default:
pr_debug("CAIF: %s(): Unexpected flow command %d\n", pr_debug("Unexpected flow command %d\n", flow);
__func__, flow);
} }
} }
...@@ -536,8 +537,7 @@ static int transmit_skb(struct sk_buff *skb, struct caifsock *cf_sk, ...@@ -536,8 +537,7 @@ static int transmit_skb(struct sk_buff *skb, struct caifsock *cf_sk,
/* Slight paranoia, probably not needed. */ /* Slight paranoia, probably not needed. */
if (unlikely(loopcnt++ > 1000)) { if (unlikely(loopcnt++ > 1000)) {
pr_warning("CAIF: %s(): transmit retries failed," pr_warn("transmit retries failed, error = %d\n", ret);
" error = %d\n", __func__, ret);
break; break;
} }
...@@ -902,8 +902,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -902,8 +902,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
cf_sk->maxframe = dev->mtu - (headroom + tailroom); cf_sk->maxframe = dev->mtu - (headroom + tailroom);
dev_put(dev); dev_put(dev);
if (cf_sk->maxframe < 1) { if (cf_sk->maxframe < 1) {
pr_warning("CAIF: %s(): CAIF Interface MTU too small (%d)\n", pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu);
__func__, dev->mtu);
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
* Author: Sjur Brendeland/sjur.brandeland@stericsson.com * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -78,7 +81,7 @@ struct cfcnfg *cfcnfg_create(void) ...@@ -78,7 +81,7 @@ struct cfcnfg *cfcnfg_create(void)
/* Initiate this layer */ /* Initiate this layer */
this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC); this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC);
if (!this) { if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
this->mux = cfmuxl_create(); this->mux = cfmuxl_create();
...@@ -106,7 +109,7 @@ struct cfcnfg *cfcnfg_create(void) ...@@ -106,7 +109,7 @@ struct cfcnfg *cfcnfg_create(void)
layer_set_up(this->ctrl, this); layer_set_up(this->ctrl, this);
return this; return this;
out_of_mem: out_of_mem:
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
kfree(this->mux); kfree(this->mux);
kfree(this->ctrl); kfree(this->ctrl);
kfree(this); kfree(this);
...@@ -194,7 +197,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) ...@@ -194,7 +197,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
caif_assert(adap_layer != NULL); caif_assert(adap_layer != NULL);
channel_id = adap_layer->id; channel_id = adap_layer->id;
if (adap_layer->dn == NULL || channel_id == 0) { if (adap_layer->dn == NULL || channel_id == 0) {
pr_err("CAIF: %s():adap_layer->id is 0\n", __func__); pr_err("adap_layer->id is 0\n");
ret = -ENOTCONN; ret = -ENOTCONN;
goto end; goto end;
} }
...@@ -204,9 +207,8 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) ...@@ -204,9 +207,8 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
layer_set_up(servl, NULL); layer_set_up(servl, NULL);
ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer); ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
if (servl == NULL) { if (servl == NULL) {
pr_err("CAIF: %s(): PROTOCOL ERROR " pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)",
"- Error removing service_layer Channel_Id(%d)", channel_id);
__func__, channel_id);
ret = -EINVAL; ret = -EINVAL;
goto end; goto end;
} }
...@@ -216,18 +218,14 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer) ...@@ -216,18 +218,14 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
phyinfo = cfcnfg_get_phyinfo(cnfg, phyid); phyinfo = cfcnfg_get_phyinfo(cnfg, phyid);
if (phyinfo == NULL) { if (phyinfo == NULL) {
pr_warning("CAIF: %s(): " pr_warn("No interface to send disconnect to\n");
"No interface to send disconnect to\n",
__func__);
ret = -ENODEV; ret = -ENODEV;
goto end; goto end;
} }
if (phyinfo->id != phyid || if (phyinfo->id != phyid ||
phyinfo->phy_layer->id != phyid || phyinfo->phy_layer->id != phyid ||
phyinfo->frm_layer->id != phyid) { phyinfo->frm_layer->id != phyid) {
pr_err("CAIF: %s(): " pr_err("Inconsistency in phy registration\n");
"Inconsistency in phy registration\n",
__func__);
ret = -EINVAL; ret = -EINVAL;
goto end; goto end;
} }
...@@ -276,21 +274,20 @@ int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, ...@@ -276,21 +274,20 @@ int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
{ {
struct cflayer *frml; struct cflayer *frml;
if (adap_layer == NULL) { if (adap_layer == NULL) {
pr_err("CAIF: %s(): adap_layer is zero", __func__); pr_err("adap_layer is zero\n");
return -EINVAL; return -EINVAL;
} }
if (adap_layer->receive == NULL) { if (adap_layer->receive == NULL) {
pr_err("CAIF: %s(): adap_layer->receive is NULL", __func__); pr_err("adap_layer->receive is NULL\n");
return -EINVAL; return -EINVAL;
} }
if (adap_layer->ctrlcmd == NULL) { if (adap_layer->ctrlcmd == NULL) {
pr_err("CAIF: %s(): adap_layer->ctrlcmd == NULL", __func__); pr_err("adap_layer->ctrlcmd == NULL\n");
return -EINVAL; return -EINVAL;
} }
frml = cnfg->phy_layers[param->phyid].frm_layer; frml = cnfg->phy_layers[param->phyid].frm_layer;
if (frml == NULL) { if (frml == NULL) {
pr_err("CAIF: %s(): Specified PHY type does not exist!", pr_err("Specified PHY type does not exist!\n");
__func__);
return -ENODEV; return -ENODEV;
} }
caif_assert(param->phyid == cnfg->phy_layers[param->phyid].id); 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,9 +327,7 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
struct net_device *netdev; struct net_device *netdev;
if (adapt_layer == NULL) { if (adapt_layer == NULL) {
pr_debug("CAIF: %s(): link setup response " pr_debug("link setup response but no client exist, send linkdown back\n");
"but no client exist, send linkdown back\n",
__func__);
cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL); cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL);
return; return;
} }
...@@ -374,13 +369,11 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv, ...@@ -374,13 +369,11 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
servicel = cfdbgl_create(channel_id, &phyinfo->dev_info); servicel = cfdbgl_create(channel_id, &phyinfo->dev_info);
break; break;
default: default:
pr_err("CAIF: %s(): Protocol error. " pr_err("Protocol error. Link setup response - unknown channel type\n");
"Link setup response - unknown channel type\n",
__func__);
return; return;
} }
if (!servicel) { if (!servicel) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
layer_set_dn(servicel, cnfg->mux); layer_set_dn(servicel, cnfg->mux);
...@@ -418,7 +411,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, ...@@ -418,7 +411,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
} }
} }
if (*phyid == 0) { if (*phyid == 0) {
pr_err("CAIF: %s(): No Available PHY ID\n", __func__); pr_err("No Available PHY ID\n");
return; return;
} }
...@@ -427,7 +420,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, ...@@ -427,7 +420,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_driver = phy_driver =
cfserl_create(CFPHYTYPE_FRAG, *phyid, stx); cfserl_create(CFPHYTYPE_FRAG, *phyid, stx);
if (!phy_driver) { if (!phy_driver) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
...@@ -436,7 +429,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, ...@@ -436,7 +429,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_driver = NULL; phy_driver = NULL;
break; break;
default: default:
pr_err("CAIF: %s(): %d", __func__, phy_type); pr_err("%d\n", phy_type);
return; return;
break; break;
} }
...@@ -455,7 +448,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, ...@@ -455,7 +448,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_layer->type = phy_type; phy_layer->type = phy_type;
frml = cffrml_create(*phyid, fcs); frml = cffrml_create(*phyid, fcs);
if (!frml) { if (!frml) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
cnfg->phy_layers[*phyid].frm_layer = frml; cnfg->phy_layers[*phyid].frm_layer = frml;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -36,7 +38,7 @@ struct cflayer *cfctrl_create(void) ...@@ -36,7 +38,7 @@ struct cflayer *cfctrl_create(void)
struct cfctrl *this = struct cfctrl *this =
kmalloc(sizeof(struct cfctrl), GFP_ATOMIC); kmalloc(sizeof(struct cfctrl), GFP_ATOMIC);
if (!this) { if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfctrl, serv.layer) == 0); caif_assert(offsetof(struct cfctrl, serv.layer) == 0);
...@@ -132,9 +134,7 @@ struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, ...@@ -132,9 +134,7 @@ struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
list_for_each_entry_safe(p, tmp, &ctrl->list, list) { list_for_each_entry_safe(p, tmp, &ctrl->list, list) {
if (cfctrl_req_eq(req, p)) { if (cfctrl_req_eq(req, p)) {
if (p != first) if (p != first)
pr_warning("CAIF: %s(): Requests are not " pr_warn("Requests are not received in order\n");
"received in order\n",
__func__);
atomic_set(&ctrl->rsp_seq_no, atomic_set(&ctrl->rsp_seq_no,
p->sequence_no); p->sequence_no);
...@@ -177,7 +177,7 @@ void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid) ...@@ -177,7 +177,7 @@ void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid)
int ret; int ret;
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
caif_assert(offsetof(struct cfctrl, serv.layer) == 0); caif_assert(offsetof(struct cfctrl, serv.layer) == 0);
...@@ -189,8 +189,7 @@ void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid) ...@@ -189,8 +189,7 @@ void cfctrl_enum_req(struct cflayer *layer, u8 physlinkid)
ret = ret =
cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt); cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
if (ret < 0) { if (ret < 0) {
pr_err("CAIF: %s(): Could not transmit enum message\n", pr_err("Could not transmit enum message\n");
__func__);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
} }
} }
...@@ -208,7 +207,7 @@ int cfctrl_linkup_request(struct cflayer *layer, ...@@ -208,7 +207,7 @@ int cfctrl_linkup_request(struct cflayer *layer,
char utility_name[16]; char utility_name[16];
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_SETUP); cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_SETUP);
...@@ -253,13 +252,13 @@ int cfctrl_linkup_request(struct cflayer *layer, ...@@ -253,13 +252,13 @@ int cfctrl_linkup_request(struct cflayer *layer,
param->u.utility.paramlen); param->u.utility.paramlen);
break; break;
default: default:
pr_warning("CAIF: %s():Request setup of bad link type = %d\n", pr_warn("Request setup of bad link type = %d\n",
__func__, param->linktype); param->linktype);
return -EINVAL; return -EINVAL;
} }
req = kzalloc(sizeof(*req), GFP_KERNEL); req = kzalloc(sizeof(*req), GFP_KERNEL);
if (!req) { if (!req) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
req->client_layer = user_layer; req->client_layer = user_layer;
...@@ -276,8 +275,7 @@ int cfctrl_linkup_request(struct cflayer *layer, ...@@ -276,8 +275,7 @@ int cfctrl_linkup_request(struct cflayer *layer,
ret = ret =
cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt); cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
if (ret < 0) { if (ret < 0) {
pr_err("CAIF: %s(): Could not transmit linksetup request\n", pr_err("Could not transmit linksetup request\n");
__func__);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -ENODEV; return -ENODEV;
} }
...@@ -291,7 +289,7 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid, ...@@ -291,7 +289,7 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid,
struct cfctrl *cfctrl = container_obj(layer); struct cfctrl *cfctrl = container_obj(layer);
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_DESTROY); cfpkt_addbdy(pkt, CFCTRL_CMD_LINK_DESTROY);
...@@ -300,8 +298,7 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid, ...@@ -300,8 +298,7 @@ int cfctrl_linkdown_req(struct cflayer *layer, u8 channelid,
ret = ret =
cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt); cfctrl->serv.layer.dn->transmit(cfctrl->serv.layer.dn, pkt);
if (ret < 0) { if (ret < 0) {
pr_err("CAIF: %s(): Could not transmit link-down request\n", pr_err("Could not transmit link-down request\n");
__func__);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
} }
return ret; return ret;
...@@ -313,7 +310,7 @@ void cfctrl_sleep_req(struct cflayer *layer) ...@@ -313,7 +310,7 @@ void cfctrl_sleep_req(struct cflayer *layer)
struct cfctrl *cfctrl = container_obj(layer); struct cfctrl *cfctrl = container_obj(layer);
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
cfpkt_addbdy(pkt, CFCTRL_CMD_SLEEP); cfpkt_addbdy(pkt, CFCTRL_CMD_SLEEP);
...@@ -330,7 +327,7 @@ void cfctrl_wake_req(struct cflayer *layer) ...@@ -330,7 +327,7 @@ void cfctrl_wake_req(struct cflayer *layer)
struct cfctrl *cfctrl = container_obj(layer); struct cfctrl *cfctrl = container_obj(layer);
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
cfpkt_addbdy(pkt, CFCTRL_CMD_WAKE); cfpkt_addbdy(pkt, CFCTRL_CMD_WAKE);
...@@ -347,7 +344,7 @@ void cfctrl_getstartreason_req(struct cflayer *layer) ...@@ -347,7 +344,7 @@ void cfctrl_getstartreason_req(struct cflayer *layer)
struct cfctrl *cfctrl = container_obj(layer); struct cfctrl *cfctrl = container_obj(layer);
struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN); struct cfpkt *pkt = cfpkt_create(CFPKT_CTRL_PKT_LEN);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return; return;
} }
cfpkt_addbdy(pkt, CFCTRL_CMD_START_REASON); cfpkt_addbdy(pkt, CFCTRL_CMD_START_REASON);
...@@ -364,12 +361,11 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) ...@@ -364,12 +361,11 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer)
struct cfctrl_request_info *p, *tmp; struct cfctrl_request_info *p, *tmp;
struct cfctrl *ctrl = container_obj(layr); struct cfctrl *ctrl = container_obj(layr);
spin_lock(&ctrl->info_list_lock); spin_lock(&ctrl->info_list_lock);
pr_warning("CAIF: %s(): enter\n", __func__); pr_warn("enter\n");
list_for_each_entry_safe(p, tmp, &ctrl->list, list) { list_for_each_entry_safe(p, tmp, &ctrl->list, list) {
if (p->client_layer == adap_layer) { if (p->client_layer == adap_layer) {
pr_warning("CAIF: %s(): cancel req :%d\n", __func__, pr_warn("cancel req :%d\n", p->sequence_no);
p->sequence_no);
list_del(&p->list); list_del(&p->list);
kfree(p); kfree(p);
} }
...@@ -520,9 +516,8 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) ...@@ -520,9 +516,8 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
cfpkt_extr_head(pkt, &param, len); cfpkt_extr_head(pkt, &param, len);
break; break;
default: default:
pr_warning("CAIF: %s(): Request setup " pr_warn("Request setup - invalid link type (%d)\n",
"- invalid link type (%d)", serv);
__func__, serv);
goto error; goto error;
} }
...@@ -532,9 +527,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) ...@@ -532,9 +527,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
if (CFCTRL_ERR_BIT == (CFCTRL_ERR_BIT & cmdrsp) || if (CFCTRL_ERR_BIT == (CFCTRL_ERR_BIT & cmdrsp) ||
cfpkt_erroneous(pkt)) { cfpkt_erroneous(pkt)) {
pr_err("CAIF: %s(): Invalid O/E bit or parse " pr_err("Invalid O/E bit or parse error on CAIF control channel\n");
"error on CAIF control channel",
__func__);
cfctrl->res.reject_rsp(cfctrl->serv.layer.up, cfctrl->res.reject_rsp(cfctrl->serv.layer.up,
0, 0,
req ? req->client_layer req ? req->client_layer
...@@ -556,8 +549,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) ...@@ -556,8 +549,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
cfctrl->res.linkdestroy_rsp(cfctrl->serv.layer.up, linkid); cfctrl->res.linkdestroy_rsp(cfctrl->serv.layer.up, linkid);
break; break;
case CFCTRL_CMD_LINK_ERR: case CFCTRL_CMD_LINK_ERR:
pr_err("CAIF: %s(): Frame Error Indication received\n", pr_err("Frame Error Indication received\n");
__func__);
cfctrl->res.linkerror_ind(); cfctrl->res.linkerror_ind();
break; break;
case CFCTRL_CMD_ENUM: case CFCTRL_CMD_ENUM:
...@@ -576,7 +568,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) ...@@ -576,7 +568,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
cfctrl->res.radioset_rsp(); cfctrl->res.radioset_rsp();
break; break;
default: default:
pr_err("CAIF: %s(): Unrecognized Control Frame\n", __func__); pr_err("Unrecognized Control Frame\n");
goto error; goto error;
break; break;
} }
...@@ -595,8 +587,7 @@ static void cfctrl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, ...@@ -595,8 +587,7 @@ static void cfctrl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
case CAIF_CTRLCMD_FLOW_OFF_IND: case CAIF_CTRLCMD_FLOW_OFF_IND:
spin_lock(&this->info_list_lock); spin_lock(&this->info_list_lock);
if (!list_empty(&this->list)) { if (!list_empty(&this->list)) {
pr_debug("CAIF: %s(): Received flow off in " pr_debug("Received flow off in control layer\n");
"control layer", __func__);
} }
spin_unlock(&this->info_list_lock); spin_unlock(&this->info_list_lock);
break; break;
...@@ -620,7 +611,7 @@ static int handle_loop(struct cfctrl *ctrl, int cmd, struct cfpkt *pkt) ...@@ -620,7 +611,7 @@ static int handle_loop(struct cfctrl *ctrl, int cmd, struct cfpkt *pkt)
if (!ctrl->loop_linkused[linkid]) if (!ctrl->loop_linkused[linkid])
goto found; goto found;
spin_unlock(&ctrl->loop_linkid_lock); spin_unlock(&ctrl->loop_linkid_lock);
pr_err("CAIF: %s(): Out of link-ids\n", __func__); pr_err("Out of link-ids\n");
return -EINVAL; return -EINVAL;
found: found:
if (!ctrl->loop_linkused[linkid]) if (!ctrl->loop_linkused[linkid])
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/caif/caif_layer.h> #include <net/caif/caif_layer.h>
...@@ -17,7 +19,7 @@ struct cflayer *cfdbgl_create(u8 channel_id, struct dev_info *dev_info) ...@@ -17,7 +19,7 @@ struct cflayer *cfdbgl_create(u8 channel_id, struct dev_info *dev_info)
{ {
struct cfsrvl *dbg = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); struct cfsrvl *dbg = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
if (!dbg) { if (!dbg) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfsrvl, layer) == 0); caif_assert(offsetof(struct cfsrvl, layer) == 0);
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -26,7 +28,7 @@ struct cflayer *cfdgml_create(u8 channel_id, struct dev_info *dev_info) ...@@ -26,7 +28,7 @@ struct cflayer *cfdgml_create(u8 channel_id, struct dev_info *dev_info)
{ {
struct cfsrvl *dgm = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); struct cfsrvl *dgm = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
if (!dgm) { if (!dgm) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfsrvl, layer) == 0); caif_assert(offsetof(struct cfsrvl, layer) == 0);
...@@ -49,14 +51,14 @@ static int cfdgml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -49,14 +51,14 @@ static int cfdgml_receive(struct cflayer *layr, struct cfpkt *pkt)
caif_assert(layr->ctrlcmd != NULL); caif_assert(layr->ctrlcmd != NULL);
if (cfpkt_extr_head(pkt, &cmd, 1) < 0) { if (cfpkt_extr_head(pkt, &cmd, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
if ((cmd & DGM_CMD_BIT) == 0) { if ((cmd & DGM_CMD_BIT) == 0) {
if (cfpkt_extr_head(pkt, &dgmhdr, 3) < 0) { if (cfpkt_extr_head(pkt, &dgmhdr, 3) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -75,8 +77,7 @@ static int cfdgml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -75,8 +77,7 @@ static int cfdgml_receive(struct cflayer *layr, struct cfpkt *pkt)
return 0; return 0;
default: default:
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
pr_info("CAIF: %s(): Unknown datagram control %d (0x%x)\n", pr_info("Unknown datagram control %d (0x%x)\n", cmd, cmd);
__func__, cmd, cmd);
return -EPROTO; return -EPROTO;
} }
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -32,7 +34,7 @@ struct cflayer *cffrml_create(u16 phyid, bool use_fcs) ...@@ -32,7 +34,7 @@ struct cflayer *cffrml_create(u16 phyid, bool use_fcs)
{ {
struct cffrml *this = kmalloc(sizeof(struct cffrml), GFP_ATOMIC); struct cffrml *this = kmalloc(sizeof(struct cffrml), GFP_ATOMIC);
if (!this) { if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cffrml, layer) == 0); caif_assert(offsetof(struct cffrml, layer) == 0);
...@@ -83,7 +85,7 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -83,7 +85,7 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
if (cfpkt_setlen(pkt, len) < 0) { if (cfpkt_setlen(pkt, len) < 0) {
++cffrml_rcv_error; ++cffrml_rcv_error;
pr_err("CAIF: %s():Framing length error (%d)\n", __func__, len); pr_err("Framing length error (%d)\n", len);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -99,14 +101,14 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -99,14 +101,14 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
cfpkt_add_trail(pkt, &tmp, 2); cfpkt_add_trail(pkt, &tmp, 2);
++cffrml_rcv_error; ++cffrml_rcv_error;
++cffrml_rcv_checsum_error; ++cffrml_rcv_checsum_error;
pr_info("CAIF: %s(): Frame checksum error " pr_info("Frame checksum error (0x%x != 0x%x)\n",
"(0x%x != 0x%x)\n", __func__, hdrchks, pktchks); hdrchks, pktchks);
return -EILSEQ; return -EILSEQ;
} }
} }
if (cfpkt_erroneous(pkt)) { if (cfpkt_erroneous(pkt)) {
++cffrml_rcv_error; ++cffrml_rcv_error;
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -132,7 +134,7 @@ static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) ...@@ -132,7 +134,7 @@ static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt)
cfpkt_add_head(pkt, &tmp, 2); cfpkt_add_head(pkt, &tmp, 2);
cfpkt_info(pkt)->hdr_len += 2; cfpkt_info(pkt)->hdr_len += 2;
if (cfpkt_erroneous(pkt)) { if (cfpkt_erroneous(pkt)) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
return -EPROTO; return -EPROTO;
} }
ret = layr->dn->transmit(layr->dn, pkt); ret = layr->dn->transmit(layr->dn, pkt);
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
* Author: Sjur Brendeland/sjur.brandeland@stericsson.com * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -190,7 +193,7 @@ static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -190,7 +193,7 @@ static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt)
u8 id; u8 id;
struct cflayer *up; struct cflayer *up;
if (cfpkt_extr_head(pkt, &id, 1) < 0) { if (cfpkt_extr_head(pkt, &id, 1) < 0) {
pr_err("CAIF: %s(): erroneous Caif Packet\n", __func__); pr_err("erroneous Caif Packet\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -199,8 +202,8 @@ static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -199,8 +202,8 @@ static int cfmuxl_receive(struct cflayer *layr, struct cfpkt *pkt)
up = get_up(muxl, id); up = get_up(muxl, id);
spin_unlock(&muxl->receive_lock); spin_unlock(&muxl->receive_lock);
if (up == NULL) { if (up == NULL) {
pr_info("CAIF: %s():Received data on unknown link ID = %d " pr_info("Received data on unknown link ID = %d (0x%x) up == NULL",
"(0x%x) up == NULL", __func__, id, id); id, id);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
/* /*
* Don't return ERROR, since modem misbehaves and sends out * Don't return ERROR, since modem misbehaves and sends out
...@@ -223,9 +226,8 @@ static int cfmuxl_transmit(struct cflayer *layr, struct cfpkt *pkt) ...@@ -223,9 +226,8 @@ static int cfmuxl_transmit(struct cflayer *layr, struct cfpkt *pkt)
struct caif_payload_info *info = cfpkt_info(pkt); struct caif_payload_info *info = cfpkt_info(pkt);
dn = get_dn(muxl, cfpkt_info(pkt)->dev_info); dn = get_dn(muxl, cfpkt_info(pkt)->dev_info);
if (dn == NULL) { if (dn == NULL) {
pr_warning("CAIF: %s(): Send data on unknown phy " pr_warn("Send data on unknown phy ID = %d (0x%x)\n",
"ID = %d (0x%x)\n", info->dev_info->id, info->dev_info->id);
__func__, info->dev_info->id, info->dev_info->id);
return -ENOTCONN; return -ENOTCONN;
} }
info->hdr_len += 1; info->hdr_len += 1;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/string.h> #include <linux/string.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
...@@ -12,11 +14,12 @@ ...@@ -12,11 +14,12 @@
#define PKT_PREFIX 48 #define PKT_PREFIX 48
#define PKT_POSTFIX 2 #define PKT_POSTFIX 2
#define PKT_LEN_WHEN_EXTENDING 128 #define PKT_LEN_WHEN_EXTENDING 128
#define PKT_ERROR(pkt, errmsg) do { \ #define PKT_ERROR(pkt, errmsg) \
cfpkt_priv(pkt)->erronous = true; \ do { \
skb_reset_tail_pointer(&pkt->skb); \ cfpkt_priv(pkt)->erronous = true; \
pr_warning("CAIF: " errmsg);\ skb_reset_tail_pointer(&pkt->skb); \
} while (0) pr_warn(errmsg); \
} while (0)
struct cfpktq { struct cfpktq {
struct sk_buff_head head; struct sk_buff_head head;
...@@ -130,13 +133,13 @@ int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len) ...@@ -130,13 +133,13 @@ int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len)
return -EPROTO; return -EPROTO;
if (unlikely(len > skb->len)) { if (unlikely(len > skb->len)) {
PKT_ERROR(pkt, "cfpkt_extr_head read beyond end of packet\n"); PKT_ERROR(pkt, "read beyond end of packet\n");
return -EPROTO; return -EPROTO;
} }
if (unlikely(len > skb_headlen(skb))) { if (unlikely(len > skb_headlen(skb))) {
if (unlikely(skb_linearize(skb) != 0)) { if (unlikely(skb_linearize(skb) != 0)) {
PKT_ERROR(pkt, "cfpkt_extr_head linearize failed\n"); PKT_ERROR(pkt, "linearize failed\n");
return -EPROTO; return -EPROTO;
} }
} }
...@@ -156,11 +159,11 @@ int cfpkt_extr_trail(struct cfpkt *pkt, void *dta, u16 len) ...@@ -156,11 +159,11 @@ int cfpkt_extr_trail(struct cfpkt *pkt, void *dta, u16 len)
return -EPROTO; return -EPROTO;
if (unlikely(skb_linearize(skb) != 0)) { if (unlikely(skb_linearize(skb) != 0)) {
PKT_ERROR(pkt, "cfpkt_extr_trail linearize failed\n"); PKT_ERROR(pkt, "linearize failed\n");
return -EPROTO; return -EPROTO;
} }
if (unlikely(skb->data + len > skb_tail_pointer(skb))) { if (unlikely(skb->data + len > skb_tail_pointer(skb))) {
PKT_ERROR(pkt, "cfpkt_extr_trail read beyond end of packet\n"); PKT_ERROR(pkt, "read beyond end of packet\n");
return -EPROTO; return -EPROTO;
} }
from = skb_tail_pointer(skb) - len; from = skb_tail_pointer(skb) - len;
...@@ -202,7 +205,7 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len) ...@@ -202,7 +205,7 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len)
/* Make sure data is writable */ /* Make sure data is writable */
if (unlikely(skb_cow_data(skb, addlen, &lastskb) < 0)) { if (unlikely(skb_cow_data(skb, addlen, &lastskb) < 0)) {
PKT_ERROR(pkt, "cfpkt_add_body: cow failed\n"); PKT_ERROR(pkt, "cow failed\n");
return -EPROTO; return -EPROTO;
} }
/* /*
...@@ -211,8 +214,7 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len) ...@@ -211,8 +214,7 @@ int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len)
* lengths of the top SKB. * lengths of the top SKB.
*/ */
if (lastskb != skb) { if (lastskb != skb) {
pr_warning("CAIF: %s(): Packet is non-linear\n", pr_warn("Packet is non-linear\n");
__func__);
skb->len += len; skb->len += len;
skb->data_len += len; skb->data_len += len;
} }
...@@ -242,14 +244,14 @@ int cfpkt_add_head(struct cfpkt *pkt, const void *data2, u16 len) ...@@ -242,14 +244,14 @@ int cfpkt_add_head(struct cfpkt *pkt, const void *data2, u16 len)
if (unlikely(is_erronous(pkt))) if (unlikely(is_erronous(pkt)))
return -EPROTO; return -EPROTO;
if (unlikely(skb_headroom(skb) < len)) { if (unlikely(skb_headroom(skb) < len)) {
PKT_ERROR(pkt, "cfpkt_add_head: no headroom\n"); PKT_ERROR(pkt, "no headroom\n");
return -EPROTO; return -EPROTO;
} }
/* Make sure data is writable */ /* Make sure data is writable */
ret = skb_cow_data(skb, 0, &lastskb); ret = skb_cow_data(skb, 0, &lastskb);
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {
PKT_ERROR(pkt, "cfpkt_add_head: cow failed\n"); PKT_ERROR(pkt, "cow failed\n");
return ret; return ret;
} }
...@@ -283,7 +285,7 @@ inline u16 cfpkt_iterate(struct cfpkt *pkt, ...@@ -283,7 +285,7 @@ inline u16 cfpkt_iterate(struct cfpkt *pkt,
if (unlikely(is_erronous(pkt))) if (unlikely(is_erronous(pkt)))
return -EPROTO; return -EPROTO;
if (unlikely(skb_linearize(&pkt->skb) != 0)) { if (unlikely(skb_linearize(&pkt->skb) != 0)) {
PKT_ERROR(pkt, "cfpkt_iterate: linearize failed\n"); PKT_ERROR(pkt, "linearize failed\n");
return -EPROTO; return -EPROTO;
} }
return iter_func(data, pkt->skb.data, cfpkt_getlen(pkt)); return iter_func(data, pkt->skb.data, cfpkt_getlen(pkt));
...@@ -309,7 +311,7 @@ int cfpkt_setlen(struct cfpkt *pkt, u16 len) ...@@ -309,7 +311,7 @@ int cfpkt_setlen(struct cfpkt *pkt, u16 len)
/* Need to expand SKB */ /* Need to expand SKB */
if (unlikely(!cfpkt_pad_trail(pkt, len - skb->len))) if (unlikely(!cfpkt_pad_trail(pkt, len - skb->len)))
PKT_ERROR(pkt, "cfpkt_setlen: skb_pad_trail failed\n"); PKT_ERROR(pkt, "skb_pad_trail failed\n");
return cfpkt_getlen(pkt); return cfpkt_getlen(pkt);
} }
...@@ -380,8 +382,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos) ...@@ -380,8 +382,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos)
return NULL; return NULL;
if (skb->data + pos > skb_tail_pointer(skb)) { if (skb->data + pos > skb_tail_pointer(skb)) {
PKT_ERROR(pkt, PKT_ERROR(pkt, "trying to split beyond end of packet\n");
"cfpkt_split: trying to split beyond end of packet");
return NULL; return NULL;
} }
...@@ -455,17 +456,17 @@ int cfpkt_raw_append(struct cfpkt *pkt, void **buf, unsigned int buflen) ...@@ -455,17 +456,17 @@ int cfpkt_raw_append(struct cfpkt *pkt, void **buf, unsigned int buflen)
return -EPROTO; return -EPROTO;
/* Make sure SKB is writable */ /* Make sure SKB is writable */
if (unlikely(skb_cow_data(skb, 0, &lastskb) < 0)) { if (unlikely(skb_cow_data(skb, 0, &lastskb) < 0)) {
PKT_ERROR(pkt, "cfpkt_raw_append: skb_cow_data failed\n"); PKT_ERROR(pkt, "skb_cow_data failed\n");
return -EPROTO; return -EPROTO;
} }
if (unlikely(skb_linearize(skb) != 0)) { if (unlikely(skb_linearize(skb) != 0)) {
PKT_ERROR(pkt, "cfpkt_raw_append: linearize failed\n"); PKT_ERROR(pkt, "linearize failed\n");
return -EPROTO; return -EPROTO;
} }
if (unlikely(skb_tailroom(skb) < buflen)) { if (unlikely(skb_tailroom(skb) < buflen)) {
PKT_ERROR(pkt, "cfpkt_raw_append: buffer too short - failed\n"); PKT_ERROR(pkt, "buffer too short - failed\n");
return -EPROTO; return -EPROTO;
} }
...@@ -483,14 +484,13 @@ int cfpkt_raw_extract(struct cfpkt *pkt, void **buf, unsigned int buflen) ...@@ -483,14 +484,13 @@ int cfpkt_raw_extract(struct cfpkt *pkt, void **buf, unsigned int buflen)
return -EPROTO; return -EPROTO;
if (unlikely(buflen > skb->len)) { if (unlikely(buflen > skb->len)) {
PKT_ERROR(pkt, "cfpkt_raw_extract: buflen too large " PKT_ERROR(pkt, "buflen too large - failed\n");
"- failed\n");
return -EPROTO; return -EPROTO;
} }
if (unlikely(buflen > skb_headlen(skb))) { if (unlikely(buflen > skb_headlen(skb))) {
if (unlikely(skb_linearize(skb) != 0)) { if (unlikely(skb_linearize(skb) != 0)) {
PKT_ERROR(pkt, "cfpkt_raw_extract: linearize failed\n"); PKT_ERROR(pkt, "linearize failed\n");
return -EPROTO; return -EPROTO;
} }
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -48,7 +50,7 @@ struct cflayer *cfrfml_create(u8 channel_id, struct dev_info *dev_info, ...@@ -48,7 +50,7 @@ struct cflayer *cfrfml_create(u8 channel_id, struct dev_info *dev_info,
kzalloc(sizeof(struct cfrfml), GFP_ATOMIC); kzalloc(sizeof(struct cfrfml), GFP_ATOMIC);
if (!this) { if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
...@@ -178,9 +180,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -178,9 +180,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt)
cfpkt_destroy(rfml->incomplete_frm); cfpkt_destroy(rfml->incomplete_frm);
rfml->incomplete_frm = NULL; rfml->incomplete_frm = NULL;
pr_info("CAIF: %s(): " pr_info("Connection error %d triggered on RFM link\n", err);
"Connection error %d triggered on RFM link\n",
__func__, err);
/* Trigger connection error upon failure.*/ /* Trigger connection error upon failure.*/
layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND,
...@@ -280,9 +280,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt) ...@@ -280,9 +280,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
out: out:
if (err != 0) { if (err != 0) {
pr_info("CAIF: %s(): " pr_info("Connection error %d triggered on RFM link\n", err);
"Connection error %d triggered on RFM link\n",
__func__, err);
/* Trigger connection error upon failure.*/ /* Trigger connection error upon failure.*/
layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, layr->up->ctrlcmd(layr->up, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -34,7 +36,7 @@ struct cflayer *cfserl_create(int type, int instance, bool use_stx) ...@@ -34,7 +36,7 @@ struct cflayer *cfserl_create(int type, int instance, bool use_stx)
{ {
struct cfserl *this = kmalloc(sizeof(struct cfserl), GFP_ATOMIC); struct cfserl *this = kmalloc(sizeof(struct cfserl), GFP_ATOMIC);
if (!this) { if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfserl, layer) == 0); caif_assert(offsetof(struct cfserl, layer) == 0);
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -79,8 +81,7 @@ static void cfservl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, ...@@ -79,8 +81,7 @@ static void cfservl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
layr->up->ctrlcmd(layr->up, ctrl, phyid); layr->up->ctrlcmd(layr->up, ctrl, phyid);
break; break;
default: default:
pr_warning("CAIF: %s(): " pr_warn("Unexpected ctrl in cfsrvl (%d)\n", ctrl);
"Unexpected ctrl in cfsrvl (%d)\n", __func__, ctrl);
/* We have both modem and phy flow on, send flow on */ /* We have both modem and phy flow on, send flow on */
layr->up->ctrlcmd(layr->up, ctrl, phyid); layr->up->ctrlcmd(layr->up, ctrl, phyid);
service->phy_flow_on = true; service->phy_flow_on = true;
...@@ -107,14 +108,12 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) ...@@ -107,14 +108,12 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl)
u8 flow_on = SRVL_FLOW_ON; u8 flow_on = SRVL_FLOW_ON;
pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", pr_warn("Out of memory\n");
__func__);
return -ENOMEM; return -ENOMEM;
} }
if (cfpkt_add_head(pkt, &flow_on, 1) < 0) { if (cfpkt_add_head(pkt, &flow_on, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", pr_err("Packet is erroneous!\n");
__func__);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -131,14 +130,12 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) ...@@ -131,14 +130,12 @@ static int cfservl_modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl)
u8 flow_off = SRVL_FLOW_OFF; u8 flow_off = SRVL_FLOW_OFF;
pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE); pkt = cfpkt_create(SRVL_CTRL_PKT_SIZE);
if (!pkt) { if (!pkt) {
pr_warning("CAIF: %s(): Out of memory\n", pr_warn("Out of memory\n");
__func__);
return -ENOMEM; return -ENOMEM;
} }
if (cfpkt_add_head(pkt, &flow_off, 1) < 0) { if (cfpkt_add_head(pkt, &flow_off, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", pr_err("Packet is erroneous!\n");
__func__);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -26,7 +28,7 @@ struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info) ...@@ -26,7 +28,7 @@ struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info)
{ {
struct cfsrvl *util = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); struct cfsrvl *util = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
if (!util) { if (!util) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfsrvl, layer) == 0); caif_assert(offsetof(struct cfsrvl, layer) == 0);
...@@ -47,7 +49,7 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -47,7 +49,7 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt)
caif_assert(layr->up->receive != NULL); caif_assert(layr->up->receive != NULL);
caif_assert(layr->up->ctrlcmd != NULL); caif_assert(layr->up->ctrlcmd != NULL);
if (cfpkt_extr_head(pkt, &cmd, 1) < 0) { if (cfpkt_extr_head(pkt, &cmd, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -64,16 +66,14 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -64,16 +66,14 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt)
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return 0; return 0;
case UTIL_REMOTE_SHUTDOWN: /* Remote Shutdown Request */ case UTIL_REMOTE_SHUTDOWN: /* Remote Shutdown Request */
pr_err("CAIF: %s(): REMOTE SHUTDOWN REQUEST RECEIVED\n", pr_err("REMOTE SHUTDOWN REQUEST RECEIVED\n");
__func__);
layr->ctrlcmd(layr, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, 0); layr->ctrlcmd(layr, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, 0);
service->open = false; service->open = false;
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return 0; return 0;
default: default:
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
pr_warning("CAIF: %s(): Unknown service control %d (0x%x)\n", pr_warn("Unknown service control %d (0x%x)\n", cmd, cmd);
__func__, cmd, cmd);
return -EPROTO; return -EPROTO;
} }
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/caif/caif_layer.h> #include <net/caif/caif_layer.h>
...@@ -25,7 +27,7 @@ struct cflayer *cfvei_create(u8 channel_id, struct dev_info *dev_info) ...@@ -25,7 +27,7 @@ struct cflayer *cfvei_create(u8 channel_id, struct dev_info *dev_info)
{ {
struct cfsrvl *vei = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); struct cfsrvl *vei = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
if (!vei) { if (!vei) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfsrvl, layer) == 0); caif_assert(offsetof(struct cfsrvl, layer) == 0);
...@@ -47,7 +49,7 @@ static int cfvei_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -47,7 +49,7 @@ static int cfvei_receive(struct cflayer *layr, struct cfpkt *pkt)
if (cfpkt_extr_head(pkt, &cmd, 1) < 0) { if (cfpkt_extr_head(pkt, &cmd, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -67,8 +69,7 @@ static int cfvei_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -67,8 +69,7 @@ static int cfvei_receive(struct cflayer *layr, struct cfpkt *pkt)
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return 0; return 0;
default: /* SET RS232 PIN */ default: /* SET RS232 PIN */
pr_warning("CAIF: %s():Unknown VEI control packet %d (0x%x)!\n", pr_warn("Unknown VEI control packet %d (0x%x)!\n", cmd, cmd);
__func__, cmd, cmd);
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
...@@ -86,7 +87,7 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt) ...@@ -86,7 +87,7 @@ static int cfvei_transmit(struct cflayer *layr, struct cfpkt *pkt)
caif_assert(layr->dn->transmit != NULL); caif_assert(layr->dn->transmit != NULL);
if (cfpkt_add_head(pkt, &tmp, 1) < 0) { if (cfpkt_add_head(pkt, &tmp, 1) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
return -EPROTO; return -EPROTO;
} }
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -21,7 +23,7 @@ struct cflayer *cfvidl_create(u8 channel_id, struct dev_info *dev_info) ...@@ -21,7 +23,7 @@ struct cflayer *cfvidl_create(u8 channel_id, struct dev_info *dev_info)
{ {
struct cfsrvl *vid = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC); struct cfsrvl *vid = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
if (!vid) { if (!vid) {
pr_warning("CAIF: %s(): Out of memory\n", __func__); pr_warn("Out of memory\n");
return NULL; return NULL;
} }
caif_assert(offsetof(struct cfsrvl, layer) == 0); caif_assert(offsetof(struct cfsrvl, layer) == 0);
...@@ -38,7 +40,7 @@ static int cfvidl_receive(struct cflayer *layr, struct cfpkt *pkt) ...@@ -38,7 +40,7 @@ static int cfvidl_receive(struct cflayer *layr, struct cfpkt *pkt)
{ {
u32 videoheader; u32 videoheader;
if (cfpkt_extr_head(pkt, &videoheader, 4) < 0) { if (cfpkt_extr_head(pkt, &videoheader, 4) < 0) {
pr_err("CAIF: %s(): Packet is erroneous!\n", __func__); pr_err("Packet is erroneous!\n");
cfpkt_destroy(pkt); cfpkt_destroy(pkt);
return -EPROTO; return -EPROTO;
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* License terms: GNU General Public License (GPL) version 2 * License terms: GNU General Public License (GPL) version 2
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/version.h> #include <linux/version.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -29,7 +31,7 @@ ...@@ -29,7 +31,7 @@
#define CAIF_NET_DEFAULT_QUEUE_LEN 500 #define CAIF_NET_DEFAULT_QUEUE_LEN 500
#undef pr_debug #undef pr_debug
#define pr_debug pr_warning #define pr_debug pr_warn
/*This list is protected by the rtnl lock. */ /*This list is protected by the rtnl lock. */
static LIST_HEAD(chnl_net_list); static LIST_HEAD(chnl_net_list);
...@@ -142,8 +144,7 @@ static void chnl_flowctrl_cb(struct cflayer *layr, enum caif_ctrlcmd flow, ...@@ -142,8 +144,7 @@ static void chnl_flowctrl_cb(struct cflayer *layr, enum caif_ctrlcmd flow,
int phyid) int phyid)
{ {
struct chnl_net *priv = container_of(layr, struct chnl_net, chnl); struct chnl_net *priv = container_of(layr, struct chnl_net, chnl);
pr_debug("CAIF: %s(): NET flowctrl func called flow: %s\n", pr_debug("NET flowctrl func called flow: %s\n",
__func__,
flow == CAIF_CTRLCMD_FLOW_ON_IND ? "ON" : flow == CAIF_CTRLCMD_FLOW_ON_IND ? "ON" :
flow == CAIF_CTRLCMD_INIT_RSP ? "INIT" : flow == CAIF_CTRLCMD_INIT_RSP ? "INIT" :
flow == CAIF_CTRLCMD_FLOW_OFF_IND ? "OFF" : flow == CAIF_CTRLCMD_FLOW_OFF_IND ? "OFF" :
...@@ -196,12 +197,12 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -196,12 +197,12 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
priv = netdev_priv(dev); priv = netdev_priv(dev);
if (skb->len > priv->netdev->mtu) { if (skb->len > priv->netdev->mtu) {
pr_warning("CAIF: %s(): Size of skb exceeded MTU\n", __func__); pr_warn("Size of skb exceeded MTU\n");
return -ENOSPC; return -ENOSPC;
} }
if (!priv->flowenabled) { if (!priv->flowenabled) {
pr_debug("CAIF: %s(): dropping packets flow off\n", __func__); pr_debug("dropping packets flow off\n");
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -237,7 +238,7 @@ static int chnl_net_open(struct net_device *dev) ...@@ -237,7 +238,7 @@ static int chnl_net_open(struct net_device *dev)
ASSERT_RTNL(); ASSERT_RTNL();
priv = netdev_priv(dev); priv = netdev_priv(dev);
if (!priv) { if (!priv) {
pr_debug("CAIF: %s(): chnl_net_open: no priv\n", __func__); pr_debug("chnl_net_open: no priv\n");
return -ENODEV; return -ENODEV;
} }
...@@ -246,18 +247,17 @@ static int chnl_net_open(struct net_device *dev) ...@@ -246,18 +247,17 @@ static int chnl_net_open(struct net_device *dev)
result = caif_connect_client(&priv->conn_req, &priv->chnl, result = caif_connect_client(&priv->conn_req, &priv->chnl,
&llifindex, &headroom, &tailroom); &llifindex, &headroom, &tailroom);
if (result != 0) { if (result != 0) {
pr_debug("CAIF: %s(): err: " pr_debug("err: "
"Unable to register and open device," "Unable to register and open device,"
" Err:%d\n", " Err:%d\n",
__func__, result);
result);
goto error; goto error;
} }
lldev = dev_get_by_index(dev_net(dev), llifindex); lldev = dev_get_by_index(dev_net(dev), llifindex);
if (lldev == NULL) { if (lldev == NULL) {
pr_debug("CAIF: %s(): no interface?\n", __func__); pr_debug("no interface?\n");
result = -ENODEV; result = -ENODEV;
goto error; goto error;
} }
...@@ -279,9 +279,7 @@ static int chnl_net_open(struct net_device *dev) ...@@ -279,9 +279,7 @@ static int chnl_net_open(struct net_device *dev)
dev_put(lldev); dev_put(lldev);
if (mtu < 100) { if (mtu < 100) {
pr_warning("CAIF: %s(): " pr_warn("CAIF Interface MTU too small (%d)\n", mtu);
"CAIF Interface MTU too small (%d)\n",
__func__, mtu);
result = -ENODEV; result = -ENODEV;
goto error; goto error;
} }
...@@ -296,33 +294,32 @@ static int chnl_net_open(struct net_device *dev) ...@@ -296,33 +294,32 @@ static int chnl_net_open(struct net_device *dev)
rtnl_lock(); rtnl_lock();
if (result == -ERESTARTSYS) { if (result == -ERESTARTSYS) {
pr_debug("CAIF: %s(): wait_event_interruptible" pr_debug("wait_event_interruptible woken by a signal\n");
" woken by a signal\n", __func__);
result = -ERESTARTSYS; result = -ERESTARTSYS;
goto error; goto error;
} }
if (result == 0) { if (result == 0) {
pr_debug("CAIF: %s(): connect timeout\n", __func__); pr_debug("connect timeout\n");
caif_disconnect_client(&priv->chnl); caif_disconnect_client(&priv->chnl);
priv->state = CAIF_DISCONNECTED; priv->state = CAIF_DISCONNECTED;
pr_debug("CAIF: %s(): state disconnected\n", __func__); pr_debug("state disconnected\n");
result = -ETIMEDOUT; result = -ETIMEDOUT;
goto error; goto error;
} }
if (priv->state != CAIF_CONNECTED) { if (priv->state != CAIF_CONNECTED) {
pr_debug("CAIF: %s(): connect failed\n", __func__); pr_debug("connect failed\n");
result = -ECONNREFUSED; result = -ECONNREFUSED;
goto error; goto error;
} }
pr_debug("CAIF: %s(): CAIF Netdevice connected\n", __func__); pr_debug("CAIF Netdevice connected\n");
return 0; return 0;
error: error:
caif_disconnect_client(&priv->chnl); caif_disconnect_client(&priv->chnl);
priv->state = CAIF_DISCONNECTED; priv->state = CAIF_DISCONNECTED;
pr_debug("CAIF: %s(): state disconnected\n", __func__); pr_debug("state disconnected\n");
return result; return result;
} }
...@@ -413,7 +410,7 @@ static void caif_netlink_parms(struct nlattr *data[], ...@@ -413,7 +410,7 @@ static void caif_netlink_parms(struct nlattr *data[],
struct caif_connect_request *conn_req) struct caif_connect_request *conn_req)
{ {
if (!data) { if (!data) {
pr_warning("CAIF: %s: no params data found\n", __func__); pr_warn("no params data found\n");
return; return;
} }
if (data[IFLA_CAIF_IPV4_CONNID]) if (data[IFLA_CAIF_IPV4_CONNID])
...@@ -442,8 +439,7 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev, ...@@ -442,8 +439,7 @@ static int ipcaif_newlink(struct net *src_net, struct net_device *dev,
ret = register_netdevice(dev); ret = register_netdevice(dev);
if (ret) if (ret)
pr_warning("CAIF: %s(): device rtml registration failed\n", pr_warn("device rtml registration failed\n");
__func__);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment