Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327481
b: refs/heads/master
c: 5c6ad8e
h: refs/heads/master
i:
  327479: 8a2d1d8
v: v3
  • Loading branch information
Masatake YAMATO authored and Gustavo Padovan committed Aug 6, 2012
1 parent ee03052 commit 9a919b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 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: f7c8663789038c4bc71b81e3c858a35c999347a8
refs/heads/master: 5c6ad8eee0a8c5fb4ba8b741008490da9eb66af6
22 changes: 21 additions & 1 deletion trunk/net/bluetooth/hidp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

#include "hidp.h"

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

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

bt_sock_unlink(&hidp_sk_list, sk);

sock_orphan(sk);
sock_put(sk);

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

bt_sock_link(&hidp_sk_list, sk);

return 0;
}

Expand All @@ -271,8 +279,19 @@ int __init hidp_init_sockets(void)
return err;

err = bt_sock_register(BTPROTO_HIDP, &hidp_sock_family_ops);
if (err < 0)
if (err < 0) {
BT_ERR("Can't register HIDP socket");
goto error;
}

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

BT_INFO("HIDP socket layer initialized");

return 0;

Expand All @@ -284,6 +303,7 @@ int __init hidp_init_sockets(void)

void __exit hidp_cleanup_sockets(void)
{
bt_procfs_cleanup(&init_net, "hidp");
if (bt_sock_unregister(BTPROTO_HIDP) < 0)
BT_ERR("Can't unregister HIDP socket");

Expand Down

0 comments on commit 9a919b1

Please sign in to comment.