aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-03-06 14:08:53 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-03-06 14:15:21 -0500
commita69e8375a134eb7f42d5de7e14d0816967282757 (patch)
tree0b7d93731b4712b943769277e41e1dae8fb522ce /net
parentb9a245fb12315f8c6528b29a991a004859c982d5 (diff)
Bluetooth: Rename cmd_status() to mgmt_cmd_status()
This patch renames the cmd_status() function to mgmt_cmd_status() in preparation of making it a generic helper for other modules to use too. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c459
1 files changed, 230 insertions, 229 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f65516420a31..6f20b78e1965 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -249,7 +249,7 @@ static int mgmt_event(u16 event, struct hci_dev *hdev, void *data, u16 data_len,
249 return 0; 249 return 0;
250} 250}
251 251
252static int cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status) 252static int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
253{ 253{
254 struct sk_buff *skb; 254 struct sk_buff *skb;
255 struct mgmt_hdr *hdr; 255 struct mgmt_hdr *hdr;
@@ -1396,14 +1396,14 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
1396 BT_DBG("request for %s", hdev->name); 1396 BT_DBG("request for %s", hdev->name);
1397 1397
1398 if (cp->val != 0x00 && cp->val != 0x01) 1398 if (cp->val != 0x00 && cp->val != 0x01)
1399 return cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED, 1399 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED,
1400 MGMT_STATUS_INVALID_PARAMS); 1400 MGMT_STATUS_INVALID_PARAMS);
1401 1401
1402 hci_dev_lock(hdev); 1402 hci_dev_lock(hdev);
1403 1403
1404 if (mgmt_pending_find(MGMT_OP_SET_POWERED, hdev)) { 1404 if (mgmt_pending_find(MGMT_OP_SET_POWERED, hdev)) {
1405 err = cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED, 1405 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED,
1406 MGMT_STATUS_BUSY); 1406 MGMT_STATUS_BUSY);
1407 goto failed; 1407 goto failed;
1408 } 1408 }
1409 1409
@@ -1492,7 +1492,7 @@ static void cmd_status_rsp(struct pending_cmd *cmd, void *data)
1492{ 1492{
1493 u8 *status = data; 1493 u8 *status = data;
1494 1494
1495 cmd_status(cmd->sk, cmd->index, cmd->opcode, *status); 1495 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, *status);
1496 mgmt_pending_remove(cmd); 1496 mgmt_pending_remove(cmd);
1497} 1497}
1498 1498
@@ -1560,7 +1560,7 @@ static void set_discoverable_complete(struct hci_dev *hdev, u8 status,
1560 1560
1561 if (status) { 1561 if (status) {
1562 u8 mgmt_err = mgmt_status(status); 1562 u8 mgmt_err = mgmt_status(status);
1563 cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); 1563 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
1564 clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); 1564 clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
1565 goto remove_cmd; 1565 goto remove_cmd;
1566 } 1566 }
@@ -1616,12 +1616,12 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
1616 1616
1617 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags) && 1617 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags) &&
1618 !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) 1618 !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
1619 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1619 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1620 MGMT_STATUS_REJECTED); 1620 MGMT_STATUS_REJECTED);
1621 1621
1622 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02) 1622 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02)
1623 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1623 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1624 MGMT_STATUS_INVALID_PARAMS); 1624 MGMT_STATUS_INVALID_PARAMS);
1625 1625
1626 timeout = __le16_to_cpu(cp->timeout); 1626 timeout = __le16_to_cpu(cp->timeout);
1627 1627
@@ -1630,27 +1630,27 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
1630 */ 1630 */
1631 if ((cp->val == 0x00 && timeout > 0) || 1631 if ((cp->val == 0x00 && timeout > 0) ||
1632 (cp->val == 0x02 && timeout == 0)) 1632 (cp->val == 0x02 && timeout == 0))
1633 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1633 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1634 MGMT_STATUS_INVALID_PARAMS); 1634 MGMT_STATUS_INVALID_PARAMS);
1635 1635
1636 hci_dev_lock(hdev); 1636 hci_dev_lock(hdev);
1637 1637
1638 if (!hdev_is_powered(hdev) && timeout > 0) { 1638 if (!hdev_is_powered(hdev) && timeout > 0) {
1639 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1639 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1640 MGMT_STATUS_NOT_POWERED); 1640 MGMT_STATUS_NOT_POWERED);
1641 goto failed; 1641 goto failed;
1642 } 1642 }
1643 1643
1644 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || 1644 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) ||
1645 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { 1645 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) {
1646 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1646 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1647 MGMT_STATUS_BUSY); 1647 MGMT_STATUS_BUSY);
1648 goto failed; 1648 goto failed;
1649 } 1649 }
1650 1650
1651 if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) { 1651 if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) {
1652 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1652 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1653 MGMT_STATUS_REJECTED); 1653 MGMT_STATUS_REJECTED);
1654 goto failed; 1654 goto failed;
1655 } 1655 }
1656 1656
@@ -1819,7 +1819,7 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status,
1819 1819
1820 if (status) { 1820 if (status) {
1821 u8 mgmt_err = mgmt_status(status); 1821 u8 mgmt_err = mgmt_status(status);
1822 cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); 1822 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
1823 goto remove_cmd; 1823 goto remove_cmd;
1824 } 1824 }
1825 1825
@@ -1894,12 +1894,12 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
1894 1894
1895 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags) && 1895 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags) &&
1896 !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) 1896 !test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
1897 return cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, 1897 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE,
1898 MGMT_STATUS_REJECTED); 1898 MGMT_STATUS_REJECTED);
1899 1899
1900 if (cp->val != 0x00 && cp->val != 0x01) 1900 if (cp->val != 0x00 && cp->val != 0x01)
1901 return cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, 1901 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE,
1902 MGMT_STATUS_INVALID_PARAMS); 1902 MGMT_STATUS_INVALID_PARAMS);
1903 1903
1904 hci_dev_lock(hdev); 1904 hci_dev_lock(hdev);
1905 1905
@@ -1910,8 +1910,8 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
1910 1910
1911 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || 1911 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) ||
1912 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { 1912 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) {
1913 err = cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, 1913 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE,
1914 MGMT_STATUS_BUSY); 1914 MGMT_STATUS_BUSY);
1915 goto failed; 1915 goto failed;
1916 } 1916 }
1917 1917
@@ -1996,8 +1996,8 @@ static int set_bondable(struct sock *sk, struct hci_dev *hdev, void *data,
1996 BT_DBG("request for %s", hdev->name); 1996 BT_DBG("request for %s", hdev->name);
1997 1997
1998 if (cp->val != 0x00 && cp->val != 0x01) 1998 if (cp->val != 0x00 && cp->val != 0x01)
1999 return cmd_status(sk, hdev->id, MGMT_OP_SET_BONDABLE, 1999 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BONDABLE,
2000 MGMT_STATUS_INVALID_PARAMS); 2000 MGMT_STATUS_INVALID_PARAMS);
2001 2001
2002 hci_dev_lock(hdev); 2002 hci_dev_lock(hdev);
2003 2003
@@ -2030,12 +2030,12 @@ static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,
2030 2030
2031 status = mgmt_bredr_support(hdev); 2031 status = mgmt_bredr_support(hdev);
2032 if (status) 2032 if (status)
2033 return cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, 2033 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
2034 status); 2034 status);
2035 2035
2036 if (cp->val != 0x00 && cp->val != 0x01) 2036 if (cp->val != 0x00 && cp->val != 0x01)
2037 return cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, 2037 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
2038 MGMT_STATUS_INVALID_PARAMS); 2038 MGMT_STATUS_INVALID_PARAMS);
2039 2039
2040 hci_dev_lock(hdev); 2040 hci_dev_lock(hdev);
2041 2041
@@ -2059,8 +2059,8 @@ static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,
2059 } 2059 }
2060 2060
2061 if (mgmt_pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) { 2061 if (mgmt_pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) {
2062 err = cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, 2062 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
2063 MGMT_STATUS_BUSY); 2063 MGMT_STATUS_BUSY);
2064 goto failed; 2064 goto failed;
2065 } 2065 }
2066 2066
@@ -2099,15 +2099,15 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2099 2099
2100 status = mgmt_bredr_support(hdev); 2100 status = mgmt_bredr_support(hdev);
2101 if (status) 2101 if (status)
2102 return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, status); 2102 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, status);
2103 2103
2104 if (!lmp_ssp_capable(hdev)) 2104 if (!lmp_ssp_capable(hdev))
2105 return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, 2105 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
2106 MGMT_STATUS_NOT_SUPPORTED); 2106 MGMT_STATUS_NOT_SUPPORTED);
2107 2107
2108 if (cp->val != 0x00 && cp->val != 0x01) 2108 if (cp->val != 0x00 && cp->val != 0x01)
2109 return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, 2109 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
2110 MGMT_STATUS_INVALID_PARAMS); 2110 MGMT_STATUS_INVALID_PARAMS);
2111 2111
2112 hci_dev_lock(hdev); 2112 hci_dev_lock(hdev);
2113 2113
@@ -2138,8 +2138,8 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2138 } 2138 }
2139 2139
2140 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { 2140 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) {
2141 err = cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, 2141 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
2142 MGMT_STATUS_BUSY); 2142 MGMT_STATUS_BUSY);
2143 goto failed; 2143 goto failed;
2144 } 2144 }
2145 2145
@@ -2180,25 +2180,25 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2180 2180
2181 status = mgmt_bredr_support(hdev); 2181 status = mgmt_bredr_support(hdev);
2182 if (status) 2182 if (status)
2183 return cmd_status(sk, hdev->id, MGMT_OP_SET_HS, status); 2183 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, status);
2184 2184
2185 if (!lmp_ssp_capable(hdev)) 2185 if (!lmp_ssp_capable(hdev))
2186 return cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2186 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2187 MGMT_STATUS_NOT_SUPPORTED); 2187 MGMT_STATUS_NOT_SUPPORTED);
2188 2188
2189 if (!test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) 2189 if (!test_bit(HCI_SSP_ENABLED, &hdev->dev_flags))
2190 return cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2190 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2191 MGMT_STATUS_REJECTED); 2191 MGMT_STATUS_REJECTED);
2192 2192
2193 if (cp->val != 0x00 && cp->val != 0x01) 2193 if (cp->val != 0x00 && cp->val != 0x01)
2194 return cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2194 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2195 MGMT_STATUS_INVALID_PARAMS); 2195 MGMT_STATUS_INVALID_PARAMS);
2196 2196
2197 hci_dev_lock(hdev); 2197 hci_dev_lock(hdev);
2198 2198
2199 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { 2199 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) {
2200 err = cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2200 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2201 MGMT_STATUS_BUSY); 2201 MGMT_STATUS_BUSY);
2202 goto unlock; 2202 goto unlock;
2203 } 2203 }
2204 2204
@@ -2206,8 +2206,8 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2206 changed = !test_and_set_bit(HCI_HS_ENABLED, &hdev->dev_flags); 2206 changed = !test_and_set_bit(HCI_HS_ENABLED, &hdev->dev_flags);
2207 } else { 2207 } else {
2208 if (hdev_is_powered(hdev)) { 2208 if (hdev_is_powered(hdev)) {
2209 err = cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2209 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2210 MGMT_STATUS_REJECTED); 2210 MGMT_STATUS_REJECTED);
2211 goto unlock; 2211 goto unlock;
2212 } 2212 }
2213 2213
@@ -2278,17 +2278,17 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2278 BT_DBG("request for %s", hdev->name); 2278 BT_DBG("request for %s", hdev->name);
2279 2279
2280 if (!lmp_le_capable(hdev)) 2280 if (!lmp_le_capable(hdev))
2281 return cmd_status(sk, hdev->id, MGMT_OP_SET_LE, 2281 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
2282 MGMT_STATUS_NOT_SUPPORTED); 2282 MGMT_STATUS_NOT_SUPPORTED);
2283 2283
2284 if (cp->val != 0x00 && cp->val != 0x01) 2284 if (cp->val != 0x00 && cp->val != 0x01)
2285 return cmd_status(sk, hdev->id, MGMT_OP_SET_LE, 2285 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
2286 MGMT_STATUS_INVALID_PARAMS); 2286 MGMT_STATUS_INVALID_PARAMS);
2287 2287
2288 /* LE-only devices do not allow toggling LE on/off */ 2288 /* LE-only devices do not allow toggling LE on/off */
2289 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) 2289 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
2290 return cmd_status(sk, hdev->id, MGMT_OP_SET_LE, 2290 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
2291 MGMT_STATUS_REJECTED); 2291 MGMT_STATUS_REJECTED);
2292 2292
2293 hci_dev_lock(hdev); 2293 hci_dev_lock(hdev);
2294 2294
@@ -2320,8 +2320,8 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2320 2320
2321 if (mgmt_pending_find(MGMT_OP_SET_LE, hdev) || 2321 if (mgmt_pending_find(MGMT_OP_SET_LE, hdev) ||
2322 mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev)) { 2322 mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev)) {
2323 err = cmd_status(sk, hdev->id, MGMT_OP_SET_LE, 2323 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
2324 MGMT_STATUS_BUSY); 2324 MGMT_STATUS_BUSY);
2325 goto unlock; 2325 goto unlock;
2326 } 2326 }
2327 2327
@@ -2436,8 +2436,8 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2436 hci_dev_lock(hdev); 2436 hci_dev_lock(hdev);
2437 2437
2438 if (pending_eir_or_class(hdev)) { 2438 if (pending_eir_or_class(hdev)) {
2439 err = cmd_status(sk, hdev->id, MGMT_OP_ADD_UUID, 2439 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_UUID,
2440 MGMT_STATUS_BUSY); 2440 MGMT_STATUS_BUSY);
2441 goto failed; 2441 goto failed;
2442 } 2442 }
2443 2443
@@ -2517,8 +2517,8 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
2517 hci_dev_lock(hdev); 2517 hci_dev_lock(hdev);
2518 2518
2519 if (pending_eir_or_class(hdev)) { 2519 if (pending_eir_or_class(hdev)) {
2520 err = cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID, 2520 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID,
2521 MGMT_STATUS_BUSY); 2521 MGMT_STATUS_BUSY);
2522 goto unlock; 2522 goto unlock;
2523 } 2523 }
2524 2524
@@ -2546,8 +2546,8 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
2546 } 2546 }
2547 2547
2548 if (found == 0) { 2548 if (found == 0) {
2549 err = cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID, 2549 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_UUID,
2550 MGMT_STATUS_INVALID_PARAMS); 2550 MGMT_STATUS_INVALID_PARAMS);
2551 goto unlock; 2551 goto unlock;
2552 } 2552 }
2553 2553
@@ -2598,20 +2598,20 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
2598 BT_DBG("request for %s", hdev->name); 2598 BT_DBG("request for %s", hdev->name);
2599 2599
2600 if (!lmp_bredr_capable(hdev)) 2600 if (!lmp_bredr_capable(hdev))
2601 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, 2601 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
2602 MGMT_STATUS_NOT_SUPPORTED); 2602 MGMT_STATUS_NOT_SUPPORTED);
2603 2603
2604 hci_dev_lock(hdev); 2604 hci_dev_lock(hdev);
2605 2605
2606 if (pending_eir_or_class(hdev)) { 2606 if (pending_eir_or_class(hdev)) {
2607 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, 2607 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
2608 MGMT_STATUS_BUSY); 2608 MGMT_STATUS_BUSY);
2609 goto unlock; 2609 goto unlock;
2610 } 2610 }
2611 2611
2612 if ((cp->minor & 0x03) != 0 || (cp->major & 0xe0) != 0) { 2612 if ((cp->minor & 0x03) != 0 || (cp->major & 0xe0) != 0) {
2613 err = cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, 2613 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
2614 MGMT_STATUS_INVALID_PARAMS); 2614 MGMT_STATUS_INVALID_PARAMS);
2615 goto unlock; 2615 goto unlock;
2616 } 2616 }
2617 2617
@@ -2671,15 +2671,15 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
2671 BT_DBG("request for %s", hdev->name); 2671 BT_DBG("request for %s", hdev->name);
2672 2672
2673 if (!lmp_bredr_capable(hdev)) 2673 if (!lmp_bredr_capable(hdev))
2674 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 2674 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
2675 MGMT_STATUS_NOT_SUPPORTED); 2675 MGMT_STATUS_NOT_SUPPORTED);
2676 2676
2677 key_count = __le16_to_cpu(cp->key_count); 2677 key_count = __le16_to_cpu(cp->key_count);
2678 if (key_count > max_key_count) { 2678 if (key_count > max_key_count) {
2679 BT_ERR("load_link_keys: too big key_count value %u", 2679 BT_ERR("load_link_keys: too big key_count value %u",
2680 key_count); 2680 key_count);
2681 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 2681 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
2682 MGMT_STATUS_INVALID_PARAMS); 2682 MGMT_STATUS_INVALID_PARAMS);
2683 } 2683 }
2684 2684
2685 expected_len = sizeof(*cp) + key_count * 2685 expected_len = sizeof(*cp) + key_count *
@@ -2687,13 +2687,13 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
2687 if (expected_len != len) { 2687 if (expected_len != len) {
2688 BT_ERR("load_link_keys: expected %u bytes, got %u bytes", 2688 BT_ERR("load_link_keys: expected %u bytes, got %u bytes",
2689 expected_len, len); 2689 expected_len, len);
2690 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 2690 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
2691 MGMT_STATUS_INVALID_PARAMS); 2691 MGMT_STATUS_INVALID_PARAMS);
2692 } 2692 }
2693 2693
2694 if (cp->debug_keys != 0x00 && cp->debug_keys != 0x01) 2694 if (cp->debug_keys != 0x00 && cp->debug_keys != 0x01)
2695 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 2695 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
2696 MGMT_STATUS_INVALID_PARAMS); 2696 MGMT_STATUS_INVALID_PARAMS);
2697 2697
2698 BT_DBG("%s debug_keys %u key_count %u", hdev->name, cp->debug_keys, 2698 BT_DBG("%s debug_keys %u key_count %u", hdev->name, cp->debug_keys,
2699 key_count); 2699 key_count);
@@ -2702,8 +2702,9 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
2702 struct mgmt_link_key_info *key = &cp->keys[i]; 2702 struct mgmt_link_key_info *key = &cp->keys[i];
2703 2703
2704 if (key->addr.type != BDADDR_BREDR || key->type > 0x08) 2704 if (key->addr.type != BDADDR_BREDR || key->type > 0x08)
2705 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS, 2705 return mgmt_cmd_status(sk, hdev->id,
2706 MGMT_STATUS_INVALID_PARAMS); 2706 MGMT_OP_LOAD_LINK_KEYS,
2707 MGMT_STATUS_INVALID_PARAMS);
2707 } 2708 }
2708 2709
2709 hci_dev_lock(hdev); 2710 hci_dev_lock(hdev);
@@ -2961,8 +2962,8 @@ static int get_connections(struct sock *sk, struct hci_dev *hdev, void *data,
2961 hci_dev_lock(hdev); 2962 hci_dev_lock(hdev);
2962 2963
2963 if (!hdev_is_powered(hdev)) { 2964 if (!hdev_is_powered(hdev)) {
2964 err = cmd_status(sk, hdev->id, MGMT_OP_GET_CONNECTIONS, 2965 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_GET_CONNECTIONS,
2965 MGMT_STATUS_NOT_POWERED); 2966 MGMT_STATUS_NOT_POWERED);
2966 goto unlock; 2967 goto unlock;
2967 } 2968 }
2968 2969
@@ -3038,15 +3039,15 @@ static int pin_code_reply(struct sock *sk, struct hci_dev *hdev, void *data,
3038 hci_dev_lock(hdev); 3039 hci_dev_lock(hdev);
3039 3040
3040 if (!hdev_is_powered(hdev)) { 3041 if (!hdev_is_powered(hdev)) {
3041 err = cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, 3042 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY,
3042 MGMT_STATUS_NOT_POWERED); 3043 MGMT_STATUS_NOT_POWERED);
3043 goto failed; 3044 goto failed;
3044 } 3045 }
3045 3046
3046 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr); 3047 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->addr.bdaddr);
3047 if (!conn) { 3048 if (!conn) {
3048 err = cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, 3049 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY,
3049 MGMT_STATUS_NOT_CONNECTED); 3050 MGMT_STATUS_NOT_CONNECTED);
3050 goto failed; 3051 goto failed;
3051 } 3052 }
3052 3053
@@ -3059,8 +3060,8 @@ static int pin_code_reply(struct sock *sk, struct hci_dev *hdev, void *data,
3059 3060
3060 err = send_pin_code_neg_reply(sk, hdev, &ncp); 3061 err = send_pin_code_neg_reply(sk, hdev, &ncp);
3061 if (err >= 0) 3062 if (err >= 0)
3062 err = cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY, 3063 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_PIN_CODE_REPLY,
3063 MGMT_STATUS_INVALID_PARAMS); 3064 MGMT_STATUS_INVALID_PARAMS);
3064 3065
3065 goto failed; 3066 goto failed;
3066 } 3067 }
@@ -3344,23 +3345,23 @@ static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3344 hci_dev_lock(hdev); 3345 hci_dev_lock(hdev);
3345 3346
3346 if (!hdev_is_powered(hdev)) { 3347 if (!hdev_is_powered(hdev)) {
3347 err = cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 3348 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE,
3348 MGMT_STATUS_NOT_POWERED); 3349 MGMT_STATUS_NOT_POWERED);
3349 goto unlock; 3350 goto unlock;
3350 } 3351 }
3351 3352
3352 cmd = mgmt_pending_find(MGMT_OP_PAIR_DEVICE, hdev); 3353 cmd = mgmt_pending_find(MGMT_OP_PAIR_DEVICE, hdev);
3353 if (!cmd) { 3354 if (!cmd) {
3354 err = cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 3355 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE,
3355 MGMT_STATUS_INVALID_PARAMS); 3356 MGMT_STATUS_INVALID_PARAMS);
3356 goto unlock; 3357 goto unlock;
3357 } 3358 }
3358 3359
3359 conn = cmd->user_data; 3360 conn = cmd->user_data;
3360 3361
3361 if (bacmp(&addr->bdaddr, &conn->dst) != 0) { 3362 if (bacmp(&addr->bdaddr, &conn->dst) != 0) {
3362 err = cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 3363 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE,
3363 MGMT_STATUS_INVALID_PARAMS); 3364 MGMT_STATUS_INVALID_PARAMS);
3364 goto unlock; 3365 goto unlock;
3365 } 3366 }
3366 3367
@@ -3464,8 +3465,8 @@ static int user_confirm_reply(struct sock *sk, struct hci_dev *hdev, void *data,
3464 BT_DBG(""); 3465 BT_DBG("");
3465 3466
3466 if (len != sizeof(*cp)) 3467 if (len != sizeof(*cp))
3467 return cmd_status(sk, hdev->id, MGMT_OP_USER_CONFIRM_REPLY, 3468 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_USER_CONFIRM_REPLY,
3468 MGMT_STATUS_INVALID_PARAMS); 3469 MGMT_STATUS_INVALID_PARAMS);
3469 3470
3470 return user_pairing_resp(sk, hdev, &cp->addr, 3471 return user_pairing_resp(sk, hdev, &cp->addr,
3471 MGMT_OP_USER_CONFIRM_REPLY, 3472 MGMT_OP_USER_CONFIRM_REPLY,
@@ -3534,8 +3535,8 @@ static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode)
3534 cp = cmd->param; 3535 cp = cmd->param;
3535 3536
3536 if (status) 3537 if (status)
3537 cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 3538 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME,
3538 mgmt_status(status)); 3539 mgmt_status(status));
3539 else 3540 else
3540 cmd_complete(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0, 3541 cmd_complete(cmd->sk, hdev->id, MGMT_OP_SET_LOCAL_NAME, 0,
3541 cp, sizeof(*cp)); 3542 cp, sizeof(*cp));
@@ -3626,20 +3627,20 @@ static int read_local_oob_data(struct sock *sk, struct hci_dev *hdev,
3626 hci_dev_lock(hdev); 3627 hci_dev_lock(hdev);
3627 3628
3628 if (!hdev_is_powered(hdev)) { 3629 if (!hdev_is_powered(hdev)) {
3629 err = cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, 3630 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA,
3630 MGMT_STATUS_NOT_POWERED); 3631 MGMT_STATUS_NOT_POWERED);
3631 goto unlock; 3632 goto unlock;
3632 } 3633 }
3633 3634
3634 if (!lmp_ssp_capable(hdev)) { 3635 if (!lmp_ssp_capable(hdev)) {
3635 err = cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, 3636 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA,
3636 MGMT_STATUS_NOT_SUPPORTED); 3637 MGMT_STATUS_NOT_SUPPORTED);
3637 goto unlock; 3638 goto unlock;
3638 } 3639 }
3639 3640
3640 if (mgmt_pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev)) { 3641 if (mgmt_pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev)) {
3641 err = cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, 3642 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA,
3642 MGMT_STATUS_BUSY); 3643 MGMT_STATUS_BUSY);
3643 goto unlock; 3644 goto unlock;
3644 } 3645 }
3645 3646
@@ -3758,8 +3759,8 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3758 status, &cp->addr, sizeof(cp->addr)); 3759 status, &cp->addr, sizeof(cp->addr));
3759 } else { 3760 } else {
3760 BT_ERR("add_remote_oob_data: invalid length of %u bytes", len); 3761 BT_ERR("add_remote_oob_data: invalid length of %u bytes", len);
3761 err = cmd_status(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA, 3762 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
3762 MGMT_STATUS_INVALID_PARAMS); 3763 MGMT_STATUS_INVALID_PARAMS);
3763 } 3764 }
3764 3765
3765unlock: 3766unlock:
@@ -4352,8 +4353,8 @@ static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data,
4352 source = __le16_to_cpu(cp->source); 4353 source = __le16_to_cpu(cp->source);
4353 4354
4354 if (source > 0x0002) 4355 if (source > 0x0002)
4355 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEVICE_ID, 4356 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEVICE_ID,
4356 MGMT_STATUS_INVALID_PARAMS); 4357 MGMT_STATUS_INVALID_PARAMS);
4357 4358
4358 hci_dev_lock(hdev); 4359 hci_dev_lock(hdev);
4359 4360
@@ -4418,12 +4419,12 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
4418 4419
4419 status = mgmt_le_support(hdev); 4420 status = mgmt_le_support(hdev);
4420 if (status) 4421 if (status)
4421 return cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, 4422 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
4422 status); 4423 status);
4423 4424
4424 if (cp->val != 0x00 && cp->val != 0x01) 4425 if (cp->val != 0x00 && cp->val != 0x01)
4425 return cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, 4426 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
4426 MGMT_STATUS_INVALID_PARAMS); 4427 MGMT_STATUS_INVALID_PARAMS);
4427 4428
4428 hci_dev_lock(hdev); 4429 hci_dev_lock(hdev);
4429 4430
@@ -4458,8 +4459,8 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
4458 4459
4459 if (mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev) || 4460 if (mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev) ||
4460 mgmt_pending_find(MGMT_OP_SET_LE, hdev)) { 4461 mgmt_pending_find(MGMT_OP_SET_LE, hdev)) {
4461 err = cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, 4462 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
4462 MGMT_STATUS_BUSY); 4463 MGMT_STATUS_BUSY);
4463 goto unlock; 4464 goto unlock;
4464 } 4465 }
4465 4466
@@ -4494,24 +4495,24 @@ static int set_static_address(struct sock *sk, struct hci_dev *hdev,
4494 BT_DBG("%s", hdev->name); 4495 BT_DBG("%s", hdev->name);
4495 4496
4496 if (!lmp_le_capable(hdev)) 4497 if (!lmp_le_capable(hdev))
4497 return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS, 4498 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
4498 MGMT_STATUS_NOT_SUPPORTED); 4499 MGMT_STATUS_NOT_SUPPORTED);
4499 4500
4500 if (hdev_is_powered(hdev)) 4501 if (hdev_is_powered(hdev))
4501 return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS, 4502 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
4502 MGMT_STATUS_REJECTED); 4503 MGMT_STATUS_REJECTED);
4503 4504
4504 if (bacmp(&cp->bdaddr, BDADDR_ANY)) { 4505 if (bacmp(&cp->bdaddr, BDADDR_ANY)) {
4505 if (!bacmp(&cp->bdaddr, BDADDR_NONE)) 4506 if (!bacmp(&cp->bdaddr, BDADDR_NONE))
4506 return cmd_status(sk, hdev->id, 4507 return mgmt_cmd_status(sk, hdev->id,
4507 MGMT_OP_SET_STATIC_ADDRESS, 4508 MGMT_OP_SET_STATIC_ADDRESS,
4508 MGMT_STATUS_INVALID_PARAMS); 4509 MGMT_STATUS_INVALID_PARAMS);
4509 4510
4510 /* Two most significant bits shall be set */ 4511 /* Two most significant bits shall be set */
4511 if ((cp->bdaddr.b[5] & 0xc0) != 0xc0) 4512 if ((cp->bdaddr.b[5] & 0xc0) != 0xc0)
4512 return cmd_status(sk, hdev->id, 4513 return mgmt_cmd_status(sk, hdev->id,
4513 MGMT_OP_SET_STATIC_ADDRESS, 4514 MGMT_OP_SET_STATIC_ADDRESS,
4514 MGMT_STATUS_INVALID_PARAMS); 4515 MGMT_STATUS_INVALID_PARAMS);
4515 } 4516 }
4516 4517
4517 hci_dev_lock(hdev); 4518 hci_dev_lock(hdev);
@@ -4539,24 +4540,24 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev,
4539 BT_DBG("%s", hdev->name); 4540 BT_DBG("%s", hdev->name);
4540 4541
4541 if (!lmp_le_capable(hdev)) 4542 if (!lmp_le_capable(hdev))
4542 return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 4543 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
4543 MGMT_STATUS_NOT_SUPPORTED); 4544 MGMT_STATUS_NOT_SUPPORTED);
4544 4545
4545 interval = __le16_to_cpu(cp->interval); 4546 interval = __le16_to_cpu(cp->interval);
4546 4547
4547 if (interval < 0x0004 || interval > 0x4000) 4548 if (interval < 0x0004 || interval > 0x4000)
4548 return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 4549 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
4549 MGMT_STATUS_INVALID_PARAMS); 4550 MGMT_STATUS_INVALID_PARAMS);
4550 4551
4551 window = __le16_to_cpu(cp->window); 4552 window = __le16_to_cpu(cp->window);
4552 4553
4553 if (window < 0x0004 || window > 0x4000) 4554 if (window < 0x0004 || window > 0x4000)
4554 return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 4555 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
4555 MGMT_STATUS_INVALID_PARAMS); 4556 MGMT_STATUS_INVALID_PARAMS);
4556 4557
4557 if (window > interval) 4558 if (window > interval)
4558 return cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS, 4559 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SCAN_PARAMS,
4559 MGMT_STATUS_INVALID_PARAMS); 4560 MGMT_STATUS_INVALID_PARAMS);
4560 4561
4561 hci_dev_lock(hdev); 4562 hci_dev_lock(hdev);
4562 4563
@@ -4599,8 +4600,8 @@ static void fast_connectable_complete(struct hci_dev *hdev, u8 status,
4599 goto unlock; 4600 goto unlock;
4600 4601
4601 if (status) { 4602 if (status) {
4602 cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4603 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4603 mgmt_status(status)); 4604 mgmt_status(status));
4604 } else { 4605 } else {
4605 struct mgmt_mode *cp = cmd->param; 4606 struct mgmt_mode *cp = cmd->param;
4606 4607
@@ -4631,26 +4632,26 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
4631 4632
4632 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) || 4633 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) ||
4633 hdev->hci_ver < BLUETOOTH_VER_1_2) 4634 hdev->hci_ver < BLUETOOTH_VER_1_2)
4634 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4635 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4635 MGMT_STATUS_NOT_SUPPORTED); 4636 MGMT_STATUS_NOT_SUPPORTED);
4636 4637
4637 if (cp->val != 0x00 && cp->val != 0x01) 4638 if (cp->val != 0x00 && cp->val != 0x01)
4638 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4639 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4639 MGMT_STATUS_INVALID_PARAMS); 4640 MGMT_STATUS_INVALID_PARAMS);
4640 4641
4641 if (!hdev_is_powered(hdev)) 4642 if (!hdev_is_powered(hdev))
4642 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4643 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4643 MGMT_STATUS_NOT_POWERED); 4644 MGMT_STATUS_NOT_POWERED);
4644 4645
4645 if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) 4646 if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
4646 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4647 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4647 MGMT_STATUS_REJECTED); 4648 MGMT_STATUS_REJECTED);
4648 4649
4649 hci_dev_lock(hdev); 4650 hci_dev_lock(hdev);
4650 4651
4651 if (mgmt_pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) { 4652 if (mgmt_pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) {
4652 err = cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4653 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4653 MGMT_STATUS_BUSY); 4654 MGMT_STATUS_BUSY);
4654 goto unlock; 4655 goto unlock;
4655 } 4656 }
4656 4657
@@ -4673,8 +4674,8 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
4673 4674
4674 err = hci_req_run(&req, fast_connectable_complete); 4675 err = hci_req_run(&req, fast_connectable_complete);
4675 if (err < 0) { 4676 if (err < 0) {
4676 err = cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4677 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4677 MGMT_STATUS_FAILED); 4678 MGMT_STATUS_FAILED);
4678 mgmt_pending_remove(cmd); 4679 mgmt_pending_remove(cmd);
4679 } 4680 }
4680 4681
@@ -4704,7 +4705,7 @@ static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode)
4704 */ 4705 */
4705 clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); 4706 clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
4706 4707
4707 cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); 4708 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
4708 } else { 4709 } else {
4709 send_settings_rsp(cmd->sk, MGMT_OP_SET_BREDR, hdev); 4710 send_settings_rsp(cmd->sk, MGMT_OP_SET_BREDR, hdev);
4710 new_settings(hdev, cmd->sk); 4711 new_settings(hdev, cmd->sk);
@@ -4726,16 +4727,16 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
4726 BT_DBG("request for %s", hdev->name); 4727 BT_DBG("request for %s", hdev->name);
4727 4728
4728 if (!lmp_bredr_capable(hdev) || !lmp_le_capable(hdev)) 4729 if (!lmp_bredr_capable(hdev) || !lmp_le_capable(hdev))
4729 return cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4730 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4730 MGMT_STATUS_NOT_SUPPORTED); 4731 MGMT_STATUS_NOT_SUPPORTED);
4731 4732
4732 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) 4733 if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags))
4733 return cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4734 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4734 MGMT_STATUS_REJECTED); 4735 MGMT_STATUS_REJECTED);
4735 4736
4736 if (cp->val != 0x00 && cp->val != 0x01) 4737 if (cp->val != 0x00 && cp->val != 0x01)
4737 return cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4738 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4738 MGMT_STATUS_INVALID_PARAMS); 4739 MGMT_STATUS_INVALID_PARAMS);
4739 4740
4740 hci_dev_lock(hdev); 4741 hci_dev_lock(hdev);
4741 4742
@@ -4765,8 +4766,8 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
4765 4766
4766 /* Reject disabling when powered on */ 4767 /* Reject disabling when powered on */
4767 if (!cp->val) { 4768 if (!cp->val) {
4768 err = cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4769 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4769 MGMT_STATUS_REJECTED); 4770 MGMT_STATUS_REJECTED);
4770 goto unlock; 4771 goto unlock;
4771 } else { 4772 } else {
4772 /* When configuring a dual-mode controller to operate 4773 /* When configuring a dual-mode controller to operate
@@ -4786,15 +4787,15 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
4786 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) && 4787 if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) &&
4787 (bacmp(&hdev->static_addr, BDADDR_ANY) || 4788 (bacmp(&hdev->static_addr, BDADDR_ANY) ||
4788 test_bit(HCI_SC_ENABLED, &hdev->dev_flags))) { 4789 test_bit(HCI_SC_ENABLED, &hdev->dev_flags))) {
4789 err = cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4790 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4790 MGMT_STATUS_REJECTED); 4791 MGMT_STATUS_REJECTED);
4791 goto unlock; 4792 goto unlock;
4792 } 4793 }
4793 } 4794 }
4794 4795
4795 if (mgmt_pending_find(MGMT_OP_SET_BREDR, hdev)) { 4796 if (mgmt_pending_find(MGMT_OP_SET_BREDR, hdev)) {
4796 err = cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4797 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4797 MGMT_STATUS_BUSY); 4798 MGMT_STATUS_BUSY);
4798 goto unlock; 4799 goto unlock;
4799 } 4800 }
4800 4801
@@ -4842,8 +4843,8 @@ static void sc_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode)
4842 goto unlock; 4843 goto unlock;
4843 4844
4844 if (status) { 4845 if (status) {
4845 cmd_status(cmd->sk, cmd->index, cmd->opcode, 4846 mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode,
4846 mgmt_status(status)); 4847 mgmt_status(status));
4847 goto remove; 4848 goto remove;
4848 } 4849 }
4849 4850
@@ -4886,17 +4887,17 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev,
4886 4887
4887 if (!lmp_sc_capable(hdev) && 4888 if (!lmp_sc_capable(hdev) &&
4888 !test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) 4889 !test_bit(HCI_LE_ENABLED, &hdev->dev_flags))
4889 return cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, 4890 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN,
4890 MGMT_STATUS_NOT_SUPPORTED); 4891 MGMT_STATUS_NOT_SUPPORTED);
4891 4892
4892 if (test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) && 4893 if (test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) &&
4893 lmp_sc_capable(hdev) && 4894 lmp_sc_capable(hdev) &&
4894 !test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) 4895 !test_bit(HCI_SSP_ENABLED, &hdev->dev_flags))
4895 return cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, 4896 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN,
4896 MGMT_STATUS_REJECTED); 4897 MGMT_STATUS_REJECTED);
4897 4898
4898 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02) 4899 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02)
4899 return cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, 4900 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN,
4900 MGMT_STATUS_INVALID_PARAMS); 4901 MGMT_STATUS_INVALID_PARAMS);
4901 4902
4902 hci_dev_lock(hdev); 4903 hci_dev_lock(hdev);
@@ -4929,8 +4930,8 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev,
4929 } 4930 }
4930 4931
4931 if (mgmt_pending_find(MGMT_OP_SET_SECURE_CONN, hdev)) { 4932 if (mgmt_pending_find(MGMT_OP_SET_SECURE_CONN, hdev)) {
4932 err = cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, 4933 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN,
4933 MGMT_STATUS_BUSY); 4934 MGMT_STATUS_BUSY);
4934 goto failed; 4935 goto failed;
4935 } 4936 }
4936 4937
@@ -4971,8 +4972,8 @@ static int set_debug_keys(struct sock *sk, struct hci_dev *hdev,
4971 BT_DBG("request for %s", hdev->name); 4972 BT_DBG("request for %s", hdev->name);
4972 4973
4973 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02) 4974 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02)
4974 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEBUG_KEYS, 4975 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DEBUG_KEYS,
4975 MGMT_STATUS_INVALID_PARAMS); 4976 MGMT_STATUS_INVALID_PARAMS);
4976 4977
4977 hci_dev_lock(hdev); 4978 hci_dev_lock(hdev);
4978 4979
@@ -5019,16 +5020,16 @@ static int set_privacy(struct sock *sk, struct hci_dev *hdev, void *cp_data,
5019 BT_DBG("request for %s", hdev->name); 5020 BT_DBG("request for %s", hdev->name);
5020 5021
5021 if (!lmp_le_capable(hdev)) 5022 if (!lmp_le_capable(hdev))
5022 return cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, 5023 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY,
5023 MGMT_STATUS_NOT_SUPPORTED); 5024 MGMT_STATUS_NOT_SUPPORTED);
5024 5025
5025 if (cp->privacy != 0x00 && cp->privacy != 0x01) 5026 if (cp->privacy != 0x00 && cp->privacy != 0x01)
5026 return cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, 5027 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY,
5027 MGMT_STATUS_INVALID_PARAMS); 5028 MGMT_STATUS_INVALID_PARAMS);
5028 5029
5029 if (hdev_is_powered(hdev)) 5030 if (hdev_is_powered(hdev))
5030 return cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY, 5031 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PRIVACY,
5031 MGMT_STATUS_REJECTED); 5032 MGMT_STATUS_REJECTED);
5032 5033
5033 hci_dev_lock(hdev); 5034 hci_dev_lock(hdev);
5034 5035
@@ -5087,22 +5088,22 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
5087 BT_DBG("request for %s", hdev->name); 5088 BT_DBG("request for %s", hdev->name);
5088 5089
5089 if (!lmp_le_capable(hdev)) 5090 if (!lmp_le_capable(hdev))
5090 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, 5091 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS,
5091 MGMT_STATUS_NOT_SUPPORTED); 5092 MGMT_STATUS_NOT_SUPPORTED);
5092 5093
5093 irk_count = __le16_to_cpu(cp->irk_count); 5094 irk_count = __le16_to_cpu(cp->irk_count);
5094 if (irk_count > max_irk_count) { 5095 if (irk_count > max_irk_count) {
5095 BT_ERR("load_irks: too big irk_count value %u", irk_count); 5096 BT_ERR("load_irks: too big irk_count value %u", irk_count);
5096 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, 5097 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS,
5097 MGMT_STATUS_INVALID_PARAMS); 5098 MGMT_STATUS_INVALID_PARAMS);
5098 } 5099 }
5099 5100
5100 expected_len = sizeof(*cp) + irk_count * sizeof(struct mgmt_irk_info); 5101 expected_len = sizeof(*cp) + irk_count * sizeof(struct mgmt_irk_info);
5101 if (expected_len != len) { 5102 if (expected_len != len) {
5102 BT_ERR("load_irks: expected %u bytes, got %u bytes", 5103 BT_ERR("load_irks: expected %u bytes, got %u bytes",
5103 expected_len, len); 5104 expected_len, len);
5104 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS, 5105 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_IRKS,
5105 MGMT_STATUS_INVALID_PARAMS); 5106 MGMT_STATUS_INVALID_PARAMS);
5106 } 5107 }
5107 5108
5108 BT_DBG("%s irk_count %u", hdev->name, irk_count); 5109 BT_DBG("%s irk_count %u", hdev->name, irk_count);
@@ -5111,9 +5112,9 @@ static int load_irks(struct sock *sk, struct hci_dev *hdev, void *cp_data,
5111 struct mgmt_irk_info *key = &cp->irks[i]; 5112 struct mgmt_irk_info *key = &cp->irks[i];
5112 5113
5113 if (!irk_is_valid(key)) 5114 if (!irk_is_valid(key))
5114 return cmd_status(sk, hdev->id, 5115 return mgmt_cmd_status(sk, hdev->id,
5115 MGMT_OP_LOAD_IRKS, 5116 MGMT_OP_LOAD_IRKS,
5116 MGMT_STATUS_INVALID_PARAMS); 5117 MGMT_STATUS_INVALID_PARAMS);
5117 } 5118 }
5118 5119
5119 hci_dev_lock(hdev); 5120 hci_dev_lock(hdev);
@@ -5173,14 +5174,14 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
5173 BT_DBG("request for %s", hdev->name); 5174 BT_DBG("request for %s", hdev->name);
5174 5175
5175 if (!lmp_le_capable(hdev)) 5176 if (!lmp_le_capable(hdev))
5176 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, 5177 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
5177 MGMT_STATUS_NOT_SUPPORTED); 5178 MGMT_STATUS_NOT_SUPPORTED);
5178 5179
5179 key_count = __le16_to_cpu(cp->key_count); 5180 key_count = __le16_to_cpu(cp->key_count);
5180 if (key_count > max_key_count) { 5181 if (key_count > max_key_count) {
5181 BT_ERR("load_ltks: too big key_count value %u", key_count); 5182 BT_ERR("load_ltks: too big key_count value %u", key_count);
5182 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, 5183 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
5183 MGMT_STATUS_INVALID_PARAMS); 5184 MGMT_STATUS_INVALID_PARAMS);
5184 } 5185 }
5185 5186
5186 expected_len = sizeof(*cp) + key_count * 5187 expected_len = sizeof(*cp) + key_count *
@@ -5188,8 +5189,8 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
5188 if (expected_len != len) { 5189 if (expected_len != len) {
5189 BT_ERR("load_keys: expected %u bytes, got %u bytes", 5190 BT_ERR("load_keys: expected %u bytes, got %u bytes",
5190 expected_len, len); 5191 expected_len, len);
5191 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS, 5192 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
5192 MGMT_STATUS_INVALID_PARAMS); 5193 MGMT_STATUS_INVALID_PARAMS);
5193 } 5194 }
5194 5195
5195 BT_DBG("%s key_count %u", hdev->name, key_count); 5196 BT_DBG("%s key_count %u", hdev->name, key_count);
@@ -5198,9 +5199,9 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
5198 struct mgmt_ltk_info *key = &cp->keys[i]; 5199 struct mgmt_ltk_info *key = &cp->keys[i];
5199 5200
5200 if (!ltk_is_valid(key)) 5201 if (!ltk_is_valid(key))
5201 return cmd_status(sk, hdev->id, 5202 return mgmt_cmd_status(sk, hdev->id,
5202 MGMT_OP_LOAD_LONG_TERM_KEYS, 5203 MGMT_OP_LOAD_LONG_TERM_KEYS,
5203 MGMT_STATUS_INVALID_PARAMS); 5204 MGMT_STATUS_INVALID_PARAMS);
5204 } 5205 }
5205 5206
5206 hci_dev_lock(hdev); 5207 hci_dev_lock(hdev);
@@ -5945,15 +5946,15 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
5945 int i; 5946 int i;
5946 5947
5947 if (!lmp_le_capable(hdev)) 5948 if (!lmp_le_capable(hdev))
5948 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, 5949 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM,
5949 MGMT_STATUS_NOT_SUPPORTED); 5950 MGMT_STATUS_NOT_SUPPORTED);
5950 5951
5951 param_count = __le16_to_cpu(cp->param_count); 5952 param_count = __le16_to_cpu(cp->param_count);
5952 if (param_count > max_param_count) { 5953 if (param_count > max_param_count) {
5953 BT_ERR("load_conn_param: too big param_count value %u", 5954 BT_ERR("load_conn_param: too big param_count value %u",
5954 param_count); 5955 param_count);
5955 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, 5956 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM,
5956 MGMT_STATUS_INVALID_PARAMS); 5957 MGMT_STATUS_INVALID_PARAMS);
5957 } 5958 }
5958 5959
5959 expected_len = sizeof(*cp) + param_count * 5960 expected_len = sizeof(*cp) + param_count *
@@ -5961,8 +5962,8 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
5961 if (expected_len != len) { 5962 if (expected_len != len) {
5962 BT_ERR("load_conn_param: expected %u bytes, got %u bytes", 5963 BT_ERR("load_conn_param: expected %u bytes, got %u bytes",
5963 expected_len, len); 5964 expected_len, len);
5964 return cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM, 5965 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_LOAD_CONN_PARAM,
5965 MGMT_STATUS_INVALID_PARAMS); 5966 MGMT_STATUS_INVALID_PARAMS);
5966 } 5967 }
5967 5968
5968 BT_DBG("%s param_count %u", hdev->name, param_count); 5969 BT_DBG("%s param_count %u", hdev->name, param_count);
@@ -6030,16 +6031,16 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev,
6030 BT_DBG("%s", hdev->name); 6031 BT_DBG("%s", hdev->name);
6031 6032
6032 if (hdev_is_powered(hdev)) 6033 if (hdev_is_powered(hdev))
6033 return cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, 6034 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG,
6034 MGMT_STATUS_REJECTED); 6035 MGMT_STATUS_REJECTED);
6035 6036
6036 if (cp->config != 0x00 && cp->config != 0x01) 6037 if (cp->config != 0x00 && cp->config != 0x01)
6037 return cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, 6038 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG,
6038 MGMT_STATUS_INVALID_PARAMS); 6039 MGMT_STATUS_INVALID_PARAMS);
6039 6040
6040 if (!test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks)) 6041 if (!test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks))
6041 return cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG, 6042 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXTERNAL_CONFIG,
6042 MGMT_STATUS_NOT_SUPPORTED); 6043 MGMT_STATUS_NOT_SUPPORTED);
6043 6044
6044 hci_dev_lock(hdev); 6045 hci_dev_lock(hdev);
6045 6046
@@ -6088,16 +6089,16 @@ static int set_public_address(struct sock *sk, struct hci_dev *hdev,
6088 BT_DBG("%s", hdev->name); 6089 BT_DBG("%s", hdev->name);
6089 6090
6090 if (hdev_is_powered(hdev)) 6091 if (hdev_is_powered(hdev))
6091 return cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, 6092 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS,
6092 MGMT_STATUS_REJECTED); 6093 MGMT_STATUS_REJECTED);
6093 6094
6094 if (!bacmp(&cp->bdaddr, BDADDR_ANY)) 6095 if (!bacmp(&cp->bdaddr, BDADDR_ANY))
6095 return cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, 6096 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS,
6096 MGMT_STATUS_INVALID_PARAMS); 6097 MGMT_STATUS_INVALID_PARAMS);
6097 6098
6098 if (!hdev->set_bdaddr) 6099 if (!hdev->set_bdaddr)
6099 return cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS, 6100 return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_PUBLIC_ADDRESS,
6100 MGMT_STATUS_NOT_SUPPORTED); 6101 MGMT_STATUS_NOT_SUPPORTED);
6101 6102
6102 hci_dev_lock(hdev); 6103 hci_dev_lock(hdev);
6103 6104
@@ -6244,8 +6245,8 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
6244 if (opcode >= chan->handler_count || 6245 if (opcode >= chan->handler_count ||
6245 chan->handlers[opcode].func == NULL) { 6246 chan->handlers[opcode].func == NULL) {
6246 BT_DBG("Unknown op %u", opcode); 6247 BT_DBG("Unknown op %u", opcode);
6247 err = cmd_status(sk, index, opcode, 6248 err = mgmt_cmd_status(sk, index, opcode,
6248 MGMT_STATUS_UNKNOWN_COMMAND); 6249 MGMT_STATUS_UNKNOWN_COMMAND);
6249 goto done; 6250 goto done;
6250 } 6251 }
6251 6252
@@ -6254,39 +6255,39 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
6254 if (index != MGMT_INDEX_NONE) { 6255 if (index != MGMT_INDEX_NONE) {
6255 hdev = hci_dev_get(index); 6256 hdev = hci_dev_get(index);
6256 if (!hdev) { 6257 if (!hdev) {
6257 err = cmd_status(sk, index, opcode, 6258 err = mgmt_cmd_status(sk, index, opcode,
6258 MGMT_STATUS_INVALID_INDEX); 6259 MGMT_STATUS_INVALID_INDEX);
6259 goto done; 6260 goto done;
6260 } 6261 }
6261 6262
6262 if (test_bit(HCI_SETUP, &hdev->dev_flags) || 6263 if (test_bit(HCI_SETUP, &hdev->dev_flags) ||
6263 test_bit(HCI_CONFIG, &hdev->dev_flags) || 6264 test_bit(HCI_CONFIG, &hdev->dev_flags) ||
6264 test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) { 6265 test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) {
6265 err = cmd_status(sk, index, opcode, 6266 err = mgmt_cmd_status(sk, index, opcode,
6266 MGMT_STATUS_INVALID_INDEX); 6267 MGMT_STATUS_INVALID_INDEX);
6267 goto done; 6268 goto done;
6268 } 6269 }
6269 6270
6270 if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) && 6271 if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags) &&
6271 !(handler->flags & HCI_MGMT_UNCONFIGURED)) { 6272 !(handler->flags & HCI_MGMT_UNCONFIGURED)) {
6272 err = cmd_status(sk, index, opcode, 6273 err = mgmt_cmd_status(sk, index, opcode,
6273 MGMT_STATUS_INVALID_INDEX); 6274 MGMT_STATUS_INVALID_INDEX);
6274 goto done; 6275 goto done;
6275 } 6276 }
6276 } 6277 }
6277 6278
6278 no_hdev = (handler->flags & HCI_MGMT_NO_HDEV); 6279 no_hdev = (handler->flags & HCI_MGMT_NO_HDEV);
6279 if (no_hdev != !hdev) { 6280 if (no_hdev != !hdev) {
6280 err = cmd_status(sk, index, opcode, 6281 err = mgmt_cmd_status(sk, index, opcode,
6281 MGMT_STATUS_INVALID_INDEX); 6282 MGMT_STATUS_INVALID_INDEX);
6282 goto done; 6283 goto done;
6283 } 6284 }
6284 6285
6285 var_len = (handler->flags & HCI_MGMT_VAR_LEN); 6286 var_len = (handler->flags & HCI_MGMT_VAR_LEN);
6286 if ((var_len && len < handler->data_len) || 6287 if ((var_len && len < handler->data_len) ||
6287 (!var_len && len != handler->data_len)) { 6288 (!var_len && len != handler->data_len)) {
6288 err = cmd_status(sk, index, opcode, 6289 err = mgmt_cmd_status(sk, index, opcode,
6289 MGMT_STATUS_INVALID_PARAMS); 6290 MGMT_STATUS_INVALID_PARAMS);
6290 goto done; 6291 goto done;
6291 } 6292 }
6292 6293
@@ -6526,7 +6527,7 @@ void mgmt_set_powered_failed(struct hci_dev *hdev, int err)
6526 else 6527 else
6527 status = MGMT_STATUS_FAILED; 6528 status = MGMT_STATUS_FAILED;
6528 6529
6529 cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status); 6530 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status);
6530 6531
6531 mgmt_pending_remove(cmd); 6532 mgmt_pending_remove(cmd);
6532} 6533}
@@ -7201,8 +7202,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
7201 return; 7202 return;
7202 7203
7203 if (status) { 7204 if (status) {
7204 cmd_status(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, 7205 mgmt_cmd_status(cmd->sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA,
7205 mgmt_status(status)); 7206 mgmt_status(status));
7206 } else { 7207 } else {
7207 struct mgmt_rp_read_local_oob_data rp; 7208 struct mgmt_rp_read_local_oob_data rp;
7208 size_t rp_size = sizeof(rp); 7209 size_t rp_size = sizeof(rp);