aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2012-04-24 20:02:49 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 00:40:42 -0400
commit591f47f31ba4e89fc0cce2ad90da80945ce8bf94 (patch)
treef76c50645f1b90d677699eefe53f79188bf0e9d0 /net/bluetooth
parent2bbf2968e5cd72d2dd9e229d85c1617b8aa48f4e (diff)
Bluetooth: Move address type macros to bluetooth.h
This patch moves address type macros to bluetooth.h since they will be used by management interface and Bluetooth socket interface. It also replaces the macro prefix MGMT_ADDR_ by BDADDR_. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7d37c88e4bf5..d064ca9fa006 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1524,7 +1524,7 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1524 goto unlock; 1524 goto unlock;
1525 } 1525 }
1526 1526
1527 if (cp->addr.type == MGMT_ADDR_BREDR) 1527 if (cp->addr.type == BDADDR_BREDR)
1528 err = hci_remove_link_key(hdev, &cp->addr.bdaddr); 1528 err = hci_remove_link_key(hdev, &cp->addr.bdaddr);
1529 else 1529 else
1530 err = hci_remove_ltk(hdev, &cp->addr.bdaddr); 1530 err = hci_remove_ltk(hdev, &cp->addr.bdaddr);
@@ -1536,7 +1536,7 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1536 } 1536 }
1537 1537
1538 if (cp->disconnect) { 1538 if (cp->disconnect) {
1539 if (cp->addr.type == MGMT_ADDR_BREDR) 1539 if (cp->addr.type == BDADDR_BREDR)
1540 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, 1540 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK,
1541 &cp->addr.bdaddr); 1541 &cp->addr.bdaddr);
1542 else 1542 else
@@ -1596,7 +1596,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
1596 goto failed; 1596 goto failed;
1597 } 1597 }
1598 1598
1599 if (cp->addr.type == MGMT_ADDR_BREDR) 1599 if (cp->addr.type == BDADDR_BREDR)
1600 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr); 1600 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr);
1601 else 1601 else
1602 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr); 1602 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr);
@@ -1631,23 +1631,23 @@ static u8 link_to_mgmt(u8 link_type, u8 addr_type)
1631 case LE_LINK: 1631 case LE_LINK:
1632 switch (addr_type) { 1632 switch (addr_type) {
1633 case ADDR_LE_DEV_PUBLIC: 1633 case ADDR_LE_DEV_PUBLIC:
1634 return MGMT_ADDR_LE_PUBLIC; 1634 return BDADDR_LE_PUBLIC;
1635 1635
1636 default: 1636 default:
1637 /* Fallback to LE Random address type */ 1637 /* Fallback to LE Random address type */
1638 return MGMT_ADDR_LE_RANDOM; 1638 return BDADDR_LE_RANDOM;
1639 } 1639 }
1640 1640
1641 default: 1641 default:
1642 /* Fallback to BR/EDR type */ 1642 /* Fallback to BR/EDR type */
1643 return MGMT_ADDR_BREDR; 1643 return BDADDR_BREDR;
1644 } 1644 }
1645} 1645}
1646 1646
1647static u8 mgmt_to_le(u8 mgmt_type) 1647static u8 mgmt_to_le(u8 mgmt_type)
1648{ 1648{
1649 switch (mgmt_type) { 1649 switch (mgmt_type) {
1650 case MGMT_ADDR_LE_PUBLIC: 1650 case BDADDR_LE_PUBLIC:
1651 return ADDR_LE_DEV_PUBLIC; 1651 return ADDR_LE_DEV_PUBLIC;
1652 1652
1653 default: 1653 default:
@@ -1914,7 +1914,7 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1914 else 1914 else
1915 auth_type = HCI_AT_DEDICATED_BONDING_MITM; 1915 auth_type = HCI_AT_DEDICATED_BONDING_MITM;
1916 1916
1917 if (cp->addr.type == MGMT_ADDR_BREDR) 1917 if (cp->addr.type == BDADDR_BREDR)
1918 conn = hci_connect(hdev, ACL_LINK, &cp->addr.bdaddr, sec_level, 1918 conn = hci_connect(hdev, ACL_LINK, &cp->addr.bdaddr, sec_level,
1919 auth_type); 1919 auth_type);
1920 else 1920 else
@@ -1947,7 +1947,7 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
1947 } 1947 }
1948 1948
1949 /* For LE, just connecting isn't a proof that the pairing finished */ 1949 /* For LE, just connecting isn't a proof that the pairing finished */
1950 if (cp->addr.type == MGMT_ADDR_BREDR) 1950 if (cp->addr.type == BDADDR_BREDR)
1951 conn->connect_cfm_cb = pairing_complete_cb; 1951 conn->connect_cfm_cb = pairing_complete_cb;
1952 1952
1953 conn->security_cfm_cb = pairing_complete_cb; 1953 conn->security_cfm_cb = pairing_complete_cb;
@@ -2024,7 +2024,7 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
2024 goto done; 2024 goto done;
2025 } 2025 }
2026 2026
2027 if (type == MGMT_ADDR_BREDR) 2027 if (type == BDADDR_BREDR)
2028 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr); 2028 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, bdaddr);
2029 else 2029 else
2030 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr); 2030 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr);
@@ -2035,7 +2035,7 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
2035 goto done; 2035 goto done;
2036 } 2036 }
2037 2037
2038 if (type == MGMT_ADDR_LE_PUBLIC || type == MGMT_ADDR_LE_RANDOM) { 2038 if (type == BDADDR_LE_PUBLIC || type == BDADDR_LE_RANDOM) {
2039 /* Continue with pairing via SMP */ 2039 /* Continue with pairing via SMP */
2040 err = smp_user_confirm_reply(conn, mgmt_op, passkey); 2040 err = smp_user_confirm_reply(conn, mgmt_op, passkey);
2041 2041
@@ -2967,7 +2967,7 @@ int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, bool persisten
2967 2967
2968 ev.store_hint = persistent; 2968 ev.store_hint = persistent;
2969 bacpy(&ev.key.addr.bdaddr, &key->bdaddr); 2969 bacpy(&ev.key.addr.bdaddr, &key->bdaddr);
2970 ev.key.addr.type = MGMT_ADDR_BREDR; 2970 ev.key.addr.type = BDADDR_BREDR;
2971 ev.key.type = key->type; 2971 ev.key.type = key->type;
2972 memcpy(ev.key.val, key->val, 16); 2972 memcpy(ev.key.val, key->val, 16);
2973 ev.key.pin_len = key->pin_len; 2973 ev.key.pin_len = key->pin_len;
@@ -3125,7 +3125,7 @@ int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure)
3125 struct mgmt_ev_pin_code_request ev; 3125 struct mgmt_ev_pin_code_request ev;
3126 3126
3127 bacpy(&ev.addr.bdaddr, bdaddr); 3127 bacpy(&ev.addr.bdaddr, bdaddr);
3128 ev.addr.type = MGMT_ADDR_BREDR; 3128 ev.addr.type = BDADDR_BREDR;
3129 ev.secure = secure; 3129 ev.secure = secure;
3130 3130
3131 return mgmt_event(MGMT_EV_PIN_CODE_REQUEST, hdev, &ev, sizeof(ev), 3131 return mgmt_event(MGMT_EV_PIN_CODE_REQUEST, hdev, &ev, sizeof(ev),
@@ -3144,7 +3144,7 @@ int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
3144 return -ENOENT; 3144 return -ENOENT;
3145 3145
3146 bacpy(&rp.addr.bdaddr, bdaddr); 3146 bacpy(&rp.addr.bdaddr, bdaddr);
3147 rp.addr.type = MGMT_ADDR_BREDR; 3147 rp.addr.type = BDADDR_BREDR;
3148 3148
3149 err = cmd_complete(cmd->sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, 3149 err = cmd_complete(cmd->sk, hdev->id, MGMT_OP_PIN_CODE_REPLY,
3150 mgmt_status(status), &rp, sizeof(rp)); 3150 mgmt_status(status), &rp, sizeof(rp));
@@ -3166,7 +3166,7 @@ int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
3166 return -ENOENT; 3166 return -ENOENT;
3167 3167
3168 bacpy(&rp.addr.bdaddr, bdaddr); 3168 bacpy(&rp.addr.bdaddr, bdaddr);
3169 rp.addr.type = MGMT_ADDR_BREDR; 3169 rp.addr.type = BDADDR_BREDR;
3170 3170
3171 err = cmd_complete(cmd->sk, hdev->id, MGMT_OP_PIN_CODE_NEG_REPLY, 3171 err = cmd_complete(cmd->sk, hdev->id, MGMT_OP_PIN_CODE_NEG_REPLY,
3172 mgmt_status(status), &rp, sizeof(rp)); 3172 mgmt_status(status), &rp, sizeof(rp));