aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-10 05:09:08 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-10 05:14:20 -0400
commitbc6d2d04182877b198c1a945b7c401decbbb8c02 (patch)
tree45eb37701152bc89d506ab639112e3ac14ef12ee /net/bluetooth/hci_event.c
parent123abc0833181aec4796c628d9ffd608b2b41d5c (diff)
Bluetooth: Remove unneeded mgmt_discoverable function
Since the HCISETSCAN ioctl is the only non-mgmt user we care about for setting the right discoverable state we can simply do the necessary updates in the ioctl handler function instead. This then allows the removal of the mgmt_discoverable function and should simplify that state handling considerably. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 38a0e457eaf9..760bbd88f3c5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -296,7 +296,6 @@ static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
296{ 296{
297 __u8 status = *((__u8 *) skb->data); 297 __u8 status = *((__u8 *) skb->data);
298 __u8 param; 298 __u8 param;
299 int old_pscan, old_iscan;
300 void *sent; 299 void *sent;
301 300
302 BT_DBG("%s status 0x%2.2x", hdev->name, status); 301 BT_DBG("%s status 0x%2.2x", hdev->name, status);
@@ -315,23 +314,15 @@ static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
315 goto done; 314 goto done;
316 } 315 }
317 316
318 /* We need to ensure that we set this back on if someone changed 317 if (param & SCAN_INQUIRY)
319 * the scan mode through a raw HCI socket.
320 */
321 set_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
322
323 old_pscan = test_and_clear_bit(HCI_PSCAN, &hdev->flags);
324 old_iscan = test_and_clear_bit(HCI_ISCAN, &hdev->flags);
325
326 if (param & SCAN_INQUIRY) {
327 set_bit(HCI_ISCAN, &hdev->flags); 318 set_bit(HCI_ISCAN, &hdev->flags);
328 if (!old_iscan) 319 else
329 mgmt_discoverable(hdev, 1); 320 clear_bit(HCI_ISCAN, &hdev->flags);
330 } else if (old_iscan)
331 mgmt_discoverable(hdev, 0);
332 321
333 if (param & SCAN_PAGE) 322 if (param & SCAN_PAGE)
334 set_bit(HCI_PSCAN, &hdev->flags); 323 set_bit(HCI_PSCAN, &hdev->flags);
324 else
325 clear_bit(HCI_ISCAN, &hdev->flags);
335 326
336done: 327done:
337 hci_dev_unlock(hdev); 328 hci_dev_unlock(hdev);