diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-08 13:40:14 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-09 09:33:26 -0500 |
commit | 744cf19eadcf4de914394e0eb227f94f4318f5e4 (patch) | |
tree | a8c06c43be956e5db8db1bc1e052b773626892c6 /include | |
parent | 4c659c3976e81f9def48993cd00988d53d7379f2 (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.h | 61 |
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 */ |
907 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 907 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
908 | int mgmt_index_added(u16 index); | 908 | int mgmt_index_added(struct hci_dev *hdev); |
909 | int mgmt_index_removed(u16 index); | 909 | int mgmt_index_removed(struct hci_dev *hdev); |
910 | int mgmt_powered(u16 index, u8 powered); | 910 | int mgmt_powered(struct hci_dev *hdev, u8 powered); |
911 | int mgmt_discoverable(u16 index, u8 discoverable); | 911 | int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); |
912 | int mgmt_connectable(u16 index, u8 connectable); | 912 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
913 | int mgmt_write_scan_failed(u16 index, u8 scan, u8 status); | 913 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
914 | int mgmt_new_link_key(u16 index, struct link_key *key, u8 persistent); | 914 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
915 | int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 type); | 915 | u8 persistent); |
916 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr, u8 type); | 916 | int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
917 | int mgmt_disconnect_failed(u16 index); | 917 | int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
918 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 type, u8 status); | 918 | int mgmt_disconnect_failed(struct hci_dev *hdev); |
919 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); | 919 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type, |
920 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
921 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
922 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value, | ||
923 | u8 confirm_hint); | ||
924 | int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | ||
925 | int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, | ||
926 | u8 status); | 920 | u8 status); |
927 | int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); | 921 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); |
928 | int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status); | 922 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
929 | int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer, | ||
930 | u8 status); | 923 | u8 status); |
931 | int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 type, u8 *dev_class, | 924 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
932 | s8 rssi, u8 *eir); | 925 | u8 status); |
933 | int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); | 926 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
934 | int mgmt_inquiry_failed(u16 index, u8 status); | 927 | __le32 value, u8 confirm_hint); |
935 | int mgmt_discovering(u16 index, u8 discovering); | 928 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
936 | int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr); | 929 | u8 status); |
937 | int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr); | 930 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, |
931 | bdaddr_t *bdaddr, u8 status); | ||
932 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | ||
933 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | ||
934 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, | ||
935 | u8 *randomizer, u8 status); | ||
936 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type, | ||
937 | u8 *dev_class, s8 rssi, u8 *eir); | ||
938 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); | ||
939 | int mgmt_inquiry_failed(struct hci_dev *hdev, u8 status); | ||
940 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); | ||
941 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
942 | int 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) |