aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--net/bluetooth/hci_core.c15
2 files changed, 11 insertions, 5 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index aaeaf0938ec0..15f10841e2b5 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -104,6 +104,7 @@ enum {
104enum { 104enum {
105 HCI_SETUP, 105 HCI_SETUP,
106 HCI_AUTO_OFF, 106 HCI_AUTO_OFF,
107 HCI_RFKILLED,
107 HCI_MGMT, 108 HCI_MGMT,
108 HCI_PAIRABLE, 109 HCI_PAIRABLE,
109 HCI_SERVICE_CACHE, 110 HCI_SERVICE_CACHE,
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)