diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-03-15 18:07:15 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-03-18 14:36:04 -0400 |
commit | 1707c60e5d0d4c82c0601d92f10e24e04d2cc599 (patch) | |
tree | ea02904b2387322be5709c6bae7e977fae22aee4 /net | |
parent | 4c01f8b845238710ff4b6c7fa8148ca52613f199 (diff) |
Bluetooth: Simplify address parameters of user_pairing_resp()
Instead of passing the bdaddr and bdaddr_type as separate parameters to
user_pairing_resp it's simpler to just pass the original mgmt_addr_info
struct which contains both values.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/mgmt.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 75c9d9269d77..8587229ed1d9 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2300,7 +2300,7 @@ unlock: | |||
2300 | } | 2300 | } |
2301 | 2301 | ||
2302 | static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | 2302 | static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, |
2303 | bdaddr_t *bdaddr, u8 type, u16 mgmt_op, | 2303 | struct mgmt_addr_info *addr, u16 mgmt_op, |
2304 | u16 hci_op, __le32 passkey) | 2304 | u16 hci_op, __le32 passkey) |
2305 | { | 2305 | { |
2306 | struct pending_cmd *cmd; | 2306 | struct pending_cmd *cmd; |
@@ -2315,10 +2315,10 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2315 | goto done; | 2315 | goto done; |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | if (type == BDADDR_BREDR) | 2318 | if (addr->type == BDADDR_BREDR) |
2319 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr); | 2319 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &addr->bdaddr); |
2320 | else | 2320 | else |
2321 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr); | 2321 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &addr->bdaddr); |
2322 | 2322 | ||
2323 | if (!conn) { | 2323 | if (!conn) { |
2324 | err = cmd_status(sk, hdev->id, mgmt_op, | 2324 | err = cmd_status(sk, hdev->id, mgmt_op, |
@@ -2326,7 +2326,7 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2326 | goto done; | 2326 | goto done; |
2327 | } | 2327 | } |
2328 | 2328 | ||
2329 | if (type == BDADDR_LE_PUBLIC || type == BDADDR_LE_RANDOM) { | 2329 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { |
2330 | /* Continue with pairing via SMP */ | 2330 | /* Continue with pairing via SMP */ |
2331 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); | 2331 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); |
2332 | 2332 | ||
@@ -2340,7 +2340,7 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2340 | goto done; | 2340 | goto done; |
2341 | } | 2341 | } |
2342 | 2342 | ||
2343 | cmd = mgmt_pending_add(sk, mgmt_op, hdev, bdaddr, sizeof(*bdaddr)); | 2343 | cmd = mgmt_pending_add(sk, mgmt_op, hdev, addr, sizeof(*addr)); |
2344 | if (!cmd) { | 2344 | if (!cmd) { |
2345 | err = -ENOMEM; | 2345 | err = -ENOMEM; |
2346 | goto done; | 2346 | goto done; |
@@ -2350,11 +2350,12 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
2350 | if (hci_op == HCI_OP_USER_PASSKEY_REPLY) { | 2350 | if (hci_op == HCI_OP_USER_PASSKEY_REPLY) { |
2351 | struct hci_cp_user_passkey_reply cp; | 2351 | struct hci_cp_user_passkey_reply cp; |
2352 | 2352 | ||
2353 | bacpy(&cp.bdaddr, bdaddr); | 2353 | bacpy(&cp.bdaddr, &addr->bdaddr); |
2354 | cp.passkey = passkey; | 2354 | cp.passkey = passkey; |
2355 | err = hci_send_cmd(hdev, hci_op, sizeof(cp), &cp); | 2355 | err = hci_send_cmd(hdev, hci_op, sizeof(cp), &cp); |
2356 | } else | 2356 | } else |
2357 | err = hci_send_cmd(hdev, hci_op, sizeof(*bdaddr), bdaddr); | 2357 | err = hci_send_cmd(hdev, hci_op, sizeof(addr->bdaddr), |
2358 | &addr->bdaddr); | ||
2358 | 2359 | ||
2359 | if (err < 0) | 2360 | if (err < 0) |
2360 | mgmt_pending_remove(cmd); | 2361 | mgmt_pending_remove(cmd); |
@@ -2371,7 +2372,7 @@ static int pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev, | |||
2371 | 2372 | ||
2372 | BT_DBG(""); | 2373 | BT_DBG(""); |
2373 | 2374 | ||
2374 | return user_pairing_resp(sk, hdev, &cp->addr.bdaddr, cp->addr.type, | 2375 | return user_pairing_resp(sk, hdev, &cp->addr, |
2375 | MGMT_OP_PIN_CODE_NEG_REPLY, | 2376 | MGMT_OP_PIN_CODE_NEG_REPLY, |
2376 | HCI_OP_PIN_CODE_NEG_REPLY, 0); | 2377 | HCI_OP_PIN_CODE_NEG_REPLY, 0); |
2377 | } | 2378 | } |
@@ -2387,7 +2388,7 @@ static int user_confirm_reply(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2387 | return cmd_status(sk, hdev->id, MGMT_OP_USER_CONFIRM_REPLY, | 2388 | return cmd_status(sk, hdev->id, MGMT_OP_USER_CONFIRM_REPLY, |
2388 | MGMT_STATUS_INVALID_PARAMS); | 2389 | MGMT_STATUS_INVALID_PARAMS); |
2389 | 2390 | ||
2390 | return user_pairing_resp(sk, hdev, &cp->addr.bdaddr, cp->addr.type, | 2391 | return user_pairing_resp(sk, hdev, &cp->addr, |
2391 | MGMT_OP_USER_CONFIRM_REPLY, | 2392 | MGMT_OP_USER_CONFIRM_REPLY, |
2392 | HCI_OP_USER_CONFIRM_REPLY, 0); | 2393 | HCI_OP_USER_CONFIRM_REPLY, 0); |
2393 | } | 2394 | } |
@@ -2399,7 +2400,7 @@ static int user_confirm_neg_reply(struct sock *sk, struct hci_dev *hdev, | |||
2399 | 2400 | ||
2400 | BT_DBG(""); | 2401 | BT_DBG(""); |
2401 | 2402 | ||
2402 | return user_pairing_resp(sk, hdev, &cp->addr.bdaddr, cp->addr.type, | 2403 | return user_pairing_resp(sk, hdev, &cp->addr, |
2403 | MGMT_OP_USER_CONFIRM_NEG_REPLY, | 2404 | MGMT_OP_USER_CONFIRM_NEG_REPLY, |
2404 | HCI_OP_USER_CONFIRM_NEG_REPLY, 0); | 2405 | HCI_OP_USER_CONFIRM_NEG_REPLY, 0); |
2405 | } | 2406 | } |
@@ -2411,7 +2412,7 @@ static int user_passkey_reply(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2411 | 2412 | ||
2412 | BT_DBG(""); | 2413 | BT_DBG(""); |
2413 | 2414 | ||
2414 | return user_pairing_resp(sk, hdev, &cp->addr.bdaddr, cp->addr.type, | 2415 | return user_pairing_resp(sk, hdev, &cp->addr, |
2415 | MGMT_OP_USER_PASSKEY_REPLY, | 2416 | MGMT_OP_USER_PASSKEY_REPLY, |
2416 | HCI_OP_USER_PASSKEY_REPLY, cp->passkey); | 2417 | HCI_OP_USER_PASSKEY_REPLY, cp->passkey); |
2417 | } | 2418 | } |
@@ -2423,7 +2424,7 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, | |||
2423 | 2424 | ||
2424 | BT_DBG(""); | 2425 | BT_DBG(""); |
2425 | 2426 | ||
2426 | return user_pairing_resp(sk, hdev, &cp->addr.bdaddr, cp->addr.type, | 2427 | return user_pairing_resp(sk, hdev, &cp->addr, |
2427 | MGMT_OP_USER_PASSKEY_NEG_REPLY, | 2428 | MGMT_OP_USER_PASSKEY_NEG_REPLY, |
2428 | HCI_OP_USER_PASSKEY_NEG_REPLY, 0); | 2429 | HCI_OP_USER_PASSKEY_NEG_REPLY, 0); |
2429 | } | 2430 | } |