All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm
@ 2012-11-14 15:39 Andrei Emeltchenko
  2012-11-14 15:39 ` [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels Andrei Emeltchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove locking from l2cap_physical_cfm and lock chan inside
amp_physical_cfm.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/l2cap.h |    2 +-
 net/bluetooth/amp.c           |    6 +++++-
 net/bluetooth/l2cap_core.c    |    7 ++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d65db45..f57fab0 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -811,6 +811,6 @@ void l2cap_send_conn_req(struct l2cap_chan *chan);
 void l2cap_move_start(struct l2cap_chan *chan);
 void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
 		       u8 status);
-void l2cap_physical_cfm(struct l2cap_chan *chan, int result);
+void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
 
 #endif /* __L2CAP_H */
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 4b2fea6..eaf473f 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -386,13 +386,17 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
 
 	bredr_chan = mgr->bredr_chan;
 
+	l2cap_chan_lock(bredr_chan);
+
 	set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags);
 	bredr_chan->remote_amp_id = hs_hcon->remote_id;
 	bredr_chan->hs_hcon = hs_hcon;
 	bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
 	bredr_chan->fcs = L2CAP_FCS_NONE;
 
-	l2cap_physical_cfm(bredr_chan, 0);
+	__l2cap_physical_cfm(bredr_chan, 0);
+
+	l2cap_chan_unlock(bredr_chan);
 
 	hci_dev_put(bredr_hdev);
 }
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a1faaab..138d505 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4612,7 +4612,8 @@ static void l2cap_do_move_cancel(struct l2cap_chan *chan, int result)
 	l2cap_ertm_send(chan);
 }
 
-void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
+/* Invoke with locked chan */
+void __l2cap_physical_cfm(struct l2cap_chan *chan, int result)
 {
 	u8 local_amp_id = chan->local_amp_id;
 	u8 remote_amp_id = chan->remote_amp_id;
@@ -4620,8 +4621,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
 	BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d",
 	       chan, result, local_amp_id, remote_amp_id);
 
-	l2cap_chan_lock(chan);
-
 	if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) {
 		l2cap_chan_unlock(chan);
 		return;
@@ -4645,8 +4644,6 @@ void l2cap_physical_cfm(struct l2cap_chan *chan, int result)
 			break;
 		}
 	}
-
-	l2cap_chan_unlock(chan);
 }
 
 static inline int l2cap_move_channel_req(struct l2cap_conn *conn,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels
  2012-11-14 15:39 [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Andrei Emeltchenko
@ 2012-11-14 15:39 ` Andrei Emeltchenko
  2012-11-14 23:08   ` Marcel Holtmann
  2012-11-14 15:39 ` [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants Andrei Emeltchenko
  2012-11-14 23:04 ` [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Marcel Holtmann
  2 siblings, 1 reply; 7+ messages in thread
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Set chan->fcs to L2CAP_FCS_NONE only for new L2CAP channels
(not moved). Other side can still request to use FCS.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/amp.c        |    1 -
 net/bluetooth/l2cap_core.c |    2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index eaf473f..0258b26 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -392,7 +392,6 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
 	bredr_chan->remote_amp_id = hs_hcon->remote_id;
 	bredr_chan->hs_hcon = hs_hcon;
 	bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
-	bredr_chan->fcs = L2CAP_FCS_NONE;
 
 	__l2cap_physical_cfm(bredr_chan, 0);
 
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 138d505..10b3062 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4518,6 +4518,8 @@ void l2cap_move_start(struct l2cap_chan *chan)
 static void l2cap_do_create(struct l2cap_chan *chan, int result,
 			    u8 local_amp_id, u8 remote_amp_id)
 {
+	chan->fcs = L2CAP_FCS_NONE;
+
 	if (!test_bit(CONF_CONNECT_PEND, &chan->conf_state)) {
 		struct l2cap_conn_rsp rsp;
 		char buf[128];
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
  2012-11-14 15:39 [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Andrei Emeltchenko
  2012-11-14 15:39 ` [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels Andrei Emeltchenko
@ 2012-11-14 15:39 ` Andrei Emeltchenko
  2012-11-14 23:07   ` Marcel Holtmann
  2012-11-19 21:36   ` Gustavo Padovan
  2012-11-14 23:04 ` [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Marcel Holtmann
  2 siblings, 2 replies; 7+ messages in thread
From: Andrei Emeltchenko @ 2012-11-14 15:39 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>


Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 10b3062..4a635f1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4529,12 +4529,12 @@ static void l2cap_do_create(struct l2cap_chan *chan, int result,
 		/* Incoming channel on AMP */
 		if (result == L2CAP_CR_SUCCESS) {
 			/* Send successful response */
-			rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS);
-			rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
+			rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
+			rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
 		} else {
 			/* Send negative response */
-			rsp.result = cpu_to_le16(L2CAP_CR_NO_MEM);
-			rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
+			rsp.result = __constant_cpu_to_le16(L2CAP_CR_NO_MEM);
+			rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
 		}
 
 		l2cap_send_cmd(chan->conn, chan->ident, L2CAP_CREATE_CHAN_RSP,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm
  2012-11-14 15:39 [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Andrei Emeltchenko
  2012-11-14 15:39 ` [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels Andrei Emeltchenko
  2012-11-14 15:39 ` [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants Andrei Emeltchenko
@ 2012-11-14 23:04 ` Marcel Holtmann
  2 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2012-11-14 23:04 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Remove locking from l2cap_physical_cfm and lock chan inside
> amp_physical_cfm.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/l2cap.h |    2 +-
>  net/bluetooth/amp.c           |    6 +++++-
>  net/bluetooth/l2cap_core.c    |    7 ++-----
>  3 files changed, 8 insertions(+), 7 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
  2012-11-14 15:39 ` [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants Andrei Emeltchenko
@ 2012-11-14 23:07   ` Marcel Holtmann
  2012-11-19 21:36   ` Gustavo Padovan
  1 sibling, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2012-11-14 23:07 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels
  2012-11-14 15:39 ` [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels Andrei Emeltchenko
@ 2012-11-14 23:08   ` Marcel Holtmann
  0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2012-11-14 23:08 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Set chan->fcs to L2CAP_FCS_NONE only for new L2CAP channels
> (not moved). Other side can still request to use FCS.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/amp.c        |    1 -
>  net/bluetooth/l2cap_core.c |    2 ++
>  2 files changed, 2 insertions(+), 1 deletion(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants
  2012-11-14 15:39 ` [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants Andrei Emeltchenko
  2012-11-14 23:07   ` Marcel Holtmann
@ 2012-11-19 21:36   ` Gustavo Padovan
  1 sibling, 0 replies; 7+ messages in thread
From: Gustavo Padovan @ 2012-11-19 21:36 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-11-14 17:39:32 +0200]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

All 3 patches have been applied to bluetooth-next. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-19 21:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 15:39 [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Andrei Emeltchenko
2012-11-14 15:39 ` [RFCv1 2/3] Bluetooth: Disable FCS only for new HS channels Andrei Emeltchenko
2012-11-14 23:08   ` Marcel Holtmann
2012-11-14 15:39 ` [RFCv1 3/3] Bluetooth: trivial: Use __constant for constants Andrei Emeltchenko
2012-11-14 23:07   ` Marcel Holtmann
2012-11-19 21:36   ` Gustavo Padovan
2012-11-14 23:04 ` [RFCv1 1/3] Bluetooth: Refactor locking in amp_physical_cfm Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.