2010-09-16 09:21:40

by haijun liu

[permalink] [raw]
Subject: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Replace hard code of configuration continuation flag with self-comment macro.

Signed-off-by: Haijun.Liu <[email protected]>
---
include/net/bluetooth/l2cap.h | 2 ++
net/bluetooth/l2cap.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index e4fe2c7..a37b266 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -199,6 +199,8 @@ struct l2cap_conf_rsp {
#define L2CAP_CONF_REJECT 0x0002
#define L2CAP_CONF_UNKNOWN 0x0003

+#define L2CAP_CONF_FLAG_CONT 0x0001
+
struct l2cap_conf_opt {
__u8 type;
__u8 len;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 1797277..725744b 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -3121,7 +3121,7 @@ static inline int l2cap_config_req(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
memcpy(l2cap_pi(sk)->conf_req + l2cap_pi(sk)->conf_len, req->data, len);
l2cap_pi(sk)->conf_len += len;

- if (flags & 0x0001) {
+ if (flags & L2CAP_CONF_FLAG_CONT) {
/* Incomplete config. Send empty response. */
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
l2cap_build_conf_rsp(sk, rsp,
@@ -3228,7 +3228,7 @@ static inline int l2cap_config_rsp(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
goto done;
}

- if (flags & 0x01)
+ if (flags & L2CAP_CONF_FLAG_CONT)
goto done;

l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;
--
1.6.3.3


--
Haijun Liu


2010-09-30 07:24:05

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

* haijun liu <[email protected]> [2010-09-29 21:33:09 +0800]:

> Replace hard code of configuration continuation flag with self-comment macro.
>
>
> Signed-off-by: Haijun.Liu <[email protected]>
> ---
> net/bluetooth/l2cap_core.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)

This one is also corrupted.

--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

2010-09-29 13:33:09

by haijun liu

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Replace hard code of configuration continuation flag with self-comment macro.


Signed-off-by: Haijun.Liu <[email protected]>
---
net/bluetooth/l2cap_core.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index efcf510..279f98a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2985,11 +2985,11 @@ static inline int l2cap_config_req(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
memcpy(l2cap_pi(sk)->conf_req + l2cap_pi(sk)->conf_len, req->data, len);
l2cap_pi(sk)->conf_len += len;

- if (flags & 0x0001) {
+ if (flags & L2CAP_CONF_FLAG_CONT) {
/* Incomplete config. Send empty response. */
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
l2cap_build_conf_rsp(sk, rsp,
- L2CAP_CONF_SUCCESS, 0x0001), rsp);
+ L2CAP_CONF_SUCCESS, L2CAP_CONF_FLAG_CONT), rsp);
goto unlock;
}

@@ -3092,7 +3092,7 @@ static inline int l2cap_config_rsp(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
goto done;
}

- if (flags & 0x01)
+ if (flags & L2CAP_CONF_FLAG_CONT)
goto done;

l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;
--
1.6.3.3

2010-09-29 13:12:29

by Ville Tervo

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Hi,

On Wed, Sep 29, 2010 at 02:42:35PM +0200, ext haijun liu wrote:
> Hi Ville,
> Do you mean l2cap_config_rsp()?

No. I meant change like this in addition to your changes.

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index efcf510..7a9c194 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2989,7 +2989,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
/* Incomplete config. Send empty response. */
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
l2cap_build_conf_rsp(sk, rsp,
- L2CAP_CONF_SUCCESS, 0x0001), rsp);
+ L2CAP_CONF_SUCCESS, L2CAP_CONF_FLAG_CONT), rsp);
goto unlock;
}


> I made it, but I don't why gmail hide that part.

I got the whole message.

--
Ville

2010-09-29 12:42:35

by haijun liu

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Hi Ville,
Do you mean l2cap_config_rsp()?
I made it, but I don't why gmail hide that part.

--
Haijun Liu

2010-09-29 11:36:15

by Ville Tervo

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Hi,

Patch is ok but just one comment. See below.

On Wed, Sep 29, 2010 at 01:12:39PM +0200, haijun liu wrote:
>
> Replace hard code of configuration continuation flag with self-comment macro.
>
> - if (flags & 0x0001) {
> + if (flags & L2CAP_CONF_FLAG_CONT) {
> /* Incomplete config. Send empty response. */
> l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
> l2cap_build_conf_rsp(sk, rsp,

Maybe you could use L2CAP_CONF_FLAG_CONT also in l2cap_build_conf_rsp()?

--
Ville

2010-09-29 11:12:39

by haijun liu

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Replace hard code of configuration continuation flag with self-comment macro.


Signed-off-by: Haijun.Liu <[email protected]>
---
include/net/bluetooth/l2cap.h | 2 ++
net/bluetooth/l2cap_core.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index df599dc..2b114ca 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -193,6 +193,8 @@ struct l2cap_conf_rsp {
#define L2CAP_CONF_REJECT 0x0002
#define L2CAP_CONF_UNKNOWN 0x0003

+#define L2CAP_CONF_FLAG_CONT 0x0001
+
struct l2cap_conf_opt {
__u8 type;
__u8 len;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index efcf510..bef5c9f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2985,7 +2985,7 @@ static inline int l2cap_config_req(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
memcpy(l2cap_pi(sk)->conf_req + l2cap_pi(sk)->conf_len, req->data, len);
l2cap_pi(sk)->conf_len += len;

- if (flags & 0x0001) {
+ if (flags & L2CAP_CONF_FLAG_CONT) {
/* Incomplete config. Send empty response. */
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
l2cap_build_conf_rsp(sk, rsp,
@@ -3092,7 +3092,7 @@ static inline int l2cap_config_rsp(struct
l2cap_conn *conn, struct l2cap_cmd_hdr
goto done;
}

- if (flags & 0x01)
+ if (flags & L2CAP_CONF_FLAG_CONT)
goto done;

l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE;
--
1.6.3.3

2010-09-28 23:48:20

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Replace hard code of configuration continuation flag.

Hi Haijun,

* haijun liu <[email protected]> [2010-09-16 17:21:40 +0800]:

> Replace hard code of configuration continuation flag with self-comment macro.
>
> Signed-off-by: Haijun.Liu <[email protected]>

Your patch is corrupted, please fix that and rebase it against
http://git.kernel.org/?p=linux/kernel/git/padovan/bluetooth-next-2.6.git
Thanks.

--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi