diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-03-25 19:41:00 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-07 17:06:27 -0400 |
commit | 311bb895e325e5f4d708c1ed2206da8a3885c83a (patch) | |
tree | 17a7ec8b48ec79dbe5095c747ecaaab66e21f5ed /net | |
parent | f1c6775be6fc944e32e0150305d9753b9a846519 (diff) |
Bluetooth: Move busy workqueue to struct l2cap_chan
As part of the moving channel stuff to l2cap_chan.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 06c505b1476d..d3b5d6489a80 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1591,7 +1591,7 @@ static inline void l2cap_ertm_init(struct l2cap_chan *chan) | |||
1591 | skb_queue_head_init(&chan->srej_q); | 1591 | skb_queue_head_init(&chan->srej_q); |
1592 | skb_queue_head_init(&chan->busy_q); | 1592 | skb_queue_head_init(&chan->busy_q); |
1593 | 1593 | ||
1594 | INIT_WORK(&l2cap_pi(sk)->busy_work, l2cap_busy_work); | 1594 | INIT_WORK(&chan->busy_work, l2cap_busy_work); |
1595 | 1595 | ||
1596 | sk->sk_backlog_rcv = l2cap_ertm_data_rcv; | 1596 | sk->sk_backlog_rcv = l2cap_ertm_data_rcv; |
1597 | } | 1597 | } |
@@ -3006,21 +3006,21 @@ done: | |||
3006 | static void l2cap_busy_work(struct work_struct *work) | 3006 | static void l2cap_busy_work(struct work_struct *work) |
3007 | { | 3007 | { |
3008 | DECLARE_WAITQUEUE(wait, current); | 3008 | DECLARE_WAITQUEUE(wait, current); |
3009 | struct l2cap_pinfo *pi = | 3009 | struct l2cap_chan *chan = |
3010 | container_of(work, struct l2cap_pinfo, busy_work); | 3010 | container_of(work, struct l2cap_chan, busy_work); |
3011 | struct sock *sk = (struct sock *)pi; | 3011 | struct sock *sk = chan->sk; |
3012 | int n_tries = 0, timeo = HZ/5, err; | 3012 | int n_tries = 0, timeo = HZ/5, err; |
3013 | struct sk_buff *skb; | 3013 | struct sk_buff *skb; |
3014 | 3014 | ||
3015 | lock_sock(sk); | 3015 | lock_sock(sk); |
3016 | 3016 | ||
3017 | add_wait_queue(sk_sleep(sk), &wait); | 3017 | add_wait_queue(sk_sleep(sk), &wait); |
3018 | while ((skb = skb_peek(&pi->chan->busy_q))) { | 3018 | while ((skb = skb_peek(&chan->busy_q))) { |
3019 | set_current_state(TASK_INTERRUPTIBLE); | 3019 | set_current_state(TASK_INTERRUPTIBLE); |
3020 | 3020 | ||
3021 | if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) { | 3021 | if (n_tries++ > L2CAP_LOCAL_BUSY_TRIES) { |
3022 | err = -EBUSY; | 3022 | err = -EBUSY; |
3023 | l2cap_send_disconn_req(pi->conn, pi->chan, EBUSY); | 3023 | l2cap_send_disconn_req(l2cap_pi(sk)->conn, chan, EBUSY); |
3024 | break; | 3024 | break; |
3025 | } | 3025 | } |
3026 | 3026 | ||
@@ -3040,7 +3040,7 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3040 | if (err) | 3040 | if (err) |
3041 | break; | 3041 | break; |
3042 | 3042 | ||
3043 | if (l2cap_try_push_rx_skb(l2cap_pi(sk)->chan) == 0) | 3043 | if (l2cap_try_push_rx_skb(chan) == 0) |
3044 | break; | 3044 | break; |
3045 | } | 3045 | } |
3046 | 3046 | ||
@@ -3052,8 +3052,6 @@ static void l2cap_busy_work(struct work_struct *work) | |||
3052 | 3052 | ||
3053 | static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 control) | 3053 | static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 control) |
3054 | { | 3054 | { |
3055 | struct sock *sk = chan->sk; | ||
3056 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
3057 | int sctrl, err; | 3055 | int sctrl, err; |
3058 | 3056 | ||
3059 | if (chan->conn_state & L2CAP_CONN_LOCAL_BUSY) { | 3057 | if (chan->conn_state & L2CAP_CONN_LOCAL_BUSY) { |
@@ -3071,7 +3069,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c | |||
3071 | } | 3069 | } |
3072 | 3070 | ||
3073 | /* Busy Condition */ | 3071 | /* Busy Condition */ |
3074 | BT_DBG("sk %p, Enter local busy", sk); | 3072 | BT_DBG("chan %p, Enter local busy", chan); |
3075 | 3073 | ||
3076 | chan->conn_state |= L2CAP_CONN_LOCAL_BUSY; | 3074 | chan->conn_state |= L2CAP_CONN_LOCAL_BUSY; |
3077 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; | 3075 | bt_cb(skb)->sar = control >> L2CAP_CTRL_SAR_SHIFT; |
@@ -3085,7 +3083,7 @@ static int l2cap_push_rx_skb(struct l2cap_chan *chan, struct sk_buff *skb, u16 c | |||
3085 | 3083 | ||
3086 | del_timer(&chan->ack_timer); | 3084 | del_timer(&chan->ack_timer); |
3087 | 3085 | ||
3088 | queue_work(_busy_wq, &pi->busy_work); | 3086 | queue_work(_busy_wq, &chan->busy_work); |
3089 | 3087 | ||
3090 | return err; | 3088 | return err; |
3091 | } | 3089 | } |