diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-07-01 06:11:04 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:52 -0400 |
commit | 51d167c0972ef1496f2e6ab08aab602644d1f9bb (patch) | |
tree | 2563feff0947b7dea51588f7ecaf054790de3b5f /net | |
parent | f81cd823a844c60349c40b53a1b84b5968113596 (diff) |
Bluetooth: Change hci_conn_params_add to return the parameter struct
When adding new connection parameters, it is useful to return either
the existing struct or the newly created one.
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 | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 2312e77582b0..883ddd52344d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -3472,21 +3472,22 @@ void hci_pend_le_conns_clear(struct hci_dev *hdev) | |||
3472 | } | 3472 | } |
3473 | 3473 | ||
3474 | /* This function requires the caller holds hdev->lock */ | 3474 | /* This function requires the caller holds hdev->lock */ |
3475 | int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | 3475 | struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev, |
3476 | bdaddr_t *addr, u8 addr_type) | ||
3476 | { | 3477 | { |
3477 | struct hci_conn_params *params; | 3478 | struct hci_conn_params *params; |
3478 | 3479 | ||
3479 | if (!is_identity_address(addr, addr_type)) | 3480 | if (!is_identity_address(addr, addr_type)) |
3480 | return -EINVAL; | 3481 | return NULL; |
3481 | 3482 | ||
3482 | params = hci_conn_params_lookup(hdev, addr, addr_type); | 3483 | params = hci_conn_params_lookup(hdev, addr, addr_type); |
3483 | if (params) | 3484 | if (params) |
3484 | return 0; | 3485 | return params; |
3485 | 3486 | ||
3486 | params = kzalloc(sizeof(*params), GFP_KERNEL); | 3487 | params = kzalloc(sizeof(*params), GFP_KERNEL); |
3487 | if (!params) { | 3488 | if (!params) { |
3488 | BT_ERR("Out of memory"); | 3489 | BT_ERR("Out of memory"); |
3489 | return -ENOMEM; | 3490 | return NULL; |
3490 | } | 3491 | } |
3491 | 3492 | ||
3492 | bacpy(¶ms->addr, addr); | 3493 | bacpy(¶ms->addr, addr); |
@@ -3502,7 +3503,7 @@ int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) | |||
3502 | 3503 | ||
3503 | BT_DBG("addr %pMR (type %u)", addr, addr_type); | 3504 | BT_DBG("addr %pMR (type %u)", addr, addr_type); |
3504 | 3505 | ||
3505 | return 0; | 3506 | return params; |
3506 | } | 3507 | } |
3507 | 3508 | ||
3508 | /* This function requires the caller holds hdev->lock */ | 3509 | /* This function requires the caller holds hdev->lock */ |