aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-11-08 13:40:14 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-09 09:33:26 -0500
commit744cf19eadcf4de914394e0eb227f94f4318f5e4 (patch)
treea8c06c43be956e5db8db1bc1e052b773626892c6 /include
parent4c659c3976e81f9def48993cd00988d53d7379f2 (diff)
Bluetooth: Pass full hci_dev struct to mgmt callbacks
The current global pending command list in mgmt.c is racy. Possibly the simplest way to fix it is to have per-hci dev lists instead of a global one (all commands that need a pending struct are hci_dev specific). This way the list can be protected using the already existing per-hci dev lock. To enable this refactoring the first thing that needs to be done is to ensure that the mgmt functions have access to the hci_dev struct (instead of just the dev id). Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'include')
-rw-r--r--include/net/bluetooth/hci_core.h61
1 files changed, 33 insertions, 28 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e6071d0ea20f..0f35a3900e16 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -905,36 +905,41 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
905 905
906/* Management interface */ 906/* Management interface */
907int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 907int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
908int mgmt_index_added(u16 index); 908int mgmt_index_added(struct hci_dev *hdev);
909int mgmt_index_removed(u16 index); 909int mgmt_index_removed(struct hci_dev *hdev);
910int mgmt_powered(u16 index, u8 powered); 910int mgmt_powered(struct hci_dev *hdev, u8 powered);
911int mgmt_discoverable(u16 index, u8 discoverable); 911int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
912int mgmt_connectable(u16 index, u8 connectable); 912int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
913int mgmt_write_scan_failed(u16 index, u8 scan, u8 status); 913int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
914int mgmt_new_link_key(u16 index, struct link_key *key, u8 persistent); 914int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
915int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 type); 915 u8 persistent);
916int mgmt_disconnected(u16 index, bdaddr_t *bdaddr, u8 type); 916int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
917int mgmt_disconnect_failed(u16 index); 917int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
918int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 type, u8 status); 918int mgmt_disconnect_failed(struct hci_dev *hdev);
919int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); 919int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
920int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
921int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
922int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value,
923 u8 confirm_hint);
924int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
925int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,
926 u8 status); 920 u8 status);
927int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); 921int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
928int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status); 922int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
929int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer,
930 u8 status); 923 u8 status);
931int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 type, u8 *dev_class, 924int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
932 s8 rssi, u8 *eir); 925 u8 status);
933int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); 926int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
934int mgmt_inquiry_failed(u16 index, u8 status); 927 __le32 value, u8 confirm_hint);
935int mgmt_discovering(u16 index, u8 discovering); 928int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
936int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr); 929 u8 status);
937int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr); 930int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev,
931 bdaddr_t *bdaddr, u8 status);
932int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status);
933int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
934int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
935 u8 *randomizer, u8 status);
936int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type,
937 u8 *dev_class, s8 rssi, u8 *eir);
938int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name);
939int mgmt_inquiry_failed(struct hci_dev *hdev, u8 status);
940int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
941int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
942int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr);
938 943
939/* HCI info for socket */ 944/* HCI info for socket */
940#define hci_pi(sk) ((struct hci_pinfo *) sk) 945#define hci_pi(sk) ((struct hci_pinfo *) sk)