aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-03-01 17:25:33 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-01 17:33:14 -0500
commitba13ccd9b911e043c0f11e60cbb72bd4de194205 (patch)
tree7c8437d2693bfa7c438d5ddc59f329b57974c810 /net/bluetooth
parentbe22b54e8711734f4cb93ac31723b955fe9dbbe0 (diff)
Bluetooth: Update L2CAP timeout constants to use msecs_to_jiffies
The L2CAP timeout constants are always used in form of jiffies. So just include the conversion from msecs in the define itself. This has the advantage of making the code where the timeout is used more readable. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap_core.c18
-rw-r--r--net/bluetooth/l2cap_sock.c2
2 files changed, 7 insertions, 13 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bc8d558b01f6..0b1aabff8649 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -700,8 +700,7 @@ static void l2cap_do_start(struct l2cap_chan *chan)
700 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT; 700 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT;
701 conn->info_ident = l2cap_get_ident(conn); 701 conn->info_ident = l2cap_get_ident(conn);
702 702
703 schedule_delayed_work(&conn->info_timer, 703 schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
704 msecs_to_jiffies(L2CAP_INFO_TIMEOUT));
705 704
706 l2cap_send_cmd(conn, conn->info_ident, 705 l2cap_send_cmd(conn, conn->info_ident,
707 L2CAP_INFO_REQ, sizeof(req), &req); 706 L2CAP_INFO_REQ, sizeof(req), &req);
@@ -2741,8 +2740,7 @@ sendresp:
2741 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT; 2740 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT;
2742 conn->info_ident = l2cap_get_ident(conn); 2741 conn->info_ident = l2cap_get_ident(conn);
2743 2742
2744 schedule_delayed_work(&conn->info_timer, 2743 schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
2745 msecs_to_jiffies(L2CAP_INFO_TIMEOUT));
2746 2744
2747 l2cap_send_cmd(conn, conn->info_ident, 2745 l2cap_send_cmd(conn, conn->info_ident,
2748 L2CAP_INFO_REQ, sizeof(info), &info); 2746 L2CAP_INFO_REQ, sizeof(info), &info);
@@ -3028,8 +3026,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3028 default: 3026 default:
3029 l2cap_chan_set_err(chan, ECONNRESET); 3027 l2cap_chan_set_err(chan, ECONNRESET);
3030 3028
3031 __set_chan_timer(chan, 3029 __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT);
3032 msecs_to_jiffies(L2CAP_DISC_REJ_TIMEOUT));
3033 l2cap_send_disconn_req(conn, chan, ECONNRESET); 3030 l2cap_send_disconn_req(conn, chan, ECONNRESET);
3034 goto done; 3031 goto done;
3035 } 3032 }
@@ -4539,8 +4536,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt)
4539 if (encrypt == 0x00) { 4536 if (encrypt == 0x00) {
4540 if (chan->sec_level == BT_SECURITY_MEDIUM) { 4537 if (chan->sec_level == BT_SECURITY_MEDIUM) {
4541 __clear_chan_timer(chan); 4538 __clear_chan_timer(chan);
4542 __set_chan_timer(chan, 4539 __set_chan_timer(chan, L2CAP_ENC_TIMEOUT);
4543 msecs_to_jiffies(L2CAP_ENC_TIMEOUT));
4544 } else if (chan->sec_level == BT_SECURITY_HIGH) 4540 } else if (chan->sec_level == BT_SECURITY_HIGH)
4545 l2cap_chan_close(chan, ECONNREFUSED); 4541 l2cap_chan_close(chan, ECONNREFUSED);
4546 } else { 4542 } else {
@@ -4598,8 +4594,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4598 l2cap_send_conn_req(chan); 4594 l2cap_send_conn_req(chan);
4599 } else { 4595 } else {
4600 __clear_chan_timer(chan); 4596 __clear_chan_timer(chan);
4601 __set_chan_timer(chan, 4597 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
4602 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4603 } 4598 }
4604 } else if (chan->state == BT_CONNECT2) { 4599 } else if (chan->state == BT_CONNECT2) {
4605 struct sock *sk = chan->sk; 4600 struct sock *sk = chan->sk;
@@ -4622,8 +4617,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4622 } 4617 }
4623 } else { 4618 } else {
4624 __l2cap_state_change(chan, BT_DISCONN); 4619 __l2cap_state_change(chan, BT_DISCONN);
4625 __set_chan_timer(chan, 4620 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
4626 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4627 res = L2CAP_CR_SEC_BLOCK; 4621 res = L2CAP_CR_SEC_BLOCK;
4628 stat = L2CAP_CS_NO_INFO; 4622 stat = L2CAP_CS_NO_INFO;
4629 } 4623 }
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 52c94c765779..3da56c5c1fc9 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1039,7 +1039,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
1039 INIT_LIST_HEAD(&bt_sk(sk)->accept_q); 1039 INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
1040 1040
1041 sk->sk_destruct = l2cap_sock_destruct; 1041 sk->sk_destruct = l2cap_sock_destruct;
1042 sk->sk_sndtimeo = msecs_to_jiffies(L2CAP_CONN_TIMEOUT); 1042 sk->sk_sndtimeo = L2CAP_CONN_TIMEOUT;
1043 1043
1044 sock_reset_flag(sk, SOCK_ZAPPED); 1044 sock_reset_flag(sk, SOCK_ZAPPED);
1045 1045