diff options
author | Erwan Bracq <erwan.bracq@stericsson.com> | 2011-04-24 00:03:32 +0200 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-05-05 07:58:57 +0200 |
commit | 46a99bcee430695bd0cd25847d9536f91ccde806 (patch) | |
tree | 59486e771f98b0ae786f8c0d0d13379665ceb97f | |
parent | 43053193d2afc98fa7db275bfffa85aed5ff425c (diff) |
CAIF: Alignment with internal CAIF development git
Code changes from internal git that will / are submitted to kernel
upstream.
- Dead code cleanup.
- Minor bug fix.
Change-Id: I15980a277ec9be98fd2404610d023c3fdd091343
Signed-off-by: Erwan Bracq <erwan.bracq@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/21535
Reviewed-by: QATEST
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r-- | include/net/caif/cfcnfg.h | 9 | ||||
-rw-r--r-- | include/net/caif/cfctrl.h | 2 | ||||
-rw-r--r-- | net/caif/Makefile | 8 | ||||
-rw-r--r-- | net/caif/caif_dev.c | 25 | ||||
-rw-r--r-- | net/caif/caif_socket.c | 3 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 2 | ||||
-rw-r--r-- | net/caif/cfctrl.c | 1 | ||||
-rw-r--r-- | net/caif/cfdgml.c | 1 | ||||
-rw-r--r-- | net/caif/cfrfml.c | 2 | ||||
-rw-r--r-- | net/caif/cfserl.c | 1 | ||||
-rw-r--r-- | net/caif/cfutill.c | 2 | ||||
-rw-r--r-- | net/caif/cfveil.c | 2 | ||||
-rw-r--r-- | net/caif/chnl_net.c | 3 |
13 files changed, 26 insertions, 35 deletions
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index 4bc81e8d81c..f688478bfb8 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h @@ -138,15 +138,6 @@ int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, enum cfcnfg_phy_preference phy_pref); -#ifdef CONFIG_CAIF_USE_DEPRECATED_FUNC -/** - * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer - * @cnfg: Configuration object - * @name: Name of the Physical Layer (Caif Link Layer) - */ -int cfcnfg_get_named(struct cfcnfg *cnfg, char *name); -#endif /*CONFIG_CAIF_USE_DEPRECATED_FUNC*/ - /** * cfcnfg_get_id_from_ifi() - Get the Physical Identifier of ifindex, * it matches caif physical id with the kernel interface id. diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index aa54e09c20d..d84416fa175 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h @@ -51,7 +51,7 @@ struct cfctrl_rsp { void (*restart_rsp)(void); void (*radioset_rsp)(void); void (*reject_rsp)(struct cflayer *layer, u8 linkid, - struct cflayer *client_layer);; + struct cflayer *client_layer); }; /* Link Setup Parameters for CAIF-Links. */ diff --git a/net/caif/Makefile b/net/caif/Makefile index f87481fb0e6..9d38e406e4a 100644 --- a/net/caif/Makefile +++ b/net/caif/Makefile @@ -1,8 +1,6 @@ -ifeq ($(CONFIG_CAIF_DEBUG),y) -EXTRA_CFLAGS += -DDEBUG -endif +ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG -caif-objs := caif_dev.o \ +caif-y := caif_dev.o \ cfcnfg.o cfmuxl.o cfctrl.o \ cffrml.o cfveil.o cfdbgl.o\ cfserl.o cfdgml.o \ @@ -13,4 +11,4 @@ obj-$(CONFIG_CAIF) += caif.o obj-$(CONFIG_CAIF_NETDEV) += chnl_net.o obj-$(CONFIG_CAIF) += caif_socket.o -export-objs := caif.o +export-y := caif.o diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 06f9394a1d2..22fdabf349c 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c @@ -121,13 +121,16 @@ static int transmit(struct cflayer *layer, struct cfpkt *pkt) struct caif_device_entry *caifd = container_of(layer, struct caif_device_entry, layer); struct sk_buff *skb; + int err; skb = cfpkt_tonative(pkt); skb->dev = caifd->netdev; - dev_queue_xmit(skb); - - return 0; + err = dev_queue_xmit(skb); + /* Failures may also be positive value. */ + if (err > 0) + err = -EIO; + return err; } static int modemcmd(struct cflayer *layr, enum caif_modemcmd ctrl) @@ -201,7 +204,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, caifd = caif_device_alloc(dev); if (caifd == NULL) break; - pr_info("register %s\n", dev->name); + pr_info("register %s:", dev->name); caifdev = netdev_priv(dev); caifdev->flowctrl = dev_flowctrl; atomic_set(&caifd->state, what); @@ -211,10 +214,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, caifd = caif_get(dev); if (caifd == NULL) break; - pr_info("up %s\n", dev->name); + pr_info("up %s:", dev->name); caifdev = netdev_priv(dev); if (atomic_read(&caifd->state) == NETDEV_UP) { - pr_info("%s already up\n", dev->name); + pr_info("already up %s:", dev->name); break; } atomic_set(&caifd->state, what); @@ -255,7 +258,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, caifd = caif_get(dev); if (caifd == NULL) break; - pr_info("going down %s\n", dev->name); + pr_info("going down %s:", dev->name); if (atomic_read(&caifd->state) == NETDEV_GOING_DOWN || atomic_read(&caifd->state) == NETDEV_DOWN) @@ -277,10 +280,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, caifd = caif_get(dev); if (caifd == NULL) break; - pr_info("down %s\n", dev->name); + pr_info("down %s:", dev->name); if (atomic_read(&caifd->in_use)) pr_warning("unregistering an active CAIF device: %s\n", - dev->name); + dev->name); cfcnfg_del_phy_layer(cfg, &caifd->layer); dev_put(dev); atomic_set(&caifd->state, what); @@ -288,7 +291,9 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, case NETDEV_UNREGISTER: caifd = caif_get(dev); - pr_info("unregister %s\n", dev->name); + if (caifd == NULL) + break; + pr_info("unregister %s:", dev->name); atomic_set(&caifd->state, what); caif_device_destroy(dev); break; diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index a514075475f..756fe425037 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c @@ -711,12 +711,12 @@ static int setsockopt(struct socket *sock, if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL) return -ENOPROTOOPT; lock_sock(&(cf_sk->sk)); - cf_sk->conn_req.param.size = ol; if (ol > sizeof(cf_sk->conn_req.param.data) || copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) { release_sock(&cf_sk->sk); return -EINVAL; } + cf_sk->conn_req.param.size = ol; release_sock(&cf_sk->sk); return 0; @@ -862,6 +862,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, cf_sk->maxframe = mtu - (headroom + tailroom); if (cf_sk->maxframe < 1) { pr_warn("CAIF Interface MTU too small (%d)\n", dev->mtu); + err = -ENODEV; goto out; } diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index b3b1fd48343..8dddde2804f 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c @@ -23,10 +23,8 @@ #include <asm/atomic.h> #define MAX_PHY_LAYERS 7 -#define PHY_NAME_LEN 20 #define container_obj(layr) container_of(layr, struct cfcnfg, layer) -#define RFM_FRAGMENT_SIZE 4030 /* Information about CAIF physical interfaces held by Config Module in order * to manage physical interfaces diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c index 976505f39a7..397a2c099e2 100644 --- a/net/caif/cfctrl.c +++ b/net/caif/cfctrl.c @@ -303,6 +303,7 @@ void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer) list_for_each_entry_safe(p, tmp, &ctrl->list, list) { if (p->client_layer == adap_layer) { + pr_debug("cancel req :%d\n", p->sequence_no); list_del(&p->list); kfree(p); } diff --git a/net/caif/cfdgml.c b/net/caif/cfdgml.c index 8177e4ec753..0382dec84fd 100644 --- a/net/caif/cfdgml.c +++ b/net/caif/cfdgml.c @@ -19,7 +19,6 @@ #define DGM_CMD_BIT 0x80 #define DGM_FLOW_OFF 0x81 #define DGM_FLOW_ON 0x80 -#define DGM_CTRL_PKT_SIZE 1 #define DGM_MTU 1500 static int cfdgml_receive(struct cflayer *layr, struct cfpkt *pkt); diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c index bbd0e2d1a09..60367feac1d 100644 --- a/net/caif/cfrfml.c +++ b/net/caif/cfrfml.c @@ -9,7 +9,7 @@ #include <linux/stddef.h> #include <linux/spinlock.h> #include <linux/slab.h> -#include <linux/unaligned/le_byteshift.h> +#include <asm/unaligned.h> #include <net/caif/caif_layer.h> #include <net/caif/cfsrvl.h> #include <net/caif/cfpkt.h> diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c index 48910afb6e2..2715c84cfa8 100644 --- a/net/caif/cfserl.c +++ b/net/caif/cfserl.c @@ -25,7 +25,6 @@ struct cfserl { spinlock_t sync; bool usestx; }; -#define STXLEN(layr) (layr->usestx ? 1 : 0) static int cfserl_receive(struct cflayer *layr, struct cfpkt *pkt); static int cfserl_transmit(struct cflayer *layr, struct cfpkt *pkt); diff --git a/net/caif/cfutill.c b/net/caif/cfutill.c index d1aa471136e..98e027db18e 100644 --- a/net/caif/cfutill.c +++ b/net/caif/cfutill.c @@ -20,7 +20,7 @@ #define UTIL_REMOTE_SHUTDOWN 0x82 #define UTIL_FLOW_OFF 0x81 #define UTIL_FLOW_ON 0x80 -#define UTIL_CTRL_PKT_SIZE 1 + static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt); static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt); diff --git a/net/caif/cfveil.c b/net/caif/cfveil.c index e20bf1525cf..1a588cd818e 100644 --- a/net/caif/cfveil.c +++ b/net/caif/cfveil.c @@ -17,7 +17,7 @@ #define VEI_FLOW_OFF 0x81 #define VEI_FLOW_ON 0x80 #define VEI_SET_PIN 0x82 -#define VEI_CTRL_PKT_SIZE 1 + #define container_obj(layr) container_of(layr, struct cfsrvl, layer) static int cfvei_receive(struct cflayer *layr, struct cfpkt *pkt); diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 22f6b53b84e..6008d6dc18a 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c @@ -387,13 +387,12 @@ static void ipcaif_net_setup(struct net_device *dev) priv->chnl.receive = chnl_recv_cb; priv->chnl.ctrlcmd = chnl_flowctrl_cb; priv->netdev = dev; - priv->flowenabled = false; - //default config for net devices priv->conn_req.protocol = CAIFPROTO_DATAGRAM; priv->conn_req.link_selector = CAIF_LINK_HIGH_BANDW; priv->conn_req.priority = CAIF_PRIO_LOW; /* Insert illegal value */ priv->conn_req.sockaddr.u.dgm.connection_id = -1; + priv->flowenabled = false; init_waitqueue_head(&priv->netmgmt_wq); } |