diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-09 08:56:11 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-13 10:01:36 -0500 |
commit | 88c1fe4ba55c7245ad2f3c81689f854287875121 (patch) | |
tree | 69447c418d6f4560df19bc1a69a98a49cda0d4c9 /net/bluetooth | |
parent | 664ce4cc293cd6c76236617f78689d0e03e69287 (diff) |
Bluetooth: Add address type to mgmt blacklist messages
This patch updates the implmentation for mgmt_block_device and
mgmt_unblock_device and their corresponding events to match the latest
API specification.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 8 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 14 |
3 files changed, 14 insertions, 12 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3d09f4b4ca68..9ada16449aed 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1489,7 +1489,7 @@ int hci_blacklist_clear(struct hci_dev *hdev) | |||
1489 | return 0; | 1489 | return 0; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr) | 1492 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) |
1493 | { | 1493 | { |
1494 | struct bdaddr_list *entry; | 1494 | struct bdaddr_list *entry; |
1495 | 1495 | ||
@@ -1507,10 +1507,10 @@ int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
1507 | 1507 | ||
1508 | list_add(&entry->list, &hdev->blacklist); | 1508 | list_add(&entry->list, &hdev->blacklist); |
1509 | 1509 | ||
1510 | return mgmt_device_blocked(hdev, bdaddr); | 1510 | return mgmt_device_blocked(hdev, bdaddr, type); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr) | 1513 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) |
1514 | { | 1514 | { |
1515 | struct bdaddr_list *entry; | 1515 | struct bdaddr_list *entry; |
1516 | 1516 | ||
@@ -1524,7 +1524,7 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
1524 | list_del(&entry->list); | 1524 | list_del(&entry->list); |
1525 | kfree(entry); | 1525 | kfree(entry); |
1526 | 1526 | ||
1527 | return mgmt_device_unblocked(hdev, bdaddr); | 1527 | return mgmt_device_unblocked(hdev, bdaddr, type); |
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | static void hci_clear_adv_cache(struct work_struct *work) | 1530 | static void hci_clear_adv_cache(struct work_struct *work) |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 0dcc96266779..9e854d9fb460 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -190,7 +190,7 @@ static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg) | |||
190 | 190 | ||
191 | hci_dev_lock(hdev); | 191 | hci_dev_lock(hdev); |
192 | 192 | ||
193 | err = hci_blacklist_add(hdev, &bdaddr); | 193 | err = hci_blacklist_add(hdev, &bdaddr, 0); |
194 | 194 | ||
195 | hci_dev_unlock(hdev); | 195 | hci_dev_unlock(hdev); |
196 | 196 | ||
@@ -207,7 +207,7 @@ static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg) | |||
207 | 207 | ||
208 | hci_dev_lock(hdev); | 208 | hci_dev_lock(hdev); |
209 | 209 | ||
210 | err = hci_blacklist_del(hdev, &bdaddr); | 210 | err = hci_blacklist_del(hdev, &bdaddr, 0); |
211 | 211 | ||
212 | hci_dev_unlock(hdev); | 212 | hci_dev_unlock(hdev); |
213 | 213 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 763a447b2532..413a0b97c533 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2114,7 +2114,7 @@ static int block_device(struct sock *sk, u16 index, void *data, u16 len) | |||
2114 | 2114 | ||
2115 | hci_dev_lock(hdev); | 2115 | hci_dev_lock(hdev); |
2116 | 2116 | ||
2117 | err = hci_blacklist_add(hdev, &cp->bdaddr); | 2117 | err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type); |
2118 | if (err < 0) | 2118 | if (err < 0) |
2119 | err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, | 2119 | err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, |
2120 | MGMT_STATUS_FAILED); | 2120 | MGMT_STATUS_FAILED); |
@@ -2147,7 +2147,7 @@ static int unblock_device(struct sock *sk, u16 index, void *data, u16 len) | |||
2147 | 2147 | ||
2148 | hci_dev_lock(hdev); | 2148 | hci_dev_lock(hdev); |
2149 | 2149 | ||
2150 | err = hci_blacklist_del(hdev, &cp->bdaddr); | 2150 | err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type); |
2151 | 2151 | ||
2152 | if (err < 0) | 2152 | if (err < 0) |
2153 | err = cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, | 2153 | err = cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, |
@@ -3026,27 +3026,29 @@ int mgmt_discovering(struct hci_dev *hdev, u8 discovering) | |||
3026 | sizeof(discovering), NULL); | 3026 | sizeof(discovering), NULL); |
3027 | } | 3027 | } |
3028 | 3028 | ||
3029 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr) | 3029 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) |
3030 | { | 3030 | { |
3031 | struct pending_cmd *cmd; | 3031 | struct pending_cmd *cmd; |
3032 | struct mgmt_ev_device_blocked ev; | 3032 | struct mgmt_ev_device_blocked ev; |
3033 | 3033 | ||
3034 | cmd = mgmt_pending_find(MGMT_OP_BLOCK_DEVICE, hdev); | 3034 | cmd = mgmt_pending_find(MGMT_OP_BLOCK_DEVICE, hdev); |
3035 | 3035 | ||
3036 | bacpy(&ev.bdaddr, bdaddr); | 3036 | bacpy(&ev.addr.bdaddr, bdaddr); |
3037 | ev.addr.type = type; | ||
3037 | 3038 | ||
3038 | return mgmt_event(MGMT_EV_DEVICE_BLOCKED, hdev, &ev, sizeof(ev), | 3039 | return mgmt_event(MGMT_EV_DEVICE_BLOCKED, hdev, &ev, sizeof(ev), |
3039 | cmd ? cmd->sk : NULL); | 3040 | cmd ? cmd->sk : NULL); |
3040 | } | 3041 | } |
3041 | 3042 | ||
3042 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr) | 3043 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) |
3043 | { | 3044 | { |
3044 | struct pending_cmd *cmd; | 3045 | struct pending_cmd *cmd; |
3045 | struct mgmt_ev_device_unblocked ev; | 3046 | struct mgmt_ev_device_unblocked ev; |
3046 | 3047 | ||
3047 | cmd = mgmt_pending_find(MGMT_OP_UNBLOCK_DEVICE, hdev); | 3048 | cmd = mgmt_pending_find(MGMT_OP_UNBLOCK_DEVICE, hdev); |
3048 | 3049 | ||
3049 | bacpy(&ev.bdaddr, bdaddr); | 3050 | bacpy(&ev.addr.bdaddr, bdaddr); |
3051 | ev.addr.type = type; | ||
3050 | 3052 | ||
3051 | return mgmt_event(MGMT_EV_DEVICE_UNBLOCKED, hdev, &ev, sizeof(ev), | 3053 | return mgmt_event(MGMT_EV_DEVICE_UNBLOCKED, hdev, &ev, sizeof(ev), |
3052 | cmd ? cmd->sk : NULL); | 3054 | cmd ? cmd->sk : NULL); |