diff options
| author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-11-14 10:39:30 -0500 |
|---|---|---|
| committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-11-19 16:30:00 -0500 |
| commit | a514b17fab51c1433db920d76cf8ddda959e5da0 (patch) | |
| tree | aedaf1cdddec615c2938813b57c7e5fc18c9199a | |
| parent | 522db70286fcce420e5fc1be107912fbd3806323 (diff) | |
Bluetooth: Refactor locking in amp_physical_cfm
Remove locking from l2cap_physical_cfm and lock chan inside
amp_physical_cfm.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
| -rw-r--r-- | include/net/bluetooth/l2cap.h | 2 | ||||
| -rw-r--r-- | net/bluetooth/amp.c | 6 | ||||
| -rw-r--r-- | net/bluetooth/l2cap_core.c | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index d65db459c843..f57fab04e7c5 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -811,6 +811,6 @@ void l2cap_send_conn_req(struct l2cap_chan *chan); | |||
| 811 | void l2cap_move_start(struct l2cap_chan *chan); | 811 | void l2cap_move_start(struct l2cap_chan *chan); |
| 812 | void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, | 812 | void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, |
| 813 | u8 status); | 813 | u8 status); |
| 814 | void l2cap_physical_cfm(struct l2cap_chan *chan, int result); | 814 | void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); |
| 815 | 815 | ||
| 816 | #endif /* __L2CAP_H */ | 816 | #endif /* __L2CAP_H */ |
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 4b2fea6c1c2a..eaf473ffeef9 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
| @@ -386,13 +386,17 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon) | |||
| 386 | 386 | ||
| 387 | bredr_chan = mgr->bredr_chan; | 387 | bredr_chan = mgr->bredr_chan; |
| 388 | 388 | ||
| 389 | l2cap_chan_lock(bredr_chan); | ||
| 390 | |||
| 389 | set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags); | 391 | set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags); |
| 390 | bredr_chan->remote_amp_id = hs_hcon->remote_id; | 392 | bredr_chan->remote_amp_id = hs_hcon->remote_id; |
| 391 | bredr_chan->hs_hcon = hs_hcon; | 393 | bredr_chan->hs_hcon = hs_hcon; |
| 392 | bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu; | 394 | bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu; |
| 393 | bredr_chan->fcs = L2CAP_FCS_NONE; | 395 | bredr_chan->fcs = L2CAP_FCS_NONE; |
| 394 | 396 | ||
| 395 | l2cap_physical_cfm(bredr_chan, 0); | 397 | __l2cap_physical_cfm(bredr_chan, 0); |
| 398 | |||
| 399 | l2cap_chan_unlock(bredr_chan); | ||
| 396 | 400 | ||
| 397 | hci_dev_put(bredr_hdev); | 401 | hci_dev_put(bredr_hdev); |
| 398 | } | 402 | } |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index e4f52a7f08c6..22c4ef926b0d 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -4611,7 +4611,8 @@ static void l2cap_do_move_cancel(struct l2cap_chan *chan, int result) | |||
| 4611 | l2cap_ertm_send(chan); | 4611 | l2cap_ertm_send(chan); |
| 4612 | } | 4612 | } |
| 4613 | 4613 | ||
| 4614 | void l2cap_physical_cfm(struct l2cap_chan *chan, int result) | 4614 | /* Invoke with locked chan */ |
| 4615 | void __l2cap_physical_cfm(struct l2cap_chan *chan, int result) | ||
| 4615 | { | 4616 | { |
| 4616 | u8 local_amp_id = chan->local_amp_id; | 4617 | u8 local_amp_id = chan->local_amp_id; |
| 4617 | u8 remote_amp_id = chan->remote_amp_id; | 4618 | u8 remote_amp_id = chan->remote_amp_id; |
| @@ -4619,8 +4620,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result) | |||
| 4619 | BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", | 4620 | BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", |
| 4620 | chan, result, local_amp_id, remote_amp_id); | 4621 | chan, result, local_amp_id, remote_amp_id); |
| 4621 | 4622 | ||
| 4622 | l2cap_chan_lock(chan); | ||
| 4623 | |||
| 4624 | if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { | 4623 | if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { |
| 4625 | l2cap_chan_unlock(chan); | 4624 | l2cap_chan_unlock(chan); |
| 4626 | return; | 4625 | return; |
| @@ -4644,8 +4643,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result) | |||
| 4644 | break; | 4643 | break; |
| 4645 | } | 4644 | } |
| 4646 | } | 4645 | } |
| 4647 | |||
| 4648 | l2cap_chan_unlock(chan); | ||
| 4649 | } | 4646 | } |
| 4650 | 4647 | ||
| 4651 | static inline int l2cap_move_channel_req(struct l2cap_conn *conn, | 4648 | static inline int l2cap_move_channel_req(struct l2cap_conn *conn, |
