Skip to content

Commit

Permalink
Bluetooth: __l2cap_wait_ack() use msecs_to_jiffies()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Dean Jenkins authored and holtmann committed Jul 23, 2015
1 parent 451e4c6 commit cb02a25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions net/bluetooth/l2cap_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,15 +1058,15 @@ 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);
do {
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);
Expand Down

0 comments on commit cb02a25

Please sign in to comment.