aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-05-04 18:36:06 -0400
committerMarcel Holtmann <marcel@holtmann.org>2007-05-04 18:36:06 -0400
commit48db9ca4f2ac9f39eb90ccb12ad3ca7b645a552c (patch)
tree5e821efe2a51e60d0c195ee87b5782a36bcad15a /net/bluetooth
parent53c1d4b0b22243c093ded25aaa01c8ff8ab6e6b3 (diff)
[Bluetooth] Use in-kernel sockets API
The kernel provides a new convenient way to access the sockets API for in-kernel users. It is a good idea to actually use it. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/rfcomm/core.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index fe7df90eb707..71a72fcb2b54 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -622,7 +622,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
622 bacpy(&addr.l2_bdaddr, src); 622 bacpy(&addr.l2_bdaddr, src);
623 addr.l2_family = AF_BLUETOOTH; 623 addr.l2_family = AF_BLUETOOTH;
624 addr.l2_psm = 0; 624 addr.l2_psm = 0;
625 *err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr)); 625 *err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
626 if (*err < 0) 626 if (*err < 0)
627 goto failed; 627 goto failed;
628 628
@@ -643,7 +643,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
643 bacpy(&addr.l2_bdaddr, dst); 643 bacpy(&addr.l2_bdaddr, dst);
644 addr.l2_family = AF_BLUETOOTH; 644 addr.l2_family = AF_BLUETOOTH;
645 addr.l2_psm = htobs(RFCOMM_PSM); 645 addr.l2_psm = htobs(RFCOMM_PSM);
646 *err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); 646 *err = kernel_connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK);
647 if (*err == 0 || *err == -EINPROGRESS) 647 if (*err == 0 || *err == -EINPROGRESS)
648 return s; 648 return s;
649 649
@@ -1757,19 +1757,12 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s)
1757 1757
1758 BT_DBG("session %p", s); 1758 BT_DBG("session %p", s);
1759 1759
1760 if (sock_create_lite(PF_BLUETOOTH, sock->type, BTPROTO_L2CAP, &nsock)) 1760 err = kernel_accept(sock, &nsock, O_NONBLOCK);
1761 if (err < 0)
1761 return; 1762 return;
1762 1763
1763 nsock->ops = sock->ops;
1764
1765 __module_get(nsock->ops->owner); 1764 __module_get(nsock->ops->owner);
1766 1765
1767 err = sock->ops->accept(sock, nsock, O_NONBLOCK);
1768 if (err < 0) {
1769 sock_release(nsock);
1770 return;
1771 }
1772
1773 /* Set our callbacks */ 1766 /* Set our callbacks */
1774 nsock->sk->sk_data_ready = rfcomm_l2data_ready; 1767 nsock->sk->sk_data_ready = rfcomm_l2data_ready;
1775 nsock->sk->sk_state_change = rfcomm_l2state_change; 1768 nsock->sk->sk_state_change = rfcomm_l2state_change;
@@ -1885,7 +1878,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
1885 bacpy(&addr.l2_bdaddr, ba); 1878 bacpy(&addr.l2_bdaddr, ba);
1886 addr.l2_family = AF_BLUETOOTH; 1879 addr.l2_family = AF_BLUETOOTH;
1887 addr.l2_psm = htobs(RFCOMM_PSM); 1880 addr.l2_psm = htobs(RFCOMM_PSM);
1888 err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr)); 1881 err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
1889 if (err < 0) { 1882 if (err < 0) {
1890 BT_ERR("Bind failed %d", err); 1883 BT_ERR("Bind failed %d", err);
1891 goto failed; 1884 goto failed;
@@ -1898,7 +1891,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
1898 release_sock(sk); 1891 release_sock(sk);
1899 1892
1900 /* Start listening on the socket */ 1893 /* Start listening on the socket */
1901 err = sock->ops->listen(sock, 10); 1894 err = kernel_listen(sock, 10);
1902 if (err) { 1895 if (err) {
1903 BT_ERR("Listen failed %d", err); 1896 BT_ERR("Listen failed %d", err);
1904 goto failed; 1897 goto failed;