Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327479
b: refs/heads/master
c: 8c8de58
h: refs/heads/master
i:
  327477: c8f9191
  327475: 61f0ac5
  327471: e628a9e
v: v3
  • Loading branch information
Masatake YAMATO authored and Gustavo Padovan committed Aug 6, 2012
1 parent ba76000 commit 8a2d1d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 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: 77cf5585a31fdad48c16ddae9be154f5afe22c1c
refs/heads/master: 8c8de589cedd375934d96e073d2b9077a00f10c2
23 changes: 21 additions & 2 deletions trunk/net/bluetooth/cmtp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@

#include "cmtp.h"

static struct bt_sock_list cmtp_sk_list = {
.lock = __RW_LOCK_UNLOCKED(cmtp_sk_list.lock)
};

static int cmtp_sock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
Expand All @@ -51,6 +55,8 @@ static int cmtp_sock_release(struct socket *sock)
if (!sk)
return 0;

bt_sock_unlink(&cmtp_sk_list, sk);

sock_orphan(sk);
sock_put(sk);

Expand Down Expand Up @@ -214,6 +220,8 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
sk->sk_protocol = protocol;
sk->sk_state = BT_OPEN;

bt_sock_link(&cmtp_sk_list, sk);

return 0;
}

Expand All @@ -232,19 +240,30 @@ int cmtp_init_sockets(void)
return err;

err = bt_sock_register(BTPROTO_CMTP, &cmtp_sock_family_ops);
if (err < 0)
if (err < 0) {
BT_ERR("Can't register CMTP socket");
goto error;
}

err = bt_procfs_init(THIS_MODULE, &init_net, "cmtp", &cmtp_sk_list, NULL);
if (err < 0) {
BT_ERR("Failed to create CMTP proc file");
bt_sock_unregister(BTPROTO_HIDP);
goto error;
}

BT_INFO("CMTP socket layer initialized");

return 0;

error:
BT_ERR("Can't register CMTP socket");
proto_unregister(&cmtp_proto);
return err;
}

void cmtp_cleanup_sockets(void)
{
bt_procfs_cleanup(&init_net, "cmtp");
if (bt_sock_unregister(BTPROTO_CMTP) < 0)
BT_ERR("Can't unregister CMTP socket");

Expand Down

0 comments on commit 8a2d1d8

Please sign in to comment.