* [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan
@ 2011-09-07 14:08 Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-07 14:08 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
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 2 +-
net/bluetooth/l2cap_core.c | 3 ++-
net/bluetooth/l2cap_sock.c | 13 +++++++++----
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 27bd105..4e6fb39 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 bb18a27..f68c88d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1269,7 +1269,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 bf343aa..16210df 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -446,7 +446,8 @@ 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;
@@ -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
* [RFC 2/4] Bluetooth: convert force_reliable variable to flag in l2cap chan
2011-09-07 14:08 [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
@ 2011-09-07 14:08 ` Emeltchenko Andrei
2011-09-14 4:04 ` Gustavo Padovan
2011-09-07 14:08 ` [RFC 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-07 14:08 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
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
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 4e6fb39..1302bf5 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 f68c88d..72caee5 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -964,7 +964,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 16210df..9da0ee3 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
* [RFC 3/4] Bluetooth: convert force_active variable to flag in l2cap chan
2011-09-07 14:08 [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
@ 2011-09-07 14:08 ` Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
2011-09-14 4:03 ` [RFC 1/4] Bluetooth: convert flushable " Gustavo Padovan
3 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-07 14:08 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
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 | 14 +++++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 1302bf5..d027e28 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 72caee5..b38755c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -621,7 +621,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);
}
@@ -1275,7 +1275,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 9da0ee3..4aa6e1b 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
* [RFC 4/4] Bluetooth: convert role_switch variable to flag in l2cap chan
2011-09-07 14:08 [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
@ 2011-09-07 14:08 ` Emeltchenko Andrei
2011-09-14 4:03 ` [RFC 1/4] Bluetooth: convert flushable " Gustavo Padovan
3 siblings, 0 replies; 7+ messages in thread
From: Emeltchenko Andrei @ 2011-09-07 14:08 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 | 12 ++++++++----
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d027e28..7c24fda 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 b38755c..e613a2f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4196,12 +4196,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 4aa6e1b..d01886d 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: [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan
2011-09-07 14:08 [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
` (2 preceding siblings ...)
2011-09-07 14:08 ` [RFC 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
@ 2011-09-14 4:03 ` Gustavo Padovan
2011-09-14 4:06 ` Gustavo Padovan
3 siblings, 1 reply; 7+ messages in thread
From: Gustavo Padovan @ 2011-09-14 4:03 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-09-07 17:08:04 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> flushable 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 | 3 ++-
> net/bluetooth/l2cap_sock.c | 13 +++++++++----
> 3 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 27bd105..4e6fb39 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 bb18a27..f68c88d 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -1269,7 +1269,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))
Fix the indetation here.
> flags = ACL_START_NO_FLUSH;
> else
> flags = ACL_START;
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index bf343aa..16210df 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -446,7 +446,8 @@ 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))
and here.
> err = -EFAULT;
>
> 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);
This if does nothing.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC 2/4] Bluetooth: convert force_reliable variable to flag in l2cap chan
2011-09-07 14:08 ` [RFC 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
@ 2011-09-14 4:04 ` Gustavo Padovan
0 siblings, 0 replies; 7+ messages in thread
From: Gustavo Padovan @ 2011-09-14 4:04 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-09-07 17:08:05 +0300]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> force_reliable 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 | 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 4e6fb39..1302bf5 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 f68c88d..72caee5 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -964,7 +964,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 16210df..9da0ee3 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);
This one is also pointless.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan
2011-09-14 4:03 ` [RFC 1/4] Bluetooth: convert flushable " Gustavo Padovan
@ 2011-09-14 4:06 ` Gustavo Padovan
0 siblings, 0 replies; 7+ messages in thread
From: Gustavo Padovan @ 2011-09-14 4:06 UTC (permalink / raw)
To: Emeltchenko Andrei, linux-bluetooth
* Gustavo Padovan <padovan@profusion.mobi> [2011-09-14 01:03:42 -0300]:
> Hi Andrei,
>
> * Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-09-07 17:08:04 +0300]:
>
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> >
> > flushable 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 | 3 ++-
> > net/bluetooth/l2cap_sock.c | 13 +++++++++----
> > 3 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> > index 27bd105..4e6fb39 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 bb18a27..f68c88d 100644
> > --- a/net/bluetooth/l2cap_core.c
> > +++ b/net/bluetooth/l2cap_core.c
> > @@ -1269,7 +1269,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))
>
> Fix the indetation here.
>
> > flags = ACL_START_NO_FLUSH;
> > else
> > flags = ACL_START;
> > diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> > index bf343aa..16210df 100644
> > --- a/net/bluetooth/l2cap_sock.c
> > +++ b/net/bluetooth/l2cap_sock.c
> > @@ -446,7 +446,8 @@ 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))
>
> and here.
>
> > err = -EFAULT;
> >
> > 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);
>
> This if does nothing.
Oops, sorry. This is right, my bad.
Gustavo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-09-14 4:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07 14:08 [RFC 1/4] Bluetooth: convert flushable variable to flag in l2cap chan Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 2/4] Bluetooth: convert force_reliable " Emeltchenko Andrei
2011-09-14 4:04 ` Gustavo Padovan
2011-09-07 14:08 ` [RFC 3/4] Bluetooth: convert force_active " Emeltchenko Andrei
2011-09-07 14:08 ` [RFC 4/4] Bluetooth: convert role_switch " Emeltchenko Andrei
2011-09-14 4:03 ` [RFC 1/4] Bluetooth: convert flushable " Gustavo Padovan
2011-09-14 4:06 ` Gustavo Padovan
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).