diff options
author | David S. Miller <davem@davemloft.net> | 2012-02-04 16:39:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-04 16:39:32 -0500 |
commit | dd48dc34fe7639a8b2e22d8b609672f5f81aa7cb (patch) | |
tree | f16ace0ae09edab16bf6d0be9e8280dfbb7100da /net/caif | |
parent | 8d9eb069eafce49307f839783e4a4673414b1fd5 (diff) | |
parent | 5962b35c1de3254a2f03b95efd3b7854b874d7b7 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/caif')
-rw-r--r-- | net/caif/caif_dev.c | 22 | ||||
-rw-r--r-- | net/caif/caif_socket.c | 10 | ||||
-rw-r--r-- | net/caif/cfcnfg.c | 1 | ||||
-rw-r--r-- | net/caif/cfmuxl.c | 12 |
4 files changed, 11 insertions, 34 deletions
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 673728add60b..82c57069415f 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -59,8 +59,6 @@ struct cfcnfg *get_cfcnfg(struct net *net) | |||
59 | { | 59 | { |
60 | struct caif_net *caifn; | 60 | struct caif_net *caifn; |
61 | caifn = net_generic(net, caif_net_id); | 61 | caifn = net_generic(net, caif_net_id); |
62 | if (!caifn) | ||
63 | return NULL; | ||
64 | return caifn->cfg; | 62 | return caifn->cfg; |
65 | } | 63 | } |
66 | EXPORT_SYMBOL(get_cfcnfg); | 64 | EXPORT_SYMBOL(get_cfcnfg); |
@@ -69,8 +67,6 @@ static struct caif_device_entry_list *caif_device_list(struct net *net) | |||
69 | { | 67 | { |
70 | struct caif_net *caifn; | 68 | struct caif_net *caifn; |
71 | caifn = net_generic(net, caif_net_id); | 69 | caifn = net_generic(net, caif_net_id); |
72 | if (!caifn) | ||
73 | return NULL; | ||
74 | return &caifn->caifdevs; | 70 | return &caifn->caifdevs; |
75 | } | 71 | } |
76 | 72 | ||
@@ -99,8 +95,6 @@ static struct caif_device_entry *caif_device_alloc(struct net_device *dev) | |||
99 | struct caif_device_entry *caifd; | 95 | struct caif_device_entry *caifd; |
100 | 96 | ||
101 | caifdevs = caif_device_list(dev_net(dev)); | 97 | caifdevs = caif_device_list(dev_net(dev)); |
102 | if (!caifdevs) | ||
103 | return NULL; | ||
104 | 98 | ||
105 | caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); | 99 | caifd = kzalloc(sizeof(*caifd), GFP_KERNEL); |
106 | if (!caifd) | 100 | if (!caifd) |
@@ -120,8 +114,6 @@ static struct caif_device_entry *caif_get(struct net_device *dev) | |||
120 | struct caif_device_entry_list *caifdevs = | 114 | struct caif_device_entry_list *caifdevs = |
121 | caif_device_list(dev_net(dev)); | 115 | caif_device_list(dev_net(dev)); |
122 | struct caif_device_entry *caifd; | 116 | struct caif_device_entry *caifd; |
123 | if (!caifdevs) | ||
124 | return NULL; | ||
125 | 117 | ||
126 | list_for_each_entry_rcu(caifd, &caifdevs->list, list) { | 118 | list_for_each_entry_rcu(caifd, &caifdevs->list, list) { |
127 | if (caifd->netdev == dev) | 119 | if (caifd->netdev == dev) |
@@ -321,8 +313,6 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, | |||
321 | struct caif_device_entry_list *caifdevs; | 313 | struct caif_device_entry_list *caifdevs; |
322 | 314 | ||
323 | caifdevs = caif_device_list(dev_net(dev)); | 315 | caifdevs = caif_device_list(dev_net(dev)); |
324 | if (!cfg || !caifdevs) | ||
325 | return; | ||
326 | caifd = caif_device_alloc(dev); | 316 | caifd = caif_device_alloc(dev); |
327 | if (!caifd) | 317 | if (!caifd) |
328 | return; | 318 | return; |
@@ -374,8 +364,6 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, | |||
374 | 364 | ||
375 | cfg = get_cfcnfg(dev_net(dev)); | 365 | cfg = get_cfcnfg(dev_net(dev)); |
376 | caifdevs = caif_device_list(dev_net(dev)); | 366 | caifdevs = caif_device_list(dev_net(dev)); |
377 | if (!cfg || !caifdevs) | ||
378 | return 0; | ||
379 | 367 | ||
380 | caifd = caif_get(dev); | 368 | caifd = caif_get(dev); |
381 | if (caifd == NULL && dev->type != ARPHRD_CAIF) | 369 | if (caifd == NULL && dev->type != ARPHRD_CAIF) |
@@ -507,9 +495,6 @@ static struct notifier_block caif_device_notifier = { | |||
507 | static int caif_init_net(struct net *net) | 495 | static int caif_init_net(struct net *net) |
508 | { | 496 | { |
509 | struct caif_net *caifn = net_generic(net, caif_net_id); | 497 | struct caif_net *caifn = net_generic(net, caif_net_id); |
510 | if (WARN_ON(!caifn)) | ||
511 | return -EINVAL; | ||
512 | |||
513 | INIT_LIST_HEAD(&caifn->caifdevs.list); | 498 | INIT_LIST_HEAD(&caifn->caifdevs.list); |
514 | mutex_init(&caifn->caifdevs.lock); | 499 | mutex_init(&caifn->caifdevs.lock); |
515 | 500 | ||
@@ -527,9 +512,6 @@ static void caif_exit_net(struct net *net) | |||
527 | caif_device_list(net); | 512 | caif_device_list(net); |
528 | struct cfcnfg *cfg = get_cfcnfg(net); | 513 | struct cfcnfg *cfg = get_cfcnfg(net); |
529 | 514 | ||
530 | if (!cfg || !caifdevs) | ||
531 | return; | ||
532 | |||
533 | rtnl_lock(); | 515 | rtnl_lock(); |
534 | mutex_lock(&caifdevs->lock); | 516 | mutex_lock(&caifdevs->lock); |
535 | 517 | ||
@@ -569,7 +551,7 @@ static int __init caif_device_init(void) | |||
569 | { | 551 | { |
570 | int result; | 552 | int result; |
571 | 553 | ||
572 | result = register_pernet_device(&caif_net_ops); | 554 | result = register_pernet_subsys(&caif_net_ops); |
573 | 555 | ||
574 | if (result) | 556 | if (result) |
575 | return result; | 557 | return result; |
@@ -582,7 +564,7 @@ static int __init caif_device_init(void) | |||
582 | 564 | ||
583 | static void __exit caif_device_exit(void) | 565 | static void __exit caif_device_exit(void) |
584 | { | 566 | { |
585 | unregister_pernet_device(&caif_net_ops); | 567 | unregister_pernet_subsys(&caif_net_ops); |
586 | unregister_netdevice_notifier(&caif_device_notifier); | 568 | unregister_netdevice_notifier(&caif_device_notifier); |
587 | dev_remove_pack(&caif_packet_type); | 569 | dev_remove_pack(&caif_packet_type); |
588 | } | 570 | } |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 0d1131864630..5016fa57b623 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -506,8 +506,10 @@ static int transmit_skb(struct sk_buff *skb, struct caifsock *cf_sk, | |||
506 | pkt = cfpkt_fromnative(CAIF_DIR_OUT, skb); | 506 | pkt = cfpkt_fromnative(CAIF_DIR_OUT, skb); |
507 | memset(skb->cb, 0, sizeof(struct caif_payload_info)); | 507 | memset(skb->cb, 0, sizeof(struct caif_payload_info)); |
508 | 508 | ||
509 | if (cf_sk->layer.dn == NULL) | 509 | if (cf_sk->layer.dn == NULL) { |
510 | kfree_skb(skb); | ||
510 | return -EINVAL; | 511 | return -EINVAL; |
512 | } | ||
511 | 513 | ||
512 | return cf_sk->layer.dn->transmit(cf_sk->layer.dn, pkt); | 514 | return cf_sk->layer.dn->transmit(cf_sk->layer.dn, pkt); |
513 | } | 515 | } |
@@ -650,10 +652,10 @@ static int caif_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
650 | } | 652 | } |
651 | err = transmit_skb(skb, cf_sk, | 653 | err = transmit_skb(skb, cf_sk, |
652 | msg->msg_flags&MSG_DONTWAIT, timeo); | 654 | msg->msg_flags&MSG_DONTWAIT, timeo); |
653 | if (err < 0) { | 655 | if (err < 0) |
654 | kfree_skb(skb); | 656 | /* skb is already freed */ |
655 | goto pipe_err; | 657 | goto pipe_err; |
656 | } | 658 | |
657 | sent += size; | 659 | sent += size; |
658 | } | 660 | } |
659 | 661 | ||
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 598aafb4cb51..ba9cfd47778a 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -309,7 +309,6 @@ int caif_connect_client(struct net *net, struct caif_connect_request *conn_req, | |||
309 | int err; | 309 | int err; |
310 | struct cfctrl_link_param param; | 310 | struct cfctrl_link_param param; |
311 | struct cfcnfg *cfg = get_cfcnfg(net); | 311 | struct cfcnfg *cfg = get_cfcnfg(net); |
312 | caif_assert(cfg != NULL); | ||
313 | 312 | ||
314 | rcu_read_lock(); | 313 | rcu_read_lock(); |
315 | err = caif_connect_req_to_link_param(cfg, conn_req, ¶m); | 314 | err = caif_connect_req_to_link_param(cfg, conn_req, ¶m); |
diff --git a/net/caif/cfmuxl.c b/net/caif/cfmuxl.c index b36f24a4c8e7..94b08612a4d8 100644 --- a/net/caif/cfmuxl.c +++ b/net/caif/cfmuxl.c | |||
@@ -248,7 +248,6 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
248 | { | 248 | { |
249 | struct cfmuxl *muxl = container_obj(layr); | 249 | struct cfmuxl *muxl = container_obj(layr); |
250 | struct cflayer *layer; | 250 | struct cflayer *layer; |
251 | int idx; | ||
252 | 251 | ||
253 | rcu_read_lock(); | 252 | rcu_read_lock(); |
254 | list_for_each_entry_rcu(layer, &muxl->srvl_list, node) { | 253 | list_for_each_entry_rcu(layer, &muxl->srvl_list, node) { |
@@ -257,14 +256,9 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | |||
257 | 256 | ||
258 | if ((ctrl == _CAIF_CTRLCMD_PHYIF_DOWN_IND || | 257 | if ((ctrl == _CAIF_CTRLCMD_PHYIF_DOWN_IND || |
259 | ctrl == CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND) && | 258 | ctrl == CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND) && |
260 | layer->id != 0) { | 259 | layer->id != 0) |
261 | 260 | cfmuxl_remove_uplayer(layr, layer->id); | |
262 | idx = layer->id % UP_CACHE_SIZE; | 261 | |
263 | spin_lock_bh(&muxl->receive_lock); | ||
264 | RCU_INIT_POINTER(muxl->up_cache[idx], NULL); | ||
265 | list_del_rcu(&layer->node); | ||
266 | spin_unlock_bh(&muxl->receive_lock); | ||
267 | } | ||
268 | /* NOTE: ctrlcmd is not allowed to block */ | 262 | /* NOTE: ctrlcmd is not allowed to block */ |
269 | layer->ctrlcmd(layer, ctrl, phyid); | 263 | layer->ctrlcmd(layer, ctrl, phyid); |
270 | } | 264 | } |