Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214332
b: refs/heads/master
c: b31fa5b
h: refs/heads/master
v: v3
  • Loading branch information
Joe Perches authored and David S. Miller committed Sep 7, 2010
1 parent 9688f5e commit 08ab112
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 182 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0ece28539d49c9bdcc6da0bbb26771dceb57581
refs/heads/master: b31fa5bad576cd8180a5ad70c648333b44320d44
22 changes: 11 additions & 11 deletions trunk/net/caif/caif_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* and Sakari Ailus <sakari.ailus@nokia.com>
*/

#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__

#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -214,7 +216,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,

switch (what) {
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);
if (caifd == NULL)
break;
Expand All @@ -225,14 +227,13 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
break;

case NETDEV_UP:
pr_info("CAIF: %s(): up %s\n", __func__, dev->name);
pr_info("up %s\n", dev->name);
caifd = caif_get(dev);
if (caifd == NULL)
break;
caifdev = netdev_priv(dev);
if (atomic_read(&caifd->state) == NETDEV_UP) {
pr_info("CAIF: %s():%s already up\n",
__func__, dev->name);
pr_info("%s already up\n", dev->name);
break;
}
atomic_set(&caifd->state, what);
Expand Down Expand Up @@ -273,7 +274,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
caifd = caif_get(dev);
if (caifd == NULL)
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 ||
atomic_read(&caifd->state) == NETDEV_DOWN)
Expand All @@ -295,19 +296,18 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
caifd = caif_get(dev);
if (caifd == NULL)
break;
pr_info("CAIF: %s(): down %s\n", __func__, dev->name);
pr_info("down %s\n", dev->name);
if (atomic_read(&caifd->in_use))
pr_warning("CAIF: %s(): "
"Unregistering an active CAIF device: %s\n",
__func__, dev->name);
pr_warn("Unregistering an active CAIF device: %s\n",
dev->name);
cfcnfg_del_phy_layer(get_caif_conf(), &caifd->layer);
dev_put(dev);
atomic_set(&caifd->state, what);
break;

case NETDEV_UNREGISTER:
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);
caif_device_destroy(dev);
break;
Expand Down Expand Up @@ -391,7 +391,7 @@ static int __init caif_device_init(void)
int result;
cfg = cfcnfg_create();
if (!cfg) {
pr_warning("CAIF: %s(): can't create cfcnfg.\n", __func__);
pr_warn("can't create cfcnfg\n");
goto err_cfcnfg_create_failed;
}
result = register_pernet_device(&caif_net_ops);
Expand Down
19 changes: 9 additions & 10 deletions trunk/net/caif/caif_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* License terms: GNU General Public License (GPL) version 2
*/

#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__

#include <linux/fs.h>
#include <linux/init.h>
#include <linux/module.h>
Expand Down Expand Up @@ -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 >=
(unsigned)sk->sk_rcvbuf && rx_flow_is_on(cf_sk)) {
trace_printk("CAIF: %s():"
" sending flow OFF (queue len = %d %d)\n",
trace_printk("CAIF: %s(): "
"sending flow OFF (queue len = %d %d)\n",
__func__,
atomic_read(&cf_sk->sk.sk_rmem_alloc),
sk_rcvbuf_lowwater(cf_sk));
Expand All @@ -172,8 +174,8 @@ static int caif_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
return err;
if (!sk_rmem_schedule(sk, skb->truesize) && rx_flow_is_on(cf_sk)) {
set_rx_flow_off(cf_sk);
trace_printk("CAIF: %s():"
" sending flow OFF due to rmem_schedule\n",
trace_printk("CAIF: %s(): "
"sending flow OFF due to rmem_schedule\n",
__func__);
dbfs_atomic_inc(&cnt.num_rx_flow_off);
caif_flow_ctrl(sk, CAIF_MODEMCMD_FLOW_OFF_REQ);
Expand Down Expand Up @@ -275,8 +277,7 @@ static void caif_ctrl_cb(struct cflayer *layr,
break;

default:
pr_debug("CAIF: %s(): Unexpected flow command %d\n",
__func__, flow);
pr_debug("Unexpected flow command %d\n", flow);
}
}

Expand Down Expand Up @@ -536,8 +537,7 @@ static int transmit_skb(struct sk_buff *skb, struct caifsock *cf_sk,

/* Slight paranoia, probably not needed. */
if (unlikely(loopcnt++ > 1000)) {
pr_warning("CAIF: %s(): transmit retries failed,"
" error = %d\n", __func__, ret);
pr_warn("transmit retries failed, error = %d\n", ret);
break;
}

Expand Down Expand Up @@ -902,8 +902,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
cf_sk->maxframe = dev->mtu - (headroom + tailroom);
dev_put(dev);
if (cf_sk->maxframe < 1) {
pr_warning("CAIF: %s(): CAIF Interface MTU too small (%d)\n",
__func__, dev->mtu);
pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu);
err = -ENODEV;
goto out;
}
Expand Down
49 changes: 21 additions & 28 deletions trunk/net/caif/cfcnfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Author: Sjur Brendeland/sjur.brandeland@stericsson.com
* License terms: GNU General Public License (GPL) version 2
*/

#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__

#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -78,7 +81,7 @@ struct cfcnfg *cfcnfg_create(void)
/* Initiate this layer */
this = kzalloc(sizeof(struct cfcnfg), GFP_ATOMIC);
if (!this) {
pr_warning("CAIF: %s(): Out of memory\n", __func__);
pr_warn("Out of memory\n");
return NULL;
}
this->mux = cfmuxl_create();
Expand Down Expand Up @@ -106,7 +109,7 @@ struct cfcnfg *cfcnfg_create(void)
layer_set_up(this->ctrl, this);
return this;
out_of_mem:
pr_warning("CAIF: %s(): Out of memory\n", __func__);
pr_warn("Out of memory\n");
kfree(this->mux);
kfree(this->ctrl);
kfree(this);
Expand Down Expand Up @@ -194,7 +197,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
caif_assert(adap_layer != NULL);
channel_id = adap_layer->id;
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;
goto end;
}
Expand All @@ -204,9 +207,8 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
layer_set_up(servl, NULL);
ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
if (servl == NULL) {
pr_err("CAIF: %s(): PROTOCOL ERROR "
"- Error removing service_layer Channel_Id(%d)",
__func__, channel_id);
pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)",
channel_id);
ret = -EINVAL;
goto end;
}
Expand All @@ -216,18 +218,14 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)

