aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-09-13 01:58:17 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-09-18 13:37:27 -0400
commit5e130367d43ff22836bbae380d197d600fe8ddbb (patch)
treefa0633ce5e70d90a935f44f94a197dd7d5fae3f1 /net/bluetooth/hci_core.c
parent330b6c1521d76d8b88513fbafe18709ad86dafc4 (diff)
Bluetooth: Introduce a new HCI_RFKILLED flag
This makes it more convenient to check for rfkill (no need to check for dev->rfkill before calling rfkill_blocked()) and also avoids potential races if the RFKILL state needs to be checked from within the rfkill callback. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 634debab4d54..0d5bc246b607 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1146,7 +1146,7 @@ int hci_dev_open(__u16 dev)
1146 goto done; 1146 goto done;
1147 } 1147 }
1148 1148
1149 if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { 1149 if (test_bit(HCI_RFKILLED, &hdev->dev_flags)) {
1150 ret = -ERFKILL; 1150 ret = -ERFKILL;
1151 goto done; 1151 goto done;
1152 } 1152 }
@@ -1566,10 +1566,12 @@ static int hci_rfkill_set_block(void *data, bool blocked)
1566 1566
1567 BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked); 1567 BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked);
1568 1568
1569 if (!blocked) 1569 if (blocked) {
1570 return 0; 1570 set_bit(HCI_RFKILLED, &hdev->dev_flags);
1571 1571 hci_dev_do_close(hdev);
1572 hci_dev_do_close(hdev); 1572 } else {
1573 clear_bit(HCI_RFKILLED, &hdev->dev_flags);
1574}
1573 1575
1574 return 0; 1576 return 0;
1575} 1577}
@@ -2209,6 +2211,9 @@ int hci_register_dev(struct hci_dev *hdev)
2209 } 2211 }
2210 } 2212 }
2211 2213
2214 if (hdev->rfkill && rfkill_blocked(hdev->rfkill))
2215 set_bit(HCI_RFKILLED, &hdev->dev_flags);
2216
2212 set_bit(HCI_SETUP, &hdev->dev_flags); 2217 set_bit(HCI_SETUP, &hdev->dev_flags);
2213 2218
2214 if (hdev->dev_type != HCI_AMP) 2219 if (hdev->dev_type != HCI_AMP)