aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-03-25 23:12:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:23:54 -0400
commitaca3192cc60d2bf193c2252e45563c32e3117289 (patch)
treed73dc39ae9c9f499a026c56517604af21d63bfd9 /net/bluetooth/l2cap.c
parentacde4855bb8f5fba8bb065d35ff6ac8a94b3dfa8 (diff)
[NET] BLUETOOTH: Use cpu_to_le{16,32}() where appropriate.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index e83ee82440d3..162eab6a4478 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -459,8 +459,8 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
459 sk->sk_state = BT_DISCONN; 459 sk->sk_state = BT_DISCONN;
460 l2cap_sock_set_timer(sk, sk->sk_sndtimeo); 460 l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
461 461
462 req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); 462 req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);
463 req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); 463 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
464 l2cap_send_cmd(conn, l2cap_get_ident(conn), 464 l2cap_send_cmd(conn, l2cap_get_ident(conn),
465 L2CAP_DISCONN_REQ, sizeof(req), &req); 465 L2CAP_DISCONN_REQ, sizeof(req), &req);
466 } else { 466 } else {
@@ -652,7 +652,7 @@ static int l2cap_do_connect(struct sock *sk)
652 if (sk->sk_type == SOCK_SEQPACKET) { 652 if (sk->sk_type == SOCK_SEQPACKET) {
653 struct l2cap_conn_req req; 653 struct l2cap_conn_req req;
654 l2cap_pi(sk)->ident = l2cap_get_ident(conn); 654 l2cap_pi(sk)->ident = l2cap_get_ident(conn);
655 req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); 655 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
656 req.psm = l2cap_pi(sk)->psm; 656 req.psm = l2cap_pi(sk)->psm;
657 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 657 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
658 L2CAP_CONN_REQ, sizeof(req), &req); 658 L2CAP_CONN_REQ, sizeof(req), &req);
@@ -868,8 +868,8 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
868 868
869 /* Create L2CAP header */ 869 /* Create L2CAP header */
870 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); 870 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
871 lh->cid = __cpu_to_le16(l2cap_pi(sk)->dcid); 871 lh->cid = cpu_to_le16(l2cap_pi(sk)->dcid);
872 lh->len = __cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); 872 lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
873 873
874 if (sk->sk_type == SOCK_DGRAM) 874 if (sk->sk_type == SOCK_DGRAM)
875 put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2)); 875 put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2));
@@ -1096,7 +1096,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
1096 } else if (sk->sk_state == BT_CONNECT) { 1096 } else if (sk->sk_state == BT_CONNECT) {
1097 struct l2cap_conn_req req; 1097 struct l2cap_conn_req req;
1098 l2cap_pi(sk)->ident = l2cap_get_ident(conn); 1098 l2cap_pi(sk)->ident = l2cap_get_ident(conn);
1099 req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); 1099 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
1100 req.psm = l2cap_pi(sk)->psm; 1100 req.psm = l2cap_pi(sk)->psm;
1101 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, L2CAP_CONN_REQ, sizeof(req), &req); 1101 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, L2CAP_CONN_REQ, sizeof(req), &req);
1102 } 1102 }
@@ -1192,13 +1192,13 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
1192 return NULL; 1192 return NULL;
1193 1193
1194 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); 1194 lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
1195 lh->len = __cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); 1195 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen);
1196 lh->cid = __cpu_to_le16(0x0001); 1196 lh->cid = cpu_to_le16(0x0001);
1197 1197
1198 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); 1198 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE);
1199 cmd->code = code; 1199 cmd->code = code;
1200 cmd->ident = ident; 1200 cmd->ident = ident;
1201 cmd->len = __cpu_to_le16(dlen); 1201 cmd->len = cpu_to_le16(dlen);
1202 1202
1203 if (dlen) { 1203 if (dlen) {
1204 count -= L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE; 1204 count -= L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE;
@@ -1316,11 +1316,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
1316 break; 1316 break;
1317 1317
1318 case 2: 1318 case 2:
1319 *((u16 *) opt->val) = __cpu_to_le16(val); 1319 *((u16 *) opt->val) = cpu_to_le16(val);
1320 break; 1320 break;
1321 1321
1322 case 4: 1322 case 4:
1323 *((u32 *) opt->val) = __cpu_to_le32(val); 1323 *((u32 *) opt->val) = cpu_to_le32(val);
1324 break; 1324 break;
1325 1325
1326 default: 1326 default:
@@ -1346,8 +1346,8 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
1346 //if (flush_to != L2CAP_DEFAULT_FLUSH_TO) 1346 //if (flush_to != L2CAP_DEFAULT_FLUSH_TO)
1347 // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); 1347 // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to);
1348 1348
1349 req->dcid = __cpu_to_le16(pi->dcid); 1349 req->dcid = cpu_to_le16(pi->dcid);
1350 req->flags = __cpu_to_le16(0); 1350 req->flags = cpu_to_le16(0);
1351 1351
1352 return ptr - data; 1352 return ptr - data;
1353} 1353}
@@ -1383,9 +1383,9 @@ static int l2cap_build_conf_rsp(struct sock *sk, void *data, int *result)
1383 else 1383 else
1384 flags = 0x0001; 1384 flags = 0x0001;
1385 1385
1386 rsp->scid = __cpu_to_le16(l2cap_pi(sk)->dcid); 1386 rsp->scid = cpu_to_le16(l2cap_pi(sk)->dcid);
1387 rsp->result = __cpu_to_le16(result ? *result : 0); 1387 rsp->result = cpu_to_le16(result ? *result : 0);
1388 rsp->flags = __cpu_to_le16(flags); 1388 rsp->flags = cpu_to_le16(flags);
1389 1389
1390 return ptr - data; 1390 return ptr - data;
1391} 1391}
@@ -1470,10 +1470,10 @@ response:
1470 bh_unlock_sock(parent); 1470 bh_unlock_sock(parent);
1471 1471
1472sendresp: 1472sendresp:
1473 rsp.scid = __cpu_to_le16(scid); 1473 rsp.scid = cpu_to_le16(scid);
1474 rsp.dcid = __cpu_to_le16(dcid); 1474 rsp.dcid = cpu_to_le16(dcid);
1475 rsp.result = __cpu_to_le16(result); 1475 rsp.result = cpu_to_le16(result);
1476 rsp.status = __cpu_to_le16(status); 1476 rsp.status = cpu_to_le16(status);
1477 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp); 1477 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp);
1478 return 0; 1478 return 0;
1479} 1479}
@@ -1613,8 +1613,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
1613 l2cap_sock_set_timer(sk, HZ * 5); 1613 l2cap_sock_set_timer(sk, HZ * 5);
1614 { 1614 {
1615 struct l2cap_disconn_req req; 1615 struct l2cap_disconn_req req;
1616 req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); 1616 req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);
1617 req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); 1617 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
1618 l2cap_send_cmd(conn, l2cap_get_ident(conn), 1618 l2cap_send_cmd(conn, l2cap_get_ident(conn),
1619 L2CAP_DISCONN_REQ, sizeof(req), &req); 1619 L2CAP_DISCONN_REQ, sizeof(req), &req);
1620 } 1620 }
@@ -1652,8 +1652,8 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
1652 if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid))) 1652 if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid)))
1653 return 0; 1653 return 0;
1654 1654
1655 rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); 1655 rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
1656 rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); 1656 rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
1657 l2cap_send_cmd(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp); 1657 l2cap_send_cmd(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp);
1658 1658
1659 sk->sk_shutdown = SHUTDOWN_MASK; 1659 sk->sk_shutdown = SHUTDOWN_MASK;
@@ -1696,8 +1696,8 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
1696 1696
1697 BT_DBG("type 0x%4.4x", type); 1697 BT_DBG("type 0x%4.4x", type);
1698 1698
1699 rsp.type = __cpu_to_le16(type); 1699 rsp.type = cpu_to_le16(type);
1700 rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP); 1700 rsp.result = cpu_to_le16(L2CAP_IR_NOTSUPP);
1701 l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp); 1701 l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp);
1702 1702
1703 return 0; 1703 return 0;
@@ -1794,7 +1794,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
1794 BT_DBG("error %d", err); 1794 BT_DBG("error %d", err);
1795 1795
1796 /* FIXME: Map err to a valid reason */ 1796 /* FIXME: Map err to a valid reason */
1797 rej.reason = __cpu_to_le16(0); 1797 rej.reason = cpu_to_le16(0);
1798 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); 1798 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
1799 } 1799 }
1800 1800
@@ -1993,10 +1993,10 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status)
1993 result = L2CAP_CR_SEC_BLOCK; 1993 result = L2CAP_CR_SEC_BLOCK;
1994 } 1994 }
1995 1995
1996 rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); 1996 rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
1997 rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); 1997 rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
1998 rsp.result = __cpu_to_le16(result); 1998 rsp.result = cpu_to_le16(result);
1999 rsp.status = __cpu_to_le16(0); 1999 rsp.status = cpu_to_le16(0);
2000 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 2000 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
2001 L2CAP_CONN_RSP, sizeof(rsp), &rsp); 2001 L2CAP_CONN_RSP, sizeof(rsp), &rsp);
2002 2002
@@ -2041,10 +2041,10 @@ static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status)
2041 result = L2CAP_CR_SEC_BLOCK; 2041 result = L2CAP_CR_SEC_BLOCK;
2042 } 2042 }
2043 2043
2044 rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); 2044 rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
2045 rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); 2045 rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
2046 rsp.result = __cpu_to_le16(result); 2046 rsp.result = cpu_to_le16(result);
2047 rsp.status = __cpu_to_le16(0); 2047 rsp.status = cpu_to_le16(0);
2048 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 2048 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
2049 L2CAP_CONN_RSP, sizeof(rsp), &rsp); 2049 L2CAP_CONN_RSP, sizeof(rsp), &rsp);
2050 2050