Bluetooth: __l2cap_wait_ack() use msecs_to_jiffies()
authorDean Jenkins <Dean_Jenkins@mentor.com>
Tue, 23 Jun 2015 16:59:38 +0000 (17:59 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 23 Jul 2015 15:10:51 +0000 (17:10 +0200)
Use msecs_to_jiffies() instead of using HZ so that it
is easier to specify the time in milliseconds.

Also add a #define L2CAP_WAIT_ACK_POLL_PERIOD to specify the 200ms
polling period so that it is defined in a single place.

Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/l2cap.h
net/bluetooth/l2cap_sock.c

index 2239a37530922682008d9bbe312e6cbfbe97fd4d..3dcad4159b0b816dc634fe9be99a6acfaa0ec220 100644 (file)
@@ -55,6 +55,7 @@
 #define L2CAP_INFO_TIMEOUT             msecs_to_jiffies(4000)
 #define L2CAP_MOVE_TIMEOUT             msecs_to_jiffies(4000)
 #define L2CAP_MOVE_ERTX_TIMEOUT                msecs_to_jiffies(60000)
+#define L2CAP_WAIT_ACK_POLL_PERIOD     msecs_to_jiffies(200)
 
 #define L2CAP_A2MP_DEFAULT_MTU         670
 
index d915e4a963131fe2992770ad633b80273ccfdb32..f0b052a75e8aacadb16ac51ddb120bb4189a8207 100644 (file)
@@ -1058,7 +1058,7 @@ static int __l2cap_wait_ack(struct sock *sk, struct l2cap_chan *chan)
 {
        DECLARE_WAITQUEUE(wait, current);
        int err = 0;
-       int timeo = HZ/5;
+       int timeo = L2CAP_WAIT_ACK_POLL_PERIOD;
 
        add_wait_queue(sk_sleep(sk), &wait);
        set_current_state(TASK_INTERRUPTIBLE);
@@ -1066,7 +1066,7 @@ static int __l2cap_wait_ack(struct sock *sk, struct l2cap_chan *chan)
                BT_DBG("Waiting for %d ACKs", chan->unacked_frames);
 
                if (!timeo)
-                       timeo = HZ/5;
+                       timeo = L2CAP_WAIT_ACK_POLL_PERIOD;
 
                if (signal_pending(current)) {
                        err = sock_intr_errno(timeo);