aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r--net/bluetooth/rfcomm/core.c56
-rw-r--r--net/bluetooth/rfcomm/sock.c20
-rw-r--r--net/bluetooth/rfcomm/tty.c46
3 files changed, 61 insertions, 61 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 278c8676906a..94f457360560 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1,4 +1,4 @@
1/* 1/*
2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@@ -11,13 +11,13 @@
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
@@ -134,7 +134,7 @@ static inline void rfcomm_session_put(struct rfcomm_session *s)
134/* ---- RFCOMM FCS computation ---- */ 134/* ---- RFCOMM FCS computation ---- */
135 135
136/* reversed, 8-bit, poly=0x07 */ 136/* reversed, 8-bit, poly=0x07 */
137static unsigned char rfcomm_crc_table[256] = { 137static unsigned char rfcomm_crc_table[256] = {
138 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, 138 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
139 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, 139 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
140 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, 140 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
@@ -179,13 +179,13 @@ static unsigned char rfcomm_crc_table[256] = {
179/* CRC on 2 bytes */ 179/* CRC on 2 bytes */
180#define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]]) 180#define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]])
181 181
182/* FCS on 2 bytes */ 182/* FCS on 2 bytes */
183static inline u8 __fcs(u8 *data) 183static inline u8 __fcs(u8 *data)
184{ 184{
185 return (0xff - __crc(data)); 185 return (0xff - __crc(data));
186} 186}
187 187
188/* FCS on 3 bytes */ 188/* FCS on 3 bytes */
189static inline u8 __fcs2(u8 *data) 189static inline u8 __fcs2(u8 *data)
190{ 190{
191 return (0xff - rfcomm_crc_table[__crc(data) ^ data[2]]); 191 return (0xff - rfcomm_crc_table[__crc(data) ^ data[2]]);
@@ -288,7 +288,7 @@ struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
288 atomic_set(&d->refcnt, 1); 288 atomic_set(&d->refcnt, 1);
289 289
290 rfcomm_dlc_clear_state(d); 290 rfcomm_dlc_clear_state(d);
291 291
292 BT_DBG("%p", d); 292 BT_DBG("%p", d);
293 293
294 return d; 294 return d;
@@ -345,7 +345,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
345 int err = 0; 345 int err = 0;
346 u8 dlci; 346 u8 dlci;
347 347
348 BT_DBG("dlc %p state %ld %s %s channel %d", 348 BT_DBG("dlc %p state %ld %s %s channel %d",
349 d, d->state, batostr(src), batostr(dst), channel); 349 d, d->state, batostr(src), batostr(dst), channel);
350 350
351 if (channel < 1 || channel > 30) 351 if (channel < 1 || channel > 30)
@@ -489,21 +489,21 @@ void fastcall __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
489 rfcomm_schedule(RFCOMM_SCHED_TX); 489 rfcomm_schedule(RFCOMM_SCHED_TX);
490} 490}
491 491
492/* 492/*
493 Set/get modem status functions use _local_ status i.e. what we report 493 Set/get modem status functions use _local_ status i.e. what we report
494 to the other side. 494 to the other side.
495 Remote status is provided by dlc->modem_status() callback. 495 Remote status is provided by dlc->modem_status() callback.
496 */ 496 */
497int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig) 497int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig)
498{ 498{
499 BT_DBG("dlc %p state %ld v24_sig 0x%x", 499 BT_DBG("dlc %p state %ld v24_sig 0x%x",
500 d, d->state, v24_sig); 500 d, d->state, v24_sig);
501 501
502 if (test_bit(RFCOMM_RX_THROTTLED, &d->flags)) 502 if (test_bit(RFCOMM_RX_THROTTLED, &d->flags))
503 v24_sig |= RFCOMM_V24_FC; 503 v24_sig |= RFCOMM_V24_FC;
504 else 504 else
505 v24_sig &= ~RFCOMM_V24_FC; 505 v24_sig &= ~RFCOMM_V24_FC;
506 506
507 d->v24_sig = v24_sig; 507 d->v24_sig = v24_sig;
508 508
509 if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags)) 509 if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags))
@@ -514,7 +514,7 @@ int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig)
514 514
515int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig) 515int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig)
516{ 516{
517 BT_DBG("dlc %p state %ld v24_sig 0x%x", 517 BT_DBG("dlc %p state %ld v24_sig 0x%x",
518 d, d->state, d->v24_sig); 518 d, d->state, d->v24_sig);
519 519
520 *v24_sig = d->v24_sig; 520 *v24_sig = d->v24_sig;
@@ -576,7 +576,7 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
576 struct bt_sock *sk; 576 struct bt_sock *sk;
577 list_for_each_safe(p, n, &session_list) { 577 list_for_each_safe(p, n, &session_list) {
578 s = list_entry(p, struct rfcomm_session, list); 578 s = list_entry(p, struct rfcomm_session, list);
579 sk = bt_sk(s->sock->sk); 579 sk = bt_sk(s->sock->sk);
580 580
581 if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) && 581 if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) &&
582 !bacmp(&sk->dst, dst)) 582 !bacmp(&sk->dst, dst))
@@ -825,7 +825,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d
825 825
826int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, 826int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
827 u8 bit_rate, u8 data_bits, u8 stop_bits, 827 u8 bit_rate, u8 data_bits, u8 stop_bits,
828 u8 parity, u8 flow_ctrl_settings, 828 u8 parity, u8 flow_ctrl_settings,
829 u8 xon_char, u8 xoff_char, u16 param_mask) 829 u8 xon_char, u8 xoff_char, u16 param_mask)
830{ 830{
831 struct rfcomm_hdr *hdr; 831 struct rfcomm_hdr *hdr;
@@ -834,8 +834,8 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
834 u8 buf[16], *ptr = buf; 834 u8 buf[16], *ptr = buf;
835 835
836 BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x" 836 BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x"
837 " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", 837 " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x",
838 s, cr, dlci, bit_rate, data_bits, stop_bits, parity, 838 s, cr, dlci, bit_rate, data_bits, stop_bits, parity,
839 flow_ctrl_settings, xon_char, xoff_char, param_mask); 839 flow_ctrl_settings, xon_char, xoff_char, param_mask);
840 840
841 hdr = (void *) ptr; ptr += sizeof(*hdr); 841 hdr = (void *) ptr; ptr += sizeof(*hdr);
@@ -1120,9 +1120,9 @@ static int rfcomm_recv_disc(struct rfcomm_session *s, u8 dlci)
1120 1120
1121 d->state = BT_CLOSED; 1121 d->state = BT_CLOSED;
1122 __rfcomm_dlc_close(d, err); 1122 __rfcomm_dlc_close(d, err);
1123 } else 1123 } else
1124 rfcomm_send_dm(s, dlci); 1124 rfcomm_send_dm(s, dlci);
1125 1125
1126 } else { 1126 } else {
1127 rfcomm_send_ua(s, 0); 1127 rfcomm_send_ua(s, 0);
1128 1128
@@ -1230,7 +1230,7 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)
1230{ 1230{
1231 struct rfcomm_session *s = d->session; 1231 struct rfcomm_session *s = d->session;
1232 1232
1233 BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", 1233 BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d",
1234 d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits); 1234 d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits);
1235 1235
1236 if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) || 1236 if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) ||
@@ -1454,7 +1454,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb
1454 if (d->modem_status) 1454 if (d->modem_status)
1455 d->modem_status(d, msc->v24_sig); 1455 d->modem_status(d, msc->v24_sig);
1456 rfcomm_dlc_unlock(d); 1456 rfcomm_dlc_unlock(d);
1457 1457
1458 rfcomm_send_msc(s, 0, dlci, msc->v24_sig); 1458 rfcomm_send_msc(s, 0, dlci, msc->v24_sig);
1459 1459
1460 d->mscex |= RFCOMM_MSCEX_RX; 1460 d->mscex |= RFCOMM_MSCEX_RX;
@@ -1641,18 +1641,18 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
1641 struct sk_buff *skb; 1641 struct sk_buff *skb;
1642 int err; 1642 int err;
1643 1643
1644 BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d", 1644 BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d",
1645 d, d->state, d->cfc, d->rx_credits, d->tx_credits); 1645 d, d->state, d->cfc, d->rx_credits, d->tx_credits);
1646 1646
1647 /* Send pending MSC */ 1647 /* Send pending MSC */
1648 if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags)) 1648 if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags))
1649 rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); 1649 rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig);
1650 1650
1651 if (d->cfc) { 1651 if (d->cfc) {
1652 /* CFC enabled. 1652 /* CFC enabled.
1653 * Give them some credits */ 1653 * Give them some credits */
1654 if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) && 1654 if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) &&
1655 d->rx_credits <= (d->cfc >> 2)) { 1655 d->rx_credits <= (d->cfc >> 2)) {
1656 rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits); 1656 rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits);
1657 d->rx_credits = d->cfc; 1657 d->rx_credits = d->cfc;
1658 } 1658 }
@@ -1876,7 +1876,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
1876 1876
1877 /* Create socket */ 1877 /* Create socket */
1878 err = rfcomm_l2sock_create(&sock); 1878 err = rfcomm_l2sock_create(&sock);
1879 if (err < 0) { 1879 if (err < 0) {
1880 BT_ERR("Create socket failed %d", err); 1880 BT_ERR("Create socket failed %d", err);
1881 return err; 1881 return err;
1882 } 1882 }
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index cb7e855f0828..30586ab9e878 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -1,4 +1,4 @@
1/* 1/*
2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@@ -11,13 +11,13 @@
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
@@ -130,7 +130,7 @@ static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
130 struct hlist_node *node; 130 struct hlist_node *node;
131 131
132 sk_for_each(sk, node, &rfcomm_sk_list.head) { 132 sk_for_each(sk, node, &rfcomm_sk_list.head) {
133 if (rfcomm_pi(sk)->channel == channel && 133 if (rfcomm_pi(sk)->channel == channel &&
134 !bacmp(&bt_sk(sk)->src, src)) 134 !bacmp(&bt_sk(sk)->src, src))
135 break; 135 break;
136 } 136 }
@@ -572,7 +572,7 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
572 while (len) { 572 while (len) {
573 size_t size = min_t(size_t, len, d->mtu); 573 size_t size = min_t(size_t, len, d->mtu);
574 int err; 574 int err;
575 575
576 skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE, 576 skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
577 msg->msg_flags & MSG_DONTWAIT, &err); 577 msg->msg_flags & MSG_DONTWAIT, &err);
578 if (!skb) 578 if (!skb)
@@ -843,7 +843,7 @@ static int rfcomm_sock_release(struct socket *sock)
843 return err; 843 return err;
844} 844}
845 845
846/* ---- RFCOMM core layer callbacks ---- 846/* ---- RFCOMM core layer callbacks ----
847 * 847 *
848 * called under rfcomm_lock() 848 * called under rfcomm_lock()
849 */ 849 */
@@ -864,7 +864,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
864 864
865 /* Check for backlog size */ 865 /* Check for backlog size */
866 if (sk_acceptq_is_full(parent)) { 866 if (sk_acceptq_is_full(parent)) {
867 BT_DBG("backlog full %d", parent->sk_ack_backlog); 867 BT_DBG("backlog full %d", parent->sk_ack_backlog);
868 goto done; 868 goto done;
869 } 869 }
870 870
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index eb2b52484c70..8cd82dce5008 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -1,4 +1,4 @@
1/* 1/*
2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@@ -11,13 +11,13 @@
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
@@ -110,7 +110,7 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
110 110
111 kfree(dev); 111 kfree(dev);
112 112
113 /* It's safe to call module_put() here because socket still 113 /* It's safe to call module_put() here because socket still
114 holds reference to this module. */ 114 holds reference to this module. */
115 module_put(THIS_MODULE); 115 module_put(THIS_MODULE);
116} 116}
@@ -185,7 +185,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
185 int err = 0; 185 int err = 0;
186 186
187 BT_DBG("id %d channel %d", req->dev_id, req->channel); 187 BT_DBG("id %d channel %d", req->dev_id, req->channel);
188 188
189 dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL); 189 dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL);
190 if (!dev) 190 if (!dev)
191 return -ENOMEM; 191 return -ENOMEM;
@@ -234,7 +234,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
234 bacpy(&dev->dst, &req->dst); 234 bacpy(&dev->dst, &req->dst);
235 dev->channel = req->channel; 235 dev->channel = req->channel;
236 236
237 dev->flags = req->flags & 237 dev->flags = req->flags &
238 ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC)); 238 ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC));
239 239
240 init_waitqueue_head(&dev->wait); 240 init_waitqueue_head(&dev->wait);
@@ -249,7 +249,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
249 dev->dlc = dlc; 249 dev->dlc = dlc;
250 rfcomm_dlc_unlock(dlc); 250 rfcomm_dlc_unlock(dlc);
251 251
252 /* It's safe to call __module_get() here because socket already 252 /* It's safe to call __module_get() here because socket already
253 holds reference to this module. */ 253 holds reference to this module. */
254 __module_get(THIS_MODULE); 254 __module_get(THIS_MODULE);
255 255
@@ -487,7 +487,7 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
487{ 487{
488 struct rfcomm_dev *dev = dlc->owner; 488 struct rfcomm_dev *dev = dlc->owner;
489 struct tty_struct *tty; 489 struct tty_struct *tty;
490 490
491 if (!dev || !(tty = dev->tty)) { 491 if (!dev || !(tty = dev->tty)) {
492 kfree_skb(skb); 492 kfree_skb(skb);
493 return; 493 return;
@@ -506,7 +506,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
506 struct rfcomm_dev *dev = dlc->owner; 506 struct rfcomm_dev *dev = dlc->owner;
507 if (!dev) 507 if (!dev)
508 return; 508 return;
509 509
510 BT_DBG("dlc %p dev %p err %d", dlc, dev, err); 510 BT_DBG("dlc %p dev %p err %d", dlc, dev, err);
511 511
512 dev->err = err; 512 dev->err = err;
@@ -525,7 +525,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
525 rfcomm_dev_put(dev); 525 rfcomm_dev_put(dev);
526 rfcomm_dlc_lock(dlc); 526 rfcomm_dlc_lock(dlc);
527 } 527 }
528 } else 528 } else
529 tty_hangup(dev->tty); 529 tty_hangup(dev->tty);
530 } 530 }
531} 531}
@@ -543,7 +543,7 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
543 tty_hangup(dev->tty); 543 tty_hangup(dev->tty);
544 } 544 }
545 545
546 dev->modem_status = 546 dev->modem_status =
547 ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | 547 ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) |
548 ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) | 548 ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) |
549 ((v24_sig & RFCOMM_V24_IC) ? TIOCM_RI : 0) | 549 ((v24_sig & RFCOMM_V24_IC) ? TIOCM_RI : 0) |
@@ -561,7 +561,7 @@ static void rfcomm_tty_wakeup(unsigned long arg)
561 BT_DBG("dev %p tty %p", dev, tty); 561 BT_DBG("dev %p tty %p", dev, tty);
562 562
563 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup) 563 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup)
564 (tty->ldisc.write_wakeup)(tty); 564 (tty->ldisc.write_wakeup)(tty);
565 565
566 wake_up_interruptible(&tty->write_wait); 566 wake_up_interruptible(&tty->write_wait);
567#ifdef SERIAL_HAVE_POLL_WAIT 567#ifdef SERIAL_HAVE_POLL_WAIT
@@ -576,7 +576,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
576 struct rfcomm_dlc *dlc; 576 struct rfcomm_dlc *dlc;
577 int err, id; 577 int err, id;
578 578
579 id = tty->index; 579 id = tty->index;
580 580
581 BT_DBG("tty %p id %d", tty, id); 581 BT_DBG("tty %p id %d", tty, id);
582 582
@@ -670,7 +670,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in
670 size = min_t(uint, count, dlc->mtu); 670 size = min_t(uint, count, dlc->mtu);
671 671
672 skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC); 672 skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC);
673 673
674 if (!skb) 674 if (!skb)
675 break; 675 break;
676 676
@@ -773,7 +773,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
773 return; 773 return;
774 774
775 /* Handle turning off CRTSCTS */ 775 /* Handle turning off CRTSCTS */
776 if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) 776 if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS))
777 BT_DBG("Turning off CRTSCTS unsupported"); 777 BT_DBG("Turning off CRTSCTS unsupported");
778 778
779 /* Parity on/off and when on, odd/even */ 779 /* Parity on/off and when on, odd/even */
@@ -830,7 +830,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
830 } 830 }
831 831
832 /* Handle number of data bits [5-8] */ 832 /* Handle number of data bits [5-8] */
833 if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) 833 if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE))
834 changes |= RFCOMM_RPN_PM_DATA; 834 changes |= RFCOMM_RPN_PM_DATA;
835 835
836 switch (new->c_cflag & CSIZE) { 836 switch (new->c_cflag & CSIZE) {
@@ -868,7 +868,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
868 case 9600: 868 case 9600:
869 baud = RFCOMM_RPN_BR_9600; 869 baud = RFCOMM_RPN_BR_9600;
870 break; 870 break;
871 case 19200: 871 case 19200:
872 baud = RFCOMM_RPN_BR_19200; 872 baud = RFCOMM_RPN_BR_19200;
873 break; 873 break;
874 case 38400: 874 case 38400:
@@ -887,7 +887,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
887 /* 9600 is standard accordinag to the RFCOMM specification */ 887 /* 9600 is standard accordinag to the RFCOMM specification */
888 baud = RFCOMM_RPN_BR_9600; 888 baud = RFCOMM_RPN_BR_9600;
889 break; 889 break;
890 890
891 } 891 }
892 892
893 if (changes) 893 if (changes)
@@ -978,11 +978,11 @@ static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
978 978
979static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp) 979static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp)
980{ 980{
981 struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; 981 struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
982 982
983 BT_DBG("tty %p dev %p", tty, dev); 983 BT_DBG("tty %p dev %p", tty, dev);
984 984
985 return dev->modem_status; 985 return dev->modem_status;
986} 986}
987 987
988static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) 988static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear)