aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <gustavo@las.ic.unicamp.br>2009-04-20 00:31:05 -0400
committerMarcel Holtmann <marcel@holtmann.org>2009-06-08 08:49:59 -0400
commit8db4dc46dcff7568896aa1eae4bd07620ce3dd93 (patch)
tree32b92a182971618462f5997c156fa953cd9049cc /net/bluetooth/l2cap.c
parenta1c1db392090bd280d1c3e2ed52ef682746ee332 (diff)
Bluetooth: Use macros for L2CAP channel identifiers
Use macros instead of hardcoded numbers to make the L2CAP source code more readable. Signed-off-by: Gustavo F. Padovan <gustavo@las.ic.unicamp.br> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index ca4d3b40d5ce..ff1744e34cd8 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -161,9 +161,9 @@ static inline struct sock *l2cap_get_chan_by_ident(struct l2cap_chan_list *l, u8
161 161
162static u16 l2cap_alloc_cid(struct l2cap_chan_list *l) 162static u16 l2cap_alloc_cid(struct l2cap_chan_list *l)
163{ 163{
164 u16 cid = 0x0040; 164 u16 cid = L2CAP_CID_DYN_START;
165 165
166 for (; cid < 0xffff; cid++) { 166 for (; cid < L2CAP_CID_DYN_END; cid++) {
167 if(!__l2cap_get_chan_by_scid(l, cid)) 167 if(!__l2cap_get_chan_by_scid(l, cid))
168 return cid; 168 return cid;
169 } 169 }
@@ -215,13 +215,13 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
215 l2cap_pi(sk)->scid = l2cap_alloc_cid(l); 215 l2cap_pi(sk)->scid = l2cap_alloc_cid(l);
216 } else if (sk->sk_type == SOCK_DGRAM) { 216 } else if (sk->sk_type == SOCK_DGRAM) {
217 /* Connectionless socket */ 217 /* Connectionless socket */
218 l2cap_pi(sk)->scid = 0x0002; 218 l2cap_pi(sk)->scid = L2CAP_CID_CONN_LESS;
219 l2cap_pi(sk)->dcid = 0x0002; 219 l2cap_pi(sk)->dcid = L2CAP_CID_CONN_LESS;
220 l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU; 220 l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU;
221 } else { 221 } else {
222 /* Raw socket can send/recv signalling messages only */ 222 /* Raw socket can send/recv signalling messages only */
223 l2cap_pi(sk)->scid = 0x0001; 223 l2cap_pi(sk)->scid = L2CAP_CID_SIGNALING;
224 l2cap_pi(sk)->dcid = 0x0001; 224 l2cap_pi(sk)->dcid = L2CAP_CID_SIGNALING;
225 l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU; 225 l2cap_pi(sk)->omtu = L2CAP_DEFAULT_MTU;
226 } 226 }
227 227
@@ -1598,7 +1598,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
1598 1598
1599 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); 1599 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
1600 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); 1600 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen);
1601 lh->cid = cpu_to_le16(0x0001); 1601 lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING);
1602 1602
1603 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); 1603 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE);
1604 cmd->code = code; 1604 cmd->code = code;
@@ -2420,11 +2420,11 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
2420 BT_DBG("len %d, cid 0x%4.4x", len, cid); 2420 BT_DBG("len %d, cid 0x%4.4x", len, cid);
2421 2421
2422 switch (cid) { 2422 switch (cid) {
2423 case 0x0001: 2423 case L2CAP_CID_SIGNALING:
2424 l2cap_sig_channel(conn, skb); 2424 l2cap_sig_channel(conn, skb);
2425 break; 2425 break;
2426 2426
2427 case 0x0002: 2427 case L2CAP_CID_CONN_LESS:
2428 psm = get_unaligned((__le16 *) skb->data); 2428 psm = get_unaligned((__le16 *) skb->data);
2429 skb_pull(skb, 2); 2429 skb_pull(skb, 2);
2430 l2cap_conless_channel(conn, psm, skb); 2430 l2cap_conless_channel(conn, psm, skb);