Commit aca3192c authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[NET] BLUETOOTH: Use cpu_to_le{16,32}() where appropriate.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent acde4855
...@@ -72,11 +72,11 @@ void hci_acl_connect(struct hci_conn *conn) ...@@ -72,11 +72,11 @@ void hci_acl_connect(struct hci_conn *conn)
inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) { inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) {
cp.pscan_rep_mode = ie->data.pscan_rep_mode; cp.pscan_rep_mode = ie->data.pscan_rep_mode;
cp.pscan_mode = ie->data.pscan_mode; cp.pscan_mode = ie->data.pscan_mode;
cp.clock_offset = ie->data.clock_offset | __cpu_to_le16(0x8000); cp.clock_offset = ie->data.clock_offset | cpu_to_le16(0x8000);
memcpy(conn->dev_class, ie->data.dev_class, 3); memcpy(conn->dev_class, ie->data.dev_class, 3);
} }
cp.pkt_type = __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK); cp.pkt_type = cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK);
if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER)) if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER))
cp.role_switch = 0x01; cp.role_switch = 0x01;
else else
...@@ -107,7 +107,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason) ...@@ -107,7 +107,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
conn->state = BT_DISCONN; conn->state = BT_DISCONN;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
cp.reason = reason; cp.reason = reason;
hci_send_cmd(conn->hdev, OGF_LINK_CTL, hci_send_cmd(conn->hdev, OGF_LINK_CTL,
OCF_DISCONNECT, sizeof(cp), &cp); OCF_DISCONNECT, sizeof(cp), &cp);
...@@ -123,8 +123,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle) ...@@ -123,8 +123,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle)
conn->state = BT_CONNECT; conn->state = BT_CONNECT;
conn->out = 1; conn->out = 1;
cp.pkt_type = __cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); cp.pkt_type = cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);
cp.handle = __cpu_to_le16(handle); cp.handle = cpu_to_le16(handle);
hci_send_cmd(hdev, OGF_LINK_CTL, OCF_ADD_SCO, sizeof(cp), &cp); hci_send_cmd(hdev, OGF_LINK_CTL, OCF_ADD_SCO, sizeof(cp), &cp);
} }
...@@ -348,7 +348,7 @@ int hci_conn_auth(struct hci_conn *conn) ...@@ -348,7 +348,7 @@ int hci_conn_auth(struct hci_conn *conn)
if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
struct hci_cp_auth_requested cp; struct hci_cp_auth_requested cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_AUTH_REQUESTED, sizeof(cp), &cp); hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_AUTH_REQUESTED, sizeof(cp), &cp);
} }
return 0; return 0;
...@@ -368,7 +368,7 @@ int hci_conn_encrypt(struct hci_conn *conn) ...@@ -368,7 +368,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
if (hci_conn_auth(conn)) { if (hci_conn_auth(conn)) {
struct hci_cp_set_conn_encrypt cp; struct hci_cp_set_conn_encrypt cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
cp.encrypt = 1; cp.encrypt = 1;
hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp); hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp);
} }
...@@ -383,7 +383,7 @@ int hci_conn_change_link_key(struct hci_conn *conn) ...@@ -383,7 +383,7 @@ int hci_conn_change_link_key(struct hci_conn *conn)
if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
struct hci_cp_change_conn_link_key cp; struct hci_cp_change_conn_link_key cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_CHANGE_CONN_LINK_KEY, sizeof(cp), &cp); hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_CHANGE_CONN_LINK_KEY, sizeof(cp), &cp);
} }
return 0; return 0;
...@@ -423,7 +423,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn) ...@@ -423,7 +423,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn)
if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) { if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
struct hci_cp_exit_sniff_mode cp; struct hci_cp_exit_sniff_mode cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
hci_send_cmd(hdev, OGF_LINK_POLICY, hci_send_cmd(hdev, OGF_LINK_POLICY,
OCF_EXIT_SNIFF_MODE, sizeof(cp), &cp); OCF_EXIT_SNIFF_MODE, sizeof(cp), &cp);
} }
...@@ -452,21 +452,21 @@ void hci_conn_enter_sniff_mode(struct hci_conn *conn) ...@@ -452,21 +452,21 @@ void hci_conn_enter_sniff_mode(struct hci_conn *conn)
if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) { if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) {
struct hci_cp_sniff_subrate cp; struct hci_cp_sniff_subrate cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
cp.max_latency = __constant_cpu_to_le16(0); cp.max_latency = cpu_to_le16(0);
cp.min_remote_timeout = __constant_cpu_to_le16(0); cp.min_remote_timeout = cpu_to_le16(0);
cp.min_local_timeout = __constant_cpu_to_le16(0); cp.min_local_timeout = cpu_to_le16(0);
hci_send_cmd(hdev, OGF_LINK_POLICY, hci_send_cmd(hdev, OGF_LINK_POLICY,
OCF_SNIFF_SUBRATE, sizeof(cp), &cp); OCF_SNIFF_SUBRATE, sizeof(cp), &cp);
} }
if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) { if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
struct hci_cp_sniff_mode cp; struct hci_cp_sniff_mode cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
cp.max_interval = __cpu_to_le16(hdev->sniff_max_interval); cp.max_interval = cpu_to_le16(hdev->sniff_max_interval);
cp.min_interval = __cpu_to_le16(hdev->sniff_min_interval); cp.min_interval = cpu_to_le16(hdev->sniff_min_interval);
cp.attempt = __constant_cpu_to_le16(4); cp.attempt = cpu_to_le16(4);
cp.timeout = __constant_cpu_to_le16(1); cp.timeout = cpu_to_le16(1);
hci_send_cmd(hdev, OGF_LINK_POLICY, hci_send_cmd(hdev, OGF_LINK_POLICY,
OCF_SNIFF_MODE, sizeof(cp), &cp); OCF_SNIFF_MODE, sizeof(cp), &cp);
} }
......
...@@ -216,10 +216,10 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) ...@@ -216,10 +216,10 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
/* Host buffer size */ /* Host buffer size */
{ {
struct hci_cp_host_buffer_size cp; struct hci_cp_host_buffer_size cp;
cp.acl_mtu = __cpu_to_le16(HCI_MAX_ACL_SIZE); cp.acl_mtu = cpu_to_le16(HCI_MAX_ACL_SIZE);
cp.sco_mtu = HCI_MAX_SCO_SIZE; cp.sco_mtu = HCI_MAX_SCO_SIZE;
cp.acl_max_pkt = __cpu_to_le16(0xffff); cp.acl_max_pkt = cpu_to_le16(0xffff);
cp.sco_max_pkt = __cpu_to_le16(0xffff); cp.sco_max_pkt = cpu_to_le16(0xffff);
hci_send_cmd(hdev, OGF_HOST_CTL, OCF_HOST_BUFFER_SIZE, sizeof(cp), &cp); hci_send_cmd(hdev, OGF_HOST_CTL, OCF_HOST_BUFFER_SIZE, sizeof(cp), &cp);
} }
#endif #endif
...@@ -240,11 +240,11 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) ...@@ -240,11 +240,11 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
} }
/* Page timeout ~20 secs */ /* Page timeout ~20 secs */
param = __cpu_to_le16(0x8000); param = cpu_to_le16(0x8000);
hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_PG_TIMEOUT, 2, &param); hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_PG_TIMEOUT, 2, &param);
/* Connection accept timeout ~20 secs */ /* Connection accept timeout ~20 secs */
param = __cpu_to_le16(0x7d00); param = cpu_to_le16(0x7d00);
hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_CA_TIMEOUT, 2, &param); hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_CA_TIMEOUT, 2, &param);
} }
...@@ -1034,7 +1034,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p ...@@ -1034,7 +1034,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p
} }
hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE); hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE);
hdr->opcode = __cpu_to_le16(hci_opcode_pack(ogf, ocf)); hdr->opcode = cpu_to_le16(hci_opcode_pack(ogf, ocf));
hdr->plen = plen; hdr->plen = plen;
if (plen) if (plen)
...@@ -1060,7 +1060,7 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf) ...@@ -1060,7 +1060,7 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
hdr = (void *) hdev->sent_cmd->data; hdr = (void *) hdev->sent_cmd->data;
if (hdr->opcode != __cpu_to_le16(hci_opcode_pack(ogf, ocf))) if (hdr->opcode != cpu_to_le16(hci_opcode_pack(ogf, ocf)))
return NULL; return NULL;
BT_DBG("%s ogf 0x%x ocf 0x%x", hdev->name, ogf, ocf); BT_DBG("%s ogf 0x%x ocf 0x%x", hdev->name, ogf, ocf);
...@@ -1075,8 +1075,8 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags) ...@@ -1075,8 +1075,8 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags)
int len = skb->len; int len = skb->len;
hdr = (struct hci_acl_hdr *) skb_push(skb, HCI_ACL_HDR_SIZE); hdr = (struct hci_acl_hdr *) skb_push(skb, HCI_ACL_HDR_SIZE);
hdr->handle = __cpu_to_le16(hci_handle_pack(handle, flags)); hdr->handle = cpu_to_le16(hci_handle_pack(handle, flags));
hdr->dlen = __cpu_to_le16(len); hdr->dlen = cpu_to_le16(len);
skb->h.raw = (void *) hdr; skb->h.raw = (void *) hdr;
} }
...@@ -1140,7 +1140,7 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb) ...@@ -1140,7 +1140,7 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
return -EINVAL; return -EINVAL;
} }
hdr.handle = __cpu_to_le16(conn->handle); hdr.handle = cpu_to_le16(conn->handle);
hdr.dlen = skb->len; hdr.dlen = skb->len;
skb->h.raw = skb_push(skb, HCI_SCO_HDR_SIZE); skb->h.raw = skb_push(skb, HCI_SCO_HDR_SIZE);
......
...@@ -783,7 +783,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s ...@@ -783,7 +783,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if (conn->type == ACL_LINK && hdev->link_policy) { if (conn->type == ACL_LINK && hdev->link_policy) {
struct hci_cp_write_link_policy cp; struct hci_cp_write_link_policy cp;
cp.handle = ev->handle; cp.handle = ev->handle;
cp.policy = __cpu_to_le16(hdev->link_policy); cp.policy = cpu_to_le16(hdev->link_policy);
hci_send_cmd(hdev, OGF_LINK_POLICY, hci_send_cmd(hdev, OGF_LINK_POLICY,
OCF_WRITE_LINK_POLICY, sizeof(cp), &cp); OCF_WRITE_LINK_POLICY, sizeof(cp), &cp);
} }
...@@ -793,8 +793,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s ...@@ -793,8 +793,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
struct hci_cp_change_conn_ptype cp; struct hci_cp_change_conn_ptype cp;
cp.handle = ev->handle; cp.handle = ev->handle;
cp.pkt_type = (conn->type == ACL_LINK) ? cp.pkt_type = (conn->type == ACL_LINK) ?
__cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK): cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK):
__cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);
hci_send_cmd(hdev, OGF_LINK_CTL, hci_send_cmd(hdev, OGF_LINK_CTL,
OCF_CHANGE_CONN_PTYPE, sizeof(cp), &cp); OCF_CHANGE_CONN_PTYPE, sizeof(cp), &cp);
...@@ -970,7 +970,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s ...@@ -970,7 +970,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) { if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) {
if (!ev->status) { if (!ev->status) {
struct hci_cp_set_conn_encrypt cp; struct hci_cp_set_conn_encrypt cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = cpu_to_le16(conn->handle);
cp.encrypt = 1; cp.encrypt = 1;
hci_send_cmd(conn->hdev, OGF_LINK_CTL, hci_send_cmd(conn->hdev, OGF_LINK_CTL,
OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp); OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp);
......
...@@ -459,8 +459,8 @@ static void __l2cap_sock_close(struct sock *sk, int reason) ...@@ -459,8 +459,8 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
sk->sk_state = BT_DISCONN; sk->sk_state = BT_DISCONN;
l2cap_sock_set_timer(sk, sk->sk_sndtimeo); l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);
req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
l2cap_send_cmd(conn, l2cap_get_ident(conn), l2cap_send_cmd(conn, l2cap_get_ident(conn),
L2CAP_DISCONN_REQ, sizeof(req), &req); L2CAP_DISCONN_REQ, sizeof(req), &req);
} else { } else {
...@@ -652,7 +652,7 @@ static int l2cap_do_connect(struct sock *sk) ...@@ -652,7 +652,7 @@ static int l2cap_do_connect(struct sock *sk)
if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_type == SOCK_SEQPACKET) {
struct l2cap_conn_req req; struct l2cap_conn_req req;
l2cap_pi(sk)->ident = l2cap_get_ident(conn); l2cap_pi(sk)->ident = l2cap_get_ident(conn);
req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
req.psm = l2cap_pi(sk)->psm; req.psm = l2cap_pi(sk)->psm;
l2cap_send_cmd(conn, l2cap_pi(sk)->ident, l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
L2CAP_CONN_REQ, sizeof(req), &req); 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,8 +868,8 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
/* Create L2CAP header */ /* Create L2CAP header */
lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
lh->cid = __cpu_to_le16(l2cap_pi(sk)->dcid); lh->cid = cpu_to_le16(l2cap_pi(sk)->dcid);
lh->len = __cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
if (sk->sk_type == SOCK_DGRAM) if (sk->sk_type == SOCK_DGRAM)
put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2)); 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,7 +1096,7 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
} else if (sk->sk_state == BT_CONNECT) { } else if (sk->sk_state == BT_CONNECT) {
struct l2cap_conn_req req; struct l2cap_conn_req req;
l2cap_pi(sk)->ident = l2cap_get_ident(conn); l2cap_pi(sk)->ident = l2cap_get_ident(conn);
req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
req.psm = l2cap_pi(sk)->psm; req.psm = l2cap_pi(sk)->psm;
l2cap_send_cmd(conn, l2cap_pi(sk)->ident, L2CAP_CONN_REQ, sizeof(req), &req); l2cap_send_cmd(conn, l2cap_pi(sk)->ident, L2CAP_CONN_REQ, sizeof(req), &req);
} }
...@@ -1192,13 +1192,13 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, ...@@ -1192,13 +1192,13 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
return NULL; return NULL;
lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE); lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
lh->len = __cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen);
lh->cid = __cpu_to_le16(0x0001); lh->cid = cpu_to_le16(0x0001);
cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE);
cmd->code = code; cmd->code = code;
cmd->ident = ident; cmd->ident = ident;
cmd->len = __cpu_to_le16(dlen); cmd->len = cpu_to_le16(dlen);
if (dlen) { if (dlen) {
count -= L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE; 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,11 +1316,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
break; break;
case 2: case 2:
*((u16 *) opt->val) = __cpu_to_le16(val); *((u16 *) opt->val) = cpu_to_le16(val);
break; break;
case 4: case 4:
*((u32 *) opt->val) = __cpu_to_le32(val); *((u32 *) opt->val) = cpu_to_le32(val);
break; break;
default: default:
...@@ -1346,8 +1346,8 @@ static int l2cap_build_conf_req(struct sock *sk, void *data) ...@@ -1346,8 +1346,8 @@ static int l2cap_build_conf_req(struct sock *sk, void *data)
//if (flush_to != L2CAP_DEFAULT_FLUSH_TO) //if (flush_to != L2CAP_DEFAULT_FLUSH_TO)
// l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to); // l2cap_add_conf_opt(&ptr, L2CAP_CONF_FLUSH_TO, 2, pi->flush_to);
req->dcid = __cpu_to_le16(pi->dcid); req->dcid = cpu_to_le16(pi->dcid);
req->flags = __cpu_to_le16(0); req->flags = cpu_to_le16(0);
return ptr - data; return ptr - data;
} }
...@@ -1383,9 +1383,9 @@ static int l2cap_build_conf_rsp(struct sock *sk, void *data, int *result) ...@@ -1383,9 +1383,9 @@ static int l2cap_build_conf_rsp(struct sock *sk, void *data, int *result)
else else
flags = 0x0001; flags = 0x0001;
rsp->scid = __cpu_to_le16(l2cap_pi(sk)->dcid); rsp->scid = cpu_to_le16(l2cap_pi(sk)->dcid);
rsp->result = __cpu_to_le16(result ? *result : 0); rsp->result = cpu_to_le16(result ? *result : 0);
rsp->flags = __cpu_to_le16(flags); rsp->flags = cpu_to_le16(flags);
return ptr - data; return ptr - data;
} }
...@@ -1470,10 +1470,10 @@ response: ...@@ -1470,10 +1470,10 @@ response:
bh_unlock_sock(parent); bh_unlock_sock(parent);
sendresp: sendresp:
rsp.scid = __cpu_to_le16(scid); rsp.scid = cpu_to_le16(scid);
rsp.dcid = __cpu_to_le16(dcid); rsp.dcid = cpu_to_le16(dcid);
rsp.result = __cpu_to_le16(result); rsp.result = cpu_to_le16(result);
rsp.status = __cpu_to_le16(status); rsp.status = cpu_to_le16(status);
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp); l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp);
return 0; return 0;
} }
...@@ -1613,8 +1613,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr ...@@ -1613,8 +1613,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
l2cap_sock_set_timer(sk, HZ * 5); l2cap_sock_set_timer(sk, HZ * 5);
{ {
struct l2cap_disconn_req req; struct l2cap_disconn_req req;
req.dcid = __cpu_to_le16(l2cap_pi(sk)->dcid); req.dcid = cpu_to_le16(l2cap_pi(sk)->dcid);
req.scid = __cpu_to_le16(l2cap_pi(sk)->scid); req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
l2cap_send_cmd(conn, l2cap_get_ident(conn), l2cap_send_cmd(conn, l2cap_get_ident(conn),
L2CAP_DISCONN_REQ, sizeof(req), &req); L2CAP_DISCONN_REQ, sizeof(req), &req);
} }
...@@ -1652,8 +1652,8 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd ...@@ -1652,8 +1652,8 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid))) if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid)))
return 0; return 0;
rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
l2cap_send_cmd(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp); l2cap_send_cmd(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp);
sk->sk_shutdown = SHUTDOWN_MASK; sk->sk_shutdown = SHUTDOWN_MASK;
...@@ -1696,8 +1696,8 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm ...@@ -1696,8 +1696,8 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
BT_DBG("type 0x%4.4x", type); BT_DBG("type 0x%4.4x", type);
rsp.type = __cpu_to_le16(type); rsp.type = cpu_to_le16(type);
rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP); rsp.result = cpu_to_le16(L2CAP_IR_NOTSUPP);
l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp); l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp);
return 0; return 0;
...@@ -1794,7 +1794,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk ...@@ -1794,7 +1794,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
BT_DBG("error %d", err); BT_DBG("error %d", err);
/* FIXME: Map err to a valid reason */ /* FIXME: Map err to a valid reason */
rej.reason = __cpu_to_le16(0); rej.reason = cpu_to_le16(0);
l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
} }
...@@ -1993,10 +1993,10 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status) ...@@ -1993,10 +1993,10 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status)
result = L2CAP_CR_SEC_BLOCK; result = L2CAP_CR_SEC_BLOCK;
} }
rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
rsp.result = __cpu_to_le16(result); rsp.result = cpu_to_le16(result);
rsp.status = __cpu_to_le16(0); rsp.status = cpu_to_le16(0);
l2cap_send_cmd(conn, l2cap_pi(sk)->ident, l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
L2CAP_CONN_RSP, sizeof(rsp), &rsp); L2CAP_CONN_RSP, sizeof(rsp), &rsp);
...@@ -2041,10 +2041,10 @@ static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status) ...@@ -2041,10 +2041,10 @@ static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status)
result = L2CAP_CR_SEC_BLOCK; result = L2CAP_CR_SEC_BLOCK;
} }
rsp.scid = __cpu_to_le16(l2cap_pi(sk)->dcid); rsp.scid = cpu_to_le16(l2cap_pi(sk)->dcid);
rsp.dcid = __cpu_to_le16(l2cap_pi(sk)->scid); rsp.dcid = cpu_to_le16(l2cap_pi(sk)->scid);
rsp.result = __cpu_to_le16(result); rsp.result = cpu_to_le16(result);
rsp.status = __cpu_to_le16(0); rsp.status = cpu_to_le16(0);
l2cap_send_cmd(conn, l2cap_pi(sk)->ident, l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
L2CAP_CONN_RSP, sizeof(rsp), &rsp); L2CAP_CONN_RSP, sizeof(rsp), &rsp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment