diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-06-29 07:41:49 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:49 -0400 |
commit | 4b10966f0f204d80f087f955344cbf6074a5cf86 (patch) | |
tree | ae9e7dfa86006328c44490dd755082d20963533f /net | |
parent | 6ab535a777d76a2b1e5ad03119cd0c1e5a366b06 (diff) |
Bluetooth: Move hci_pend_le_conn_* functions to different location
The hci_pend_le_conn_* function should be placed before their actual
users. So move them before hci_conn_params_* functions.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_core.c | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3ee2885dd9bc..ffee5f547506 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -3415,6 +3415,78 @@ static bool is_identity_address(bdaddr_t *addr, u8 addr_type) | |||
3415 | } | 3415 | } |
3416 | 3416 | ||
3417 | /* This function requires the caller holds hdev->lock */ | 3417 | /* This function requires the caller holds hdev->lock */ |
3418 | struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev, | ||
3419 | bdaddr_t *addr, u8 addr_type) | ||
3420 | { | ||
3421 | struct bdaddr_list *entry; | ||
3422 | |||
3423 | list_for_each_entry(entry, &hdev->pend_le_conns, list) { | ||
3424 | if (bacmp(&entry->bdaddr, addr) == 0 && | ||
3425 | entry->bdaddr_type == addr_type) | ||
3426 | return entry; | ||
3427 | } | ||
3428 | |||
3429 | return NULL; | ||
3430 | } | ||
3431 | |||
3432 | /* This function requires the caller holds hdev->lock */ | ||
3433 | void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | ||
3434 | { | ||
3435 | struct bdaddr_list *entry; | ||
3436 | |||
3437 | entry = hci_pend_le_conn_lookup(hdev, addr, addr_type); | ||
3438 | if (entry) | ||
3439 | goto done; | ||
3440 | |||
3441 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
3442 | if (!entry) { | ||
3443 | BT_ERR("Out of memory"); | ||
3444 | return; | ||
3445 | } | ||
3446 | |||
3447 | bacpy(&entry->bdaddr, addr); | ||
3448 | entry->bdaddr_type = addr_type; | ||
3449 | |||
3450 | list_add(&entry->list, &hdev->pend_le_conns); | ||
3451 | |||
3452 | BT_DBG("addr %pMR (type %u)", addr, addr_type); | ||
3453 | |||
3454 | done: | ||
3455 | hci_update_background_scan(hdev); | ||
3456 | } | ||
3457 | |||
3458 | /* This function requires the caller holds hdev->lock */ | ||
3459 | void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | ||
3460 | { | ||
3461 | struct bdaddr_list *entry; | ||
3462 | |||
3463 | entry = hci_pend_le_conn_lookup(hdev, addr, addr_type); | ||
3464 | if (!entry) | ||
3465 | goto done; | ||
3466 | |||
3467 | list_del(&entry->list); | ||
3468 | kfree(entry); | ||
3469 | |||
3470 | BT_DBG("addr %pMR (type %u)", addr, addr_type); | ||
3471 | |||
3472 | done: | ||
3473 | hci_update_background_scan(hdev); | ||
3474 | } | ||
3475 | |||
3476 | /* This function requires the caller holds hdev->lock */ | ||
3477 | void hci_pend_le_conns_clear(struct hci_dev *hdev) | ||
3478 | { | ||
3479 | struct bdaddr_list *entry, *tmp; | ||
3480 | |||
3481 | list_for_each_entry_safe(entry, tmp, &hdev->pend_le_conns, list) { | ||
3482 | list_del(&entry->list); | ||
3483 | kfree(entry); | ||
3484 | } | ||
3485 | |||
3486 | BT_DBG("All LE pending connections cleared"); | ||
3487 | } | ||
3488 | |||
3489 | /* This function requires the caller holds hdev->lock */ | ||
3418 | int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, | 3490 | int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, |
3419 | u8 auto_connect, u16 conn_min_interval, | 3491 | u8 auto_connect, u16 conn_min_interval, |
3420 | u16 conn_max_interval) | 3492 | u16 conn_max_interval) |
@@ -3492,78 +3564,6 @@ void hci_conn_params_clear(struct hci_dev *hdev) | |||
3492 | BT_DBG("All LE connection parameters were removed"); | 3564 | BT_DBG("All LE connection parameters were removed"); |
3493 | } | 3565 | } |
3494 | 3566 | ||
3495 | /* This function requires the caller holds hdev->lock */ | ||
3496 | struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev, | ||
3497 | bdaddr_t *addr, u8 addr_type) | ||
3498 | { | ||
3499 | struct bdaddr_list *entry; | ||
3500 | |||
3501 | list_for_each_entry(entry, &hdev->pend_le_conns, list) { | ||
3502 | if (bacmp(&entry->bdaddr, addr) == 0 && | ||
3503 | entry->bdaddr_type == addr_type) | ||
3504 | return entry; | ||
3505 | } | ||
3506 | |||
3507 | return NULL; | ||
3508 | } | ||
3509 | |||
3510 | /* This function requires the caller holds hdev->lock */ | ||
3511 | void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | ||
3512 | { | ||
3513 | struct bdaddr_list *entry; | ||
3514 | |||
3515 | entry = hci_pend_le_conn_lookup(hdev, addr, addr_type); | ||
3516 | if (entry) | ||
3517 | goto done; | ||
3518 | |||
3519 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
3520 | if (!entry) { | ||
3521 | BT_ERR("Out of memory"); | ||
3522 | return; | ||
3523 | } | ||
3524 | |||
3525 | bacpy(&entry->bdaddr, addr); | ||
3526 | entry->bdaddr_type = addr_type; | ||
3527 | |||
3528 | list_add(&entry->list, &hdev->pend_le_conns); | ||
3529 | |||
3530 | BT_DBG("addr %pMR (type %u)", addr, addr_type); | ||
3531 | |||
3532 | done: | ||
3533 | hci_update_background_scan(hdev); | ||
3534 | } | ||
3535 | |||
3536 | /* This function requires the caller holds hdev->lock */ | ||
3537 | void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | ||
3538 | { | ||
3539 | struct bdaddr_list *entry; | ||
3540 | |||
3541 | entry = hci_pend_le_conn_lookup(hdev, addr, addr_type); | ||
3542 | if (!entry) | ||
3543 | goto done; | ||
3544 | |||
3545 | list_del(&entry->list); | ||
3546 | kfree(entry); | ||
3547 | |||
3548 | BT_DBG("addr %pMR (type %u)", addr, addr_type); | ||
3549 | |||
3550 | done: | ||
3551 | hci_update_background_scan(hdev); | ||
3552 | } | ||
3553 | |||
3554 | /* This function requires the caller holds hdev->lock */ | ||
3555 | void hci_pend_le_conns_clear(struct hci_dev *hdev) | ||
3556 | { | ||
3557 | struct bdaddr_list *entry, *tmp; | ||
3558 | |||
3559 | list_for_each_entry_safe(entry, tmp, &hdev->pend_le_conns, list) { | ||
3560 | list_del(&entry->list); | ||
3561 | kfree(entry); | ||
3562 | } | ||
3563 | |||
3564 | BT_DBG("All LE pending connections cleared"); | ||
3565 | } | ||
3566 | |||
3567 | static void inquiry_complete(struct hci_dev *hdev, u8 status) | 3567 | static void inquiry_complete(struct hci_dev *hdev, u8 status) |
3568 | { | 3568 | { |
3569 | if (status) { | 3569 | if (status) { |