diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-19 03:14:51 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-04-19 09:31:58 -0400 |
commit | 07dc93dd14957dc1faba08f0aadd27b082e35ba2 (patch) | |
tree | b81c188a4a404bb5bc19d36fa6590244f7e770b2 | |
parent | faff7f74d2f945527ef92d68e501d9e8adaca750 (diff) |
Bluetooth: Fix HCI command send functions to use const specifier
All HCI command send functions that take a pointer to the command
parameters do not need to modify the content in any way (they merely
copy the data to an skb). Therefore, the parameter type should be
declared const. This also allows passing already const parameters to
these APIs which previously would have generated a compiler warning.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 14 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 16 |
2 files changed, 17 insertions, 13 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 80d718a9b31f..35a57cd1704c 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1081,17 +1081,19 @@ struct hci_request { | |||
1081 | 1081 | ||
1082 | void hci_req_init(struct hci_request *req, struct hci_dev *hdev); | 1082 | void hci_req_init(struct hci_request *req, struct hci_dev *hdev); |
1083 | int hci_req_run(struct hci_request *req, hci_req_complete_t complete); | 1083 | int hci_req_run(struct hci_request *req, hci_req_complete_t complete); |
1084 | void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, void *param); | 1084 | void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, |
1085 | void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, void *param, | 1085 | const void *param); |
1086 | u8 event); | 1086 | void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, |
1087 | const void *param, u8 event); | ||
1087 | void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); | 1088 | void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); |
1088 | 1089 | ||
1089 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, | 1090 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
1090 | void *param, u32 timeout); | 1091 | const void *param, u32 timeout); |
1091 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, | 1092 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, |
1092 | void *param, u8 event, u32 timeout); | 1093 | const void *param, u8 event, u32 timeout); |
1093 | 1094 | ||
1094 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 1095 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, |
1096 | const void *param); | ||
1095 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 1097 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
1096 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 1098 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
1097 | 1099 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index ce82265f5619..215db0801a65 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -134,7 +134,7 @@ failed: | |||
134 | } | 134 | } |
135 | 135 | ||
136 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, | 136 | struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, |
137 | void *param, u8 event, u32 timeout) | 137 | const void *param, u8 event, u32 timeout) |
138 | { | 138 | { |
139 | DECLARE_WAITQUEUE(wait, current); | 139 | DECLARE_WAITQUEUE(wait, current); |
140 | struct hci_request req; | 140 | struct hci_request req; |
@@ -188,7 +188,7 @@ struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, | |||
188 | EXPORT_SYMBOL(__hci_cmd_sync_ev); | 188 | EXPORT_SYMBOL(__hci_cmd_sync_ev); |
189 | 189 | ||
190 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, | 190 | struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
191 | void *param, u32 timeout) | 191 | const void *param, u32 timeout) |
192 | { | 192 | { |
193 | return __hci_cmd_sync_ev(hdev, opcode, plen, param, 0, timeout); | 193 | return __hci_cmd_sync_ev(hdev, opcode, plen, param, 0, timeout); |
194 | } | 194 | } |
@@ -2602,7 +2602,7 @@ int hci_req_run(struct hci_request *req, hci_req_complete_t complete) | |||
2602 | } | 2602 | } |
2603 | 2603 | ||
2604 | static struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, | 2604 | static struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, |
2605 | u32 plen, void *param) | 2605 | u32 plen, const void *param) |
2606 | { | 2606 | { |
2607 | int len = HCI_COMMAND_HDR_SIZE + plen; | 2607 | int len = HCI_COMMAND_HDR_SIZE + plen; |
2608 | struct hci_command_hdr *hdr; | 2608 | struct hci_command_hdr *hdr; |
@@ -2628,7 +2628,8 @@ static struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, | |||
2628 | } | 2628 | } |
2629 | 2629 | ||
2630 | /* Send HCI command */ | 2630 | /* Send HCI command */ |
2631 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param) | 2631 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, |
2632 | const void *param) | ||
2632 | { | 2633 | { |
2633 | struct sk_buff *skb; | 2634 | struct sk_buff *skb; |
2634 | 2635 | ||
@@ -2652,8 +2653,8 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param) | |||
2652 | } | 2653 | } |
2653 | 2654 | ||
2654 | /* Queue a command to an asynchronous HCI request */ | 2655 | /* Queue a command to an asynchronous HCI request */ |
2655 | void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, void *param, | 2656 | void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, |
2656 | u8 event) | 2657 | const void *param, u8 event) |
2657 | { | 2658 | { |
2658 | struct hci_dev *hdev = req->hdev; | 2659 | struct hci_dev *hdev = req->hdev; |
2659 | struct sk_buff *skb; | 2660 | struct sk_buff *skb; |
@@ -2682,7 +2683,8 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, void *param, | |||
2682 | skb_queue_tail(&req->cmd_q, skb); | 2683 | skb_queue_tail(&req->cmd_q, skb); |
2683 | } | 2684 | } |
2684 | 2685 | ||
2685 | void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, void *param) | 2686 | void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, |
2687 | const void *param) | ||
2686 | { | 2688 | { |
2687 | hci_req_add_ev(req, opcode, plen, param, 0); | 2689 | hci_req_add_ev(req, opcode, plen, param, 0); |
2688 | } | 2690 | } |