* [PATCH trivial 0/3] Trivial patches set
@ 2012-02-06 13:03 Emeltchenko Andrei
2012-02-06 13:03 ` [PATCH trivial 1/3] Bluetooth: Change chan_ready param from sk to chan Emeltchenko Andrei
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2012-02-06 13:03 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Those trivial patches are acked already and might be applied separetely
from the main "locking" patch set.
Andrei Emeltchenko (3):
Bluetooth: Change chan_ready param from sk to chan
Bluetooth: Clean up l2cap_chan_add
Bluetooth: Remove unneeded sk variable
net/bluetooth/l2cap_core.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
--
1.7.8.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH trivial 1/3] Bluetooth: Change chan_ready param from sk to chan
2012-02-06 13:03 [PATCH trivial 0/3] Trivial patches set Emeltchenko Andrei
@ 2012-02-06 13:03 ` Emeltchenko Andrei
2012-02-06 13:04 ` [PATCH trivial 2/3] Bluetooth: Clean up l2cap_chan_add Emeltchenko Andrei
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2012-02-06 13:03 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Change is needed to remove dependency on sk when possible
before introducing l2cap channel lock.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 09cd860..80fbfcf 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -907,9 +907,9 @@ clean:
release_sock(parent);
}
-static void l2cap_chan_ready(struct sock *sk)
+static void l2cap_chan_ready(struct l2cap_chan *chan)
{
- struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ struct sock *sk = chan->sk;
struct sock *parent = bt_sk(sk)->parent;
BT_DBG("sk %p, parent %p", sk, parent);
@@ -945,7 +945,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
if (conn->hcon->type == LE_LINK) {
if (smp_conn_security(conn, chan->sec_level))
- l2cap_chan_ready(sk);
+ l2cap_chan_ready(chan);
} else if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
__clear_chan_timer(chan);
@@ -2874,7 +2874,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
if (chan->mode == L2CAP_MODE_ERTM)
l2cap_ertm_init(chan);
- l2cap_chan_ready(sk);
+ l2cap_chan_ready(chan);
goto unlock;
}
@@ -3005,7 +3005,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
if (chan->mode == L2CAP_MODE_ERTM)
l2cap_ertm_init(chan);
- l2cap_chan_ready(sk);
+ l2cap_chan_ready(chan);
}
done:
@@ -4524,7 +4524,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
if (chan->scid == L2CAP_CID_LE_DATA) {
if (!status && encrypt) {
chan->sec_level = hcon->sec_level;
- l2cap_chan_ready(sk);
+ l2cap_chan_ready(chan);
}
bh_unlock_sock(sk);
--
1.7.8.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH trivial 2/3] Bluetooth: Clean up l2cap_chan_add
2012-02-06 13:03 [PATCH trivial 0/3] Trivial patches set Emeltchenko Andrei
2012-02-06 13:03 ` [PATCH trivial 1/3] Bluetooth: Change chan_ready param from sk to chan Emeltchenko Andrei
@ 2012-02-06 13:04 ` Emeltchenko Andrei
2012-02-06 13:04 ` [PATCH trivial 3/3] Bluetooth: Remove unneeded sk variable Emeltchenko Andrei
2012-02-06 15:27 ` [PATCH trivial 0/3] Trivial patches set Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2012-02-06 13:04 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Change elseif to switch. This make sense even more with following
patches which otherwise have to add more elseifs statements.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 80fbfcf..48fc01e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -320,7 +320,8 @@ static void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
chan->conn = conn;
- if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED) {
+ switch (chan->chan_type) {
+ case L2CAP_CHAN_CONN_ORIENTED:
if (conn->hcon->type == LE_LINK) {
/* LE connection */
chan->omtu = L2CAP_LE_DEFAULT_MTU;
@@ -331,12 +332,16 @@ static void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
chan->scid = l2cap_alloc_cid(conn);
chan->omtu = L2CAP_DEFAULT_MTU;
}
- } else if (chan->chan_type == L2CAP_CHAN_CONN_LESS) {
+ break;
+
+ case L2CAP_CHAN_CONN_LESS:
/* Connectionless socket */
chan->scid = L2CAP_CID_CONN_LESS;
chan->dcid = L2CAP_CID_CONN_LESS;
chan->omtu = L2CAP_DEFAULT_MTU;
- } else {
+ break;
+
+ default:
/* Raw socket can send/recv signalling messages only */
chan->scid = L2CAP_CID_SIGNALING;
chan->dcid = L2CAP_CID_SIGNALING;
--
1.7.8.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH trivial 3/3] Bluetooth: Remove unneeded sk variable
2012-02-06 13:03 [PATCH trivial 0/3] Trivial patches set Emeltchenko Andrei
2012-02-06 13:03 ` [PATCH trivial 1/3] Bluetooth: Change chan_ready param from sk to chan Emeltchenko Andrei
2012-02-06 13:04 ` [PATCH trivial 2/3] Bluetooth: Clean up l2cap_chan_add Emeltchenko Andrei
@ 2012-02-06 13:04 ` Emeltchenko Andrei
2012-02-06 15:27 ` [PATCH trivial 0/3] Trivial patches set Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2012-02-06 13:04 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
In debug use chan %p instead of sk.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 48fc01e..f1a6b3c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1561,13 +1561,12 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
struct msghdr *msg, size_t len,
u32 priority)
{
- struct sock *sk = chan->sk;
struct l2cap_conn *conn = chan->conn;
struct sk_buff *skb;
int err, count, hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE;
struct l2cap_hdr *lh;
- BT_DBG("sk %p len %d priority %u", sk, (int)len, priority);
+ BT_DBG("chan %p len %d priority %u", chan, (int)len, priority);
count = min_t(unsigned int, (conn->mtu - hlen), len);
@@ -1597,13 +1596,12 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan,
struct msghdr *msg, size_t len,
u32 priority)
{
- struct sock *sk = chan->sk;
struct l2cap_conn *conn = chan->conn;
struct sk_buff *skb;
int err, count, hlen = L2CAP_HDR_SIZE;
struct l2cap_hdr *lh;
- BT_DBG("sk %p len %d", sk, (int)len);
+ BT_DBG("chan %p len %d", chan, (int)len);
count = min_t(unsigned int, (conn->mtu - hlen), len);
@@ -1632,13 +1630,12 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan,
struct msghdr *msg, size_t len,
u32 control, u16 sdulen)
{
- struct sock *sk = chan->sk;
struct l2cap_conn *conn = chan->conn;
struct sk_buff *skb;
int err, count, hlen;
struct l2cap_hdr *lh;
- BT_DBG("sk %p len %d", sk, (int)len);
+ BT_DBG("chan %p len %d", chan, (int)len);
if (!conn)
return ERR_PTR(-ENOTCONN);
--
1.7.8.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH trivial 0/3] Trivial patches set
2012-02-06 13:03 [PATCH trivial 0/3] Trivial patches set Emeltchenko Andrei
` (2 preceding siblings ...)
2012-02-06 13:04 ` [PATCH trivial 3/3] Bluetooth: Remove unneeded sk variable Emeltchenko Andrei
@ 2012-02-06 15:27 ` Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-02-06 15:27 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
On Mon, Feb 06, 2012, Emeltchenko Andrei wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Those trivial patches are acked already and might be applied separetely
> from the main "locking" patch set.
>
> Andrei Emeltchenko (3):
> Bluetooth: Change chan_ready param from sk to chan
> Bluetooth: Clean up l2cap_chan_add
> Bluetooth: Remove unneeded sk variable
>
> net/bluetooth/l2cap_core.c | 32 +++++++++++++++++---------------
> 1 files changed, 17 insertions(+), 15 deletions(-)
Applied to my bluetooth-next tree. Thanks.
Johan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-06 15:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06 13:03 [PATCH trivial 0/3] Trivial patches set Emeltchenko Andrei
2012-02-06 13:03 ` [PATCH trivial 1/3] Bluetooth: Change chan_ready param from sk to chan Emeltchenko Andrei
2012-02-06 13:04 ` [PATCH trivial 2/3] Bluetooth: Clean up l2cap_chan_add Emeltchenko Andrei
2012-02-06 13:04 ` [PATCH trivial 3/3] Bluetooth: Remove unneeded sk variable Emeltchenko Andrei
2012-02-06 15:27 ` [PATCH trivial 0/3] Trivial patches set Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).