phyinfo = cfcnfg_get_phyinfo(cnfg, phyid);
if (phyinfo == NULL) {
pr_warning("CAIF: %s(): "
"No interface to send disconnect to\n",
__func__);
pr_warn("No interface to send disconnect to\n");
ret = -ENODEV;
goto end;
}
if (phyinfo->id != phyid ||
phyinfo->phy_layer->id != phyid ||
phyinfo->frm_layer->id != phyid) {
pr_err("CAIF: %s(): "
"Inconsistency in phy registration\n",
__func__);
pr_err("Inconsistency in phy registration\n");
ret = -EINVAL;
goto end;
}
Expand Down Expand Up @@ -276,21 +274,20 @@ int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
{
struct cflayer *frml;
if (adap_layer == NULL) {
pr_err("CAIF: %s(): adap_layer is zero", __func__);
pr_err("adap_layer is zero\n");
return -EINVAL;
}
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;
}
if (adap_layer->ctrlcmd == NULL) {
pr_err("CAIF: %s(): adap_layer->ctrlcmd == NULL", __func__);
pr_err("adap_layer->ctrlcmd == NULL\n");
return -EINVAL;
}
frml = cnfg->phy_layers[param->phyid].frm_layer;
if (frml == NULL) {
pr_err("CAIF: %s(): Specified PHY type does not exist!",
__func__);
pr_err("Specified PHY type does not exist!\n");
return -ENODEV;
}
caif_assert(param->phyid == cnfg->phy_layers[param->phyid].id);
Expand Down Expand Up @@ -330,9 +327,7 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
struct net_device *netdev;

if (adapt_layer == NULL) {
pr_debug("CAIF: %s(): link setup response "
"but no client exist, send linkdown back\n",
__func__);
pr_debug("link setup response but no client exist, send linkdown back\n");
cfctrl_linkdown_req(cnfg->ctrl, channel_id, NULL);
return;
}
Expand Down Expand Up @@ -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);
break;
default:
pr_err("CAIF: %s(): Protocol error. "
"Link setup response - unknown channel type\n",
__func__);
pr_err("Protocol error. Link setup response - unknown channel type\n");
return;
}
if (!servicel) {
pr_warning("CAIF: %s(): Out of memory\n", __func__);
pr_warn("Out of memory\n");
return;
}
layer_set_dn(servicel, cnfg->mux);
Expand Down Expand Up @@ -418,7 +411,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
}
}
if (*phyid == 0) {
pr_err("CAIF: %s(): No Available PHY ID\n", __func__);
pr_err("No Available PHY ID\n");
return;
}

Expand All @@ -427,7 +420,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_driver =
cfserl_create(CFPHYTYPE_FRAG, *phyid, stx);
if (!phy_driver) {
pr_warning("CAIF: %s(): Out of memory\n", __func__);
pr_warn("Out of memory\n");
return;
}

Expand All @@ -436,7 +429,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_driver = NULL;
break;
default:
pr_err("CAIF: %s(): %d", __func__, phy_type);
pr_err("%d\n", phy_type);
return;
break;
}
Expand All @@ -455,7 +448,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
phy_layer->type = phy_type;
frml = cffrml_create(*phyid, fcs);
if (!frml) {
pr_warning("CAIF: %s(): Out of memory\n", __func__);
pr_warn("Out of memory\n");
return;
}
cnfg->phy_layers[*phyid].frm_layer = frml;
Expand Down
Loading

0 comments on commit 08ab112

Please sign in to comment.