* [PATCHv2 1/4] Bluetooth: convert flushable variable to flag in l2cap chan
@ 2011-09-16 13:53 Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-16 13:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
flushable variable inside l2cap_chan is a logical one and can
be easily converted to flag
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 3 ++-
net/bluetooth/l2cap_sock.c | 15 ++++++++++-----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 772877f..0d09ff7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -371,7 +371,6 @@ struct l2cap_chan {
__u8 sec_level;
__u8 role_switch;
__u8 force_reliable;
- __u8 flushable;
__u8 force_active;
__u8 ident;
@@ -535,6 +534,7 @@ enum {
/* Definitions for flags in l2cap_chan */
enum {
+ FLAG_FLUSHABLE,
FLAG_EFS_ENABLE,
FLAG_EXT_CTRL,
};
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7eebddd..affda07 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1266,7 +1266,8 @@ static void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb)
BT_DBG("chan %p, skb %p len %d", chan, skb, skb->len);
- if (!chan->flushable && lmp_no_flush_capable(hcon->hdev))
+ if (!test_bit(FLAG_FLUSHABLE, &chan->flags) &&
+ lmp_no_flush_capable(hcon->hdev))
flags = ACL_START_NO_FLUSH;
else
flags = ACL_START;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index d6a4f63..83596de 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -446,14 +446,15 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
break;
case BT_FLUSHABLE:
- if (put_user(chan->flushable, (u32 __user *) optval))
+ if (put_user(test_bit(FLAG_FLUSHABLE, &chan->flags),
+ (u32 __user *) optval))
err = -EFAULT;
break;
case BT_POWER:
if (sk->sk_type != SOCK_SEQPACKET && sk->sk_type != SOCK_STREAM
- && sk->sk_type != SOCK_RAW) {
+ && sk->sk_type != SOCK_RAW) {
err = -EINVAL;
break;
}
@@ -655,7 +656,10 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
}
}
- chan->flushable = opt;
+ if (opt)
+ set_bit(FLAG_FLUSHABLE, &chan->flags);
+ else
+ clear_bit(FLAG_FLUSHABLE, &chan->flags);
break;
case BT_POWER:
@@ -931,7 +935,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->sec_level = pchan->sec_level;
chan->role_switch = pchan->role_switch;
chan->force_reliable = pchan->force_reliable;
- chan->flushable = pchan->flushable;
+ if (test_bit(FLAG_FLUSHABLE, &pchan->flags))
+ set_bit(FLAG_FLUSHABLE, &chan->flags);
chan->force_active = pchan->force_active;
} else {
@@ -962,7 +967,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->sec_level = BT_SECURITY_LOW;
chan->role_switch = 0;
chan->force_reliable = 0;
- chan->flushable = BT_FLUSHABLE_OFF;
+ clear_bit(FLAG_FLUSHABLE, &chan->flags);
chan->force_active = BT_POWER_FORCE_ACTIVE_ON;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 2/4] Bluetooth: convert force_reliable variable to flag in l2cap chan
2011-09-16 13:53 [PATCHv2 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
@ 2011-09-16 13:53 ` Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
2 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-16 13:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
force_reliable variable inside l2cap_chan is a logical one and can
be easily converted to flag
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 2 +-
net/bluetooth/l2cap_sock.c | 13 +++++++++----
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 0d09ff7..af81a7e 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -370,7 +370,6 @@ struct l2cap_chan {
__u8 sec_level;
__u8 role_switch;
- __u8 force_reliable;
__u8 force_active;
__u8 ident;
@@ -534,6 +533,7 @@ enum {
/* Definitions for flags in l2cap_chan */
enum {
+ FLAG_FORCE_RELIABLE,
FLAG_FLUSHABLE,
FLAG_EFS_ENABLE,
FLAG_EXT_CTRL,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index affda07..2307819 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -961,7 +961,7 @@ static void l2cap_conn_unreliable(struct l2cap_conn *conn, int err)
list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
- if (chan->force_reliable)
+ if (test_bit(FLAG_FORCE_RELIABLE, &chan->flags))
sk->sk_err = err;
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 83596de..1ba2187 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -359,7 +359,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
if (chan->role_switch)
opt |= L2CAP_LM_MASTER;
- if (chan->force_reliable)
+ if (test_bit(FLAG_FORCE_RELIABLE, &chan->flags))
opt |= L2CAP_LM_RELIABLE;
if (put_user(opt, (u32 __user *) optval))
@@ -550,7 +550,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
chan->sec_level = BT_SECURITY_HIGH;
chan->role_switch = (opt & L2CAP_LM_MASTER);
- chan->force_reliable = (opt & L2CAP_LM_RELIABLE);
+
+ if (opt & L2CAP_LM_RELIABLE)
+ set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
+ else
+ clear_bit(FLAG_FORCE_RELIABLE, &chan->flags);
break;
default:
@@ -934,7 +938,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->tx_win = pchan->tx_win;
chan->sec_level = pchan->sec_level;
chan->role_switch = pchan->role_switch;
- chan->force_reliable = pchan->force_reliable;
+ if (test_bit(FLAG_FORCE_RELIABLE, &pchan->flags))
+ set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
if (test_bit(FLAG_FLUSHABLE, &pchan->flags))
set_bit(FLAG_FLUSHABLE, &chan->flags);
chan->force_active = pchan->force_active;
@@ -966,7 +971,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->tx_win = L2CAP_DEFAULT_MAX_TX_WINDOW;
chan->sec_level = BT_SECURITY_LOW;
chan->role_switch = 0;
- chan->force_reliable = 0;
+ clear_bit(FLAG_FORCE_RELIABLE, &chan->flags);
clear_bit(FLAG_FLUSHABLE, &chan->flags);
chan->force_active = BT_POWER_FORCE_ACTIVE_ON;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 3/4] Bluetooth: convert force_active variable to flag in l2cap chan
2011-09-16 13:53 [PATCHv2 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
@ 2011-09-16 13:53 ` Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
2 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-16 13:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
force_active variable inside l2cap_chan is a logical one and can
be easily converted to flag
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 4 ++--
net/bluetooth/l2cap_sock.c | 14 +++++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index af81a7e..3a27893 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -370,7 +370,6 @@ struct l2cap_chan {
__u8 sec_level;
__u8 role_switch;
- __u8 force_active;
__u8 ident;
@@ -533,6 +532,7 @@ enum {
/* Definitions for flags in l2cap_chan */
enum {
+ FLAG_FORCE_ACTIVE,
FLAG_FORCE_RELIABLE,
FLAG_FLUSHABLE,
FLAG_EFS_ENABLE,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2307819..c112e77 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -618,7 +618,7 @@ static inline void l2cap_send_sframe(struct l2cap_chan *chan, u32 control)
else
flags = ACL_START;
- bt_cb(skb)->force_active = chan->force_active;
+ bt_cb(skb)->force_active = test_bit(FLAG_FORCE_ACTIVE, &chan->flags);
hci_send_acl(chan->conn->hcon, skb, flags);
}
@@ -1272,7 +1272,7 @@ static void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb)
else
flags = ACL_START;
- bt_cb(skb)->force_active = chan->force_active;
+ bt_cb(skb)->force_active = test_bit(FLAG_FORCE_ACTIVE, &chan->flags);
hci_send_acl(hcon, skb, flags);
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 1ba2187..9d4d9d4 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -459,7 +459,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
break;
}
- pwr.force_active = chan->force_active;
+ pwr.force_active = test_bit(FLAG_FORCE_ACTIVE, &chan->flags);
len = min_t(unsigned int, len, sizeof(pwr));
if (copy_to_user(optval, (char *) &pwr, len))
@@ -680,7 +680,11 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
err = -EFAULT;
break;
}
- chan->force_active = pwr.force_active;
+
+ if (pwr.force_active)
+ set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
+ else
+ clear_bit(FLAG_FORCE_ACTIVE, &chan->flags);
break;
default:
@@ -942,7 +946,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
if (test_bit(FLAG_FLUSHABLE, &pchan->flags))
set_bit(FLAG_FLUSHABLE, &chan->flags);
- chan->force_active = pchan->force_active;
+ if (test_bit(FLAG_FORCE_ACTIVE, &pchan->flags))
+ set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
} else {
switch (sk->sk_type) {
@@ -973,8 +978,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->role_switch = 0;
clear_bit(FLAG_FORCE_RELIABLE, &chan->flags);
clear_bit(FLAG_FLUSHABLE, &chan->flags);
- chan->force_active = BT_POWER_FORCE_ACTIVE_ON;
-
+ set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
}
/* Default config options */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 4/4] Bluetooth: convert role_switch variable to flag in l2cap chan
2011-09-16 13:53 [PATCHv2 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
@ 2011-09-16 13:53 ` Emeltchenko Andrei
2011-10-06 18:23 ` Gustavo Padovan
2 siblings, 1 reply; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-16 13:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
role_switch variable inside l2cap_chan is a logical one and can
be easily converted to flag
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 4 ++--
net/bluetooth/l2cap_sock.c | 12 ++++++++----
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 3a27893..f58f7ec 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -369,7 +369,6 @@ struct l2cap_chan {
__le16 sport;
__u8 sec_level;
- __u8 role_switch;
__u8 ident;
@@ -532,6 +531,7 @@ enum {
/* Definitions for flags in l2cap_chan */
enum {
+ FLAG_ROLE_SWITCH,
FLAG_FORCE_ACTIVE,
FLAG_FORCE_RELIABLE,
FLAG_FLUSHABLE,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c112e77..5a8612a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4182,12 +4182,12 @@ static int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr)) {
lm1 |= HCI_LM_ACCEPT;
- if (c->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &c->flags))
lm1 |= HCI_LM_MASTER;
exact++;
} else if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY)) {
lm2 |= HCI_LM_ACCEPT;
- if (c->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &c->flags))
lm2 |= HCI_LM_MASTER;
}
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 9d4d9d4..34d608c 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -356,7 +356,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
break;
}
- if (chan->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &chan->flags))
opt |= L2CAP_LM_MASTER;
if (test_bit(FLAG_FORCE_RELIABLE, &chan->flags))
@@ -549,7 +549,10 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
if (opt & L2CAP_LM_SECURE)
chan->sec_level = BT_SECURITY_HIGH;
- chan->role_switch = (opt & L2CAP_LM_MASTER);
+ if (opt & L2CAP_LM_MASTER)
+ set_bit(FLAG_ROLE_SWITCH, &chan->flags);
+ else
+ clear_bit(FLAG_ROLE_SWITCH, &chan->flags);
if (opt & L2CAP_LM_RELIABLE)
set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
@@ -941,7 +944,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->max_tx = pchan->max_tx;
chan->tx_win = pchan->tx_win;
chan->sec_level = pchan->sec_level;
- chan->role_switch = pchan->role_switch;
+ if (test_bit(FLAG_ROLE_SWITCH, &pchan->flags))
+ set_bit(FLAG_ROLE_SWITCH, &chan->flags);
if (test_bit(FLAG_FORCE_RELIABLE, &pchan->flags))
set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
if (test_bit(FLAG_FLUSHABLE, &pchan->flags))
@@ -975,7 +979,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->fcs = L2CAP_FCS_CRC16;
chan->tx_win = L2CAP_DEFAULT_MAX_TX_WINDOW;
chan->sec_level = BT_SECURITY_LOW;
- chan->role_switch = 0;
+ clear_bit(FLAG_ROLE_SWITCH, &chan->flags);
clear_bit(FLAG_FORCE_RELIABLE, &chan->flags);
clear_bit(FLAG_FLUSHABLE, &chan->flags);
set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCHv2 4/4] Bluetooth: convert role_switch variable to flag in l2cap chan
2011-09-16 13:53 ` [PATCHv2 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
@ 2011-10-06 18:23 ` Gustavo Padovan
2011-10-07 13:57 ` Emeltchenko Andrei
0 siblings, 1 reply; 7+ messages in thread
From: Gustavo Padovan @ 2011-10-06 18:23 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-09-16 16:53:42 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> role_switch variable inside l2cap_chan is a logical one and can
> be easily converted to flag
> ---
> include/net/bluetooth/l2cap.h | 2 +-
> net/bluetooth/l2cap_core.c | 4 ++--
> net/bluetooth/l2cap_sock.c | 12 ++++++++----
> 3 files changed, 11 insertions(+), 7 deletions(-)
These four patches can came first. Please rebase them.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 4/4] Bluetooth: convert role_switch variable to flag in l2cap chan
2011-10-06 18:23 ` Gustavo Padovan
@ 2011-10-07 13:57 ` Emeltchenko Andrei
0 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-10-07 13:57 UTC (permalink / raw)
To: linux-bluetooth
Hi Gustavo,
On Thu, Oct 06, 2011 at 03:23:43PM -0300, Gustavo Padovan wrote:
> > role_switch variable inside l2cap_chan is a logical one and can
> > be easily converted to flag
> > ---
> > include/net/bluetooth/l2cap.h | 2 +-
> > net/bluetooth/l2cap_core.c | 4 ++--
> > net/bluetooth/l2cap_sock.c | 12 ++++++++----
> > 3 files changed, 11 insertions(+), 7 deletions(-)
>
> These four patches can came first. Please rebase them.
Those 4 patches rebased and sent alone. I am also thinking about sending
EWS patches before EFS.
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCHv2 4/4] Bluetooth: convert role_switch variable to flag in l2cap chan
2011-10-11 9:35 [PATCHv2 1/4] Bluetooth: convert flushable " Emeltchenko Andrei
@ 2011-10-11 9:35 ` Emeltchenko Andrei
0 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-10-11 9:35 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
role_switch variable inside l2cap_chan is a logical one and can
be easily converted to flag
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 4 ++--
net/bluetooth/l2cap_sock.c | 11 +++++++----
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 440e7b8..aea083c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -324,7 +324,6 @@ struct l2cap_chan {
__le16 sport;
__u8 sec_level;
- __u8 role_switch;
__u8 ident;
@@ -463,6 +462,7 @@ enum {
/* Definitions for flags in l2cap_chan */
enum {
+ FLAG_ROLE_SWITCH,
FLAG_FORCE_ACTIVE,
FLAG_FORCE_RELIABLE,
FLAG_FLUSHABLE,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index aeeacf8..18a08c5 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3938,12 +3938,12 @@ static int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr)) {
lm1 |= HCI_LM_ACCEPT;
- if (c->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &c->flags))
lm1 |= HCI_LM_MASTER;
exact++;
} else if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY)) {
lm2 |= HCI_LM_ACCEPT;
- if (c->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &c->flags))
lm2 |= HCI_LM_MASTER;
}
}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 6682b93..aa2f2f0 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -356,7 +356,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
break;
}
- if (chan->role_switch)
+ if (test_bit(FLAG_ROLE_SWITCH, &chan->flags))
opt |= L2CAP_LM_MASTER;
if (test_bit(FLAG_FORCE_RELIABLE, &chan->flags))
@@ -549,7 +549,10 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
if (opt & L2CAP_LM_SECURE)
chan->sec_level = BT_SECURITY_HIGH;
- chan->role_switch = (opt & L2CAP_LM_MASTER);
+ if (opt & L2CAP_LM_MASTER)
+ set_bit(FLAG_ROLE_SWITCH, &chan->flags);
+ else
+ clear_bit(FLAG_ROLE_SWITCH, &chan->flags);
if (opt & L2CAP_LM_RELIABLE)
set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
@@ -941,7 +944,8 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->max_tx = pchan->max_tx;
chan->tx_win = pchan->tx_win;
chan->sec_level = pchan->sec_level;
- chan->role_switch = pchan->role_switch;
+ if (test_bit(FLAG_ROLE_SWITCH, &pchan->flags))
+ set_bit(FLAG_ROLE_SWITCH, &chan->flags);
if (test_bit(FLAG_FORCE_RELIABLE, &pchan->flags))
set_bit(FLAG_FORCE_RELIABLE, &chan->flags);
if (test_bit(FLAG_FLUSHABLE, &pchan->flags))
@@ -975,7 +979,6 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
chan->fcs = L2CAP_FCS_CRC16;
chan->tx_win = L2CAP_DEFAULT_TX_WINDOW;
chan->sec_level = BT_SECURITY_LOW;
- chan->role_switch = 0;
chan->flags = 0;
set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-10-11 9:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-16 13:53 [PATCHv2 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
2011-09-16 13:53 ` [PATCHv2 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
2011-10-06 18:23 ` Gustavo Padovan
2011-10-07 13:57 ` Emeltchenko Andrei
-- strict thread matches above, loose matches on Subject: below --
2011-10-11 9:35 [PATCHv2 1/4] Bluetooth: convert flushable " Emeltchenko Andrei
2011-10-11 9:35 ` [PATCHv2 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
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).