From: Mat Martineau <mathewm@codeaurora.org>
Date: Fri, 18 May 2012 03:53:48 +0000 (-0700)
Subject: Bluetooth: Use new header structures in l2cap_send_rr_or_rnr
X-Git-Tag: firefly_0821_release~3680^2~2381^2~57^2~2^2~126
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c9e3d5e00408c96f82b88a8de5d54f7a1343b110;p=firefly-linux-kernel-4.4.55.git

Bluetooth: Use new header structures in l2cap_send_rr_or_rnr

struct l2cap_ctrl is now used, and the sframe is now sent directly
rather than depending on a separate call.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 5e4a881a6e19..8ea9ec648bfd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -920,15 +920,23 @@ static void l2cap_send_sframe(struct l2cap_chan *chan,
 		l2cap_do_send(chan, skb);
 }
 
-static inline void l2cap_send_rr_or_rnr(struct l2cap_chan *chan, u32 control)
+static void l2cap_send_rr_or_rnr(struct l2cap_chan *chan, bool poll)
 {
-	if (test_bit(CONN_LOCAL_BUSY, &chan->conn_state)) {
-		control |= __set_ctrl_super(chan, L2CAP_SUPER_RNR);
-		set_bit(CONN_RNR_SENT, &chan->conn_state);
-	} else
-		control |= __set_ctrl_super(chan, L2CAP_SUPER_RR);
+	struct l2cap_ctrl control;
+
+	BT_DBG("chan %p, poll %d", chan, poll);
+
+	memset(&control, 0, sizeof(control));
+	control.sframe = 1;
+	control.poll = poll;
 
-	control |= __set_reqseq(chan, chan->buffer_seq);
+	if (test_bit(CONN_LOCAL_BUSY, &chan->conn_state))
+		control.super = L2CAP_SUPER_RNR;
+	else
+		control.super = L2CAP_SUPER_RR;
+
+	control.reqseq = chan->buffer_seq;
+	l2cap_send_sframe(chan, &control);
 }
 
 static inline int __l2cap_no_conn_pending(struct l2cap_chan *chan)