diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-07-13 14:50:15 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-07-13 15:32:45 -0400 |
commit | 5a54e7c85b8303b84a9b2fbf978a74d625f85a99 (patch) | |
tree | 2645770a8ce89f7d70ebf30eba3358f41ab39993 | |
parent | e03ab5199df597d3f1737ef638a7f692daaaef9f (diff) |
Bluetooth: Convert L2CAP ident spinlock into a mutex
The spinlock protecting the L2CAP ident number can be converted into
a mutex since the whole processing is run in a workqueue. So instead
of using a spinlock, just use a mutex here.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/l2cap.h | 3 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index d8e7b9330ab8..1fffd92808b0 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -625,11 +625,10 @@ struct l2cap_conn { | |||
625 | 625 | ||
626 | struct delayed_work info_timer; | 626 | struct delayed_work info_timer; |
627 | 627 | ||
628 | spinlock_t lock; | ||
629 | |||
630 | struct sk_buff *rx_skb; | 628 | struct sk_buff *rx_skb; |
631 | __u32 rx_len; | 629 | __u32 rx_len; |
632 | __u8 tx_ident; | 630 | __u8 tx_ident; |
631 | struct mutex ident_lock; | ||
633 | 632 | ||
634 | struct sk_buff_head pending_rx; | 633 | struct sk_buff_head pending_rx; |
635 | struct work_struct pending_rx_work; | 634 | struct work_struct pending_rx_work; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 0c3c4935f635..8538cb07b0c0 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -798,14 +798,14 @@ static u8 l2cap_get_ident(struct l2cap_conn *conn) | |||
798 | * 200 - 254 are used by utilities like l2ping, etc. | 798 | * 200 - 254 are used by utilities like l2ping, etc. |
799 | */ | 799 | */ |
800 | 800 | ||
801 | spin_lock(&conn->lock); | 801 | mutex_lock(&conn->ident_lock); |
802 | 802 | ||
803 | if (++conn->tx_ident > 128) | 803 | if (++conn->tx_ident > 128) |
804 | conn->tx_ident = 1; | 804 | conn->tx_ident = 1; |
805 | 805 | ||
806 | id = conn->tx_ident; | 806 | id = conn->tx_ident; |
807 | 807 | ||
808 | spin_unlock(&conn->lock); | 808 | mutex_unlock(&conn->ident_lock); |
809 | 809 | ||
810 | return id; | 810 | return id; |
811 | } | 811 | } |
@@ -7016,7 +7016,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon) | |||
7016 | conn->hs_enabled = test_bit(HCI_HS_ENABLED, | 7016 | conn->hs_enabled = test_bit(HCI_HS_ENABLED, |
7017 | &hcon->hdev->dev_flags); | 7017 | &hcon->hdev->dev_flags); |
7018 | 7018 | ||
7019 | spin_lock_init(&conn->lock); | 7019 | mutex_init(&conn->ident_lock); |
7020 | mutex_init(&conn->chan_lock); | 7020 | mutex_init(&conn->chan_lock); |
7021 | 7021 | ||
7022 | INIT_LIST_HEAD(&conn->chan_l); | 7022 | INIT_LIST_HEAD(&conn->chan_l); |