aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-03-30 16:21:02 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-03-30 17:20:53 -0400
commitdb6e3e8d016823c6b0f773c70a69ce65807d8a44 (patch)
tree89201941c7f39ed13d843de4c65ce8ab230e702e /net/bluetooth
parenta4368ff3ed3b57e4b5e36d83b75604f68bbcdaad (diff)
Bluetooth: Refactor HCI request variables into own struct
In order to shrink the size of bt_skb_cb, this patch moves the HCI request related variables into their own req_ctrl struct. Additionall the L2CAP and HCI request structs are placed inside the same union since they will never be used at the same time for the same skb. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c12
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/hci_request.c6
-rw-r--r--net/bluetooth/hci_sock.c2
4 files changed, 12 insertions, 12 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e6bfeb7b4415..246d7eca5d29 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3585,7 +3585,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
3585 /* Stand-alone HCI commands must be flagged as 3585 /* Stand-alone HCI commands must be flagged as
3586 * single-command requests. 3586 * single-command requests.
3587 */ 3587 */
3588 bt_cb(skb)->req_start = 1; 3588 bt_cb(skb)->req.start = true;
3589 3589
3590 skb_queue_tail(&hdev->cmd_q, skb); 3590 skb_queue_tail(&hdev->cmd_q, skb);
3591 queue_work(hdev->workqueue, &hdev->cmd_work); 3591 queue_work(hdev->workqueue, &hdev->cmd_work);
@@ -4263,7 +4263,7 @@ static bool hci_req_is_complete(struct hci_dev *hdev)
4263 if (!skb) 4263 if (!skb)
4264 return true; 4264 return true;
4265 4265
4266 return bt_cb(skb)->req_start; 4266 return bt_cb(skb)->req.start;
4267} 4267}
4268 4268
4269static void hci_resend_last(struct hci_dev *hdev) 4269static void hci_resend_last(struct hci_dev *hdev)
@@ -4323,14 +4323,14 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status)
4323 * command queue (hdev->cmd_q). 4323 * command queue (hdev->cmd_q).
4324 */ 4324 */
4325 if (hdev->sent_cmd) { 4325 if (hdev->sent_cmd) {
4326 req_complete = bt_cb(hdev->sent_cmd)->req_complete; 4326 req_complete = bt_cb(hdev->sent_cmd)->req.complete;
4327 4327
4328 if (req_complete) { 4328 if (req_complete) {
4329 /* We must set the complete callback to NULL to 4329 /* We must set the complete callback to NULL to
4330 * avoid calling the callback more than once if 4330 * avoid calling the callback more than once if
4331 * this function gets called again. 4331 * this function gets called again.
4332 */ 4332 */
4333 bt_cb(hdev->sent_cmd)->req_complete = NULL; 4333 bt_cb(hdev->sent_cmd)->req.complete = NULL;
4334 4334
4335 goto call_complete; 4335 goto call_complete;
4336 } 4336 }
@@ -4339,12 +4339,12 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status)
4339 /* Remove all pending commands belonging to this request */ 4339 /* Remove all pending commands belonging to this request */
4340 spin_lock_irqsave(&hdev->cmd_q.lock, flags); 4340 spin_lock_irqsave(&hdev->cmd_q.lock, flags);
4341 while ((skb = __skb_dequeue(&hdev->cmd_q))) { 4341 while ((skb = __skb_dequeue(&hdev->cmd_q))) {
4342 if (bt_cb(skb)->req_start) { 4342 if (bt_cb(skb)->req.start) {
4343 __skb_queue_head(&hdev->cmd_q, skb); 4343 __skb_queue_head(&hdev->cmd_q, skb);
4344 break; 4344 break;
4345 } 4345 }
4346 4346
4347 req_complete = bt_cb(skb)->req_complete; 4347 req_complete = bt_cb(skb)->req.complete;
4348 kfree_skb(skb); 4348 kfree_skb(skb);
4349 } 4349 }
4350 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags); 4350 spin_unlock_irqrestore(&hdev->cmd_q.lock, flags);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 20f34b861426..7c0f992602f5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3125,7 +3125,7 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
3125 atomic_set(&hdev->cmd_cnt, 1); 3125 atomic_set(&hdev->cmd_cnt, 1);
3126 3126
3127 if (ev->status || 3127 if (ev->status ||
3128 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->req_event)) 3128 (hdev->sent_cmd && !bt_cb(hdev->sent_cmd)->req.event))
3129 hci_req_cmd_complete(hdev, opcode, ev->status); 3129 hci_req_cmd_complete(hdev, opcode, ev->status);
3130 3130
3131 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) 3131 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q))
@@ -5049,7 +5049,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
5049 5049
5050 skb_pull(skb, HCI_EVENT_HDR_SIZE); 5050 skb_pull(skb, HCI_EVENT_HDR_SIZE);
5051 5051
5052 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->req_event == event) { 5052 if (hdev->sent_cmd && bt_cb(hdev->sent_cmd)->req.event == event) {
5053 struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data; 5053 struct hci_command_hdr *cmd_hdr = (void *) hdev->sent_cmd->data;
5054 u16 opcode = __le16_to_cpu(cmd_hdr->opcode); 5054 u16 opcode = __le16_to_cpu(cmd_hdr->opcode);
5055 5055
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 55e096d20a0f..7e17907effb3 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -55,7 +55,7 @@ int hci_req_run(struct hci_request *req, hci_req_complete_t complete)
55 return -ENODATA; 55 return -ENODATA;
56 56
57 skb = skb_peek_tail(&req->cmd_q); 57 skb = skb_peek_tail(&req->cmd_q);
58 bt_cb(skb)->req_complete = complete; 58 bt_cb(skb)->req.complete = complete;
59 59
60 spin_lock_irqsave(&hdev->cmd_q.lock, flags); 60 spin_lock_irqsave(&hdev->cmd_q.lock, flags);
61 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q); 61 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q);
@@ -116,9 +116,9 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
116 } 116 }
117 117
118 if (skb_queue_empty(&req->cmd_q)) 118 if (skb_queue_empty(&req->cmd_q))
119 bt_cb(skb)->req_start = 1; 119 bt_cb(skb)->req.start = true;
120 120
121 bt_cb(skb)->req_event = event; 121 bt_cb(skb)->req.event = event;
122 122
123 skb_queue_tail(&req->cmd_q, skb); 123 skb_queue_tail(&req->cmd_q, skb);
124} 124}
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 85a44a7dc150..56f9edbf3d05 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1164,7 +1164,7 @@ static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
1164 /* Stand-alone HCI commands must be flagged as 1164 /* Stand-alone HCI commands must be flagged as
1165 * single-command requests. 1165 * single-command requests.
1166 */ 1166 */
1167 bt_cb(skb)->req_start = 1; 1167 bt_cb(skb)->req.start = true;
1168 1168
1169 skb_queue_tail(&hdev->cmd_q, skb); 1169 skb_queue_tail(&hdev->cmd_q, skb);
1170 queue_work(hdev->workqueue, &hdev->cmd_work); 1170 queue_work(hdev->workqueue, &hdev->cmd_work);