diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-07-29 03:16:36 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-31 05:28:07 -0400 |
commit | 8e036fc3143646dc304356fa50314681d654363f (patch) | |
tree | 11ba34d6977b95f69b96a8a91f2902e2672d8fad /net/bluetooth | |
parent | 6dc0c2082b8acf30c9239fbbcc051eebdaf7ecff (diff) |
[BLUETOOTH] l2cap: endianness annotations
no code changes, just documenting existing types
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index b82cbdd1fcb1..09126bf06840 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -353,7 +353,7 @@ static inline int l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 | |||
353 | } | 353 | } |
354 | 354 | ||
355 | /* ---- Socket interface ---- */ | 355 | /* ---- Socket interface ---- */ |
356 | static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src) | 356 | static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src) |
357 | { | 357 | { |
358 | struct sock *sk; | 358 | struct sock *sk; |
359 | struct hlist_node *node; | 359 | struct hlist_node *node; |
@@ -368,7 +368,7 @@ found: | |||
368 | /* Find socket with psm and source bdaddr. | 368 | /* Find socket with psm and source bdaddr. |
369 | * Returns closest match. | 369 | * Returns closest match. |
370 | */ | 370 | */ |
371 | static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | 371 | static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) |
372 | { | 372 | { |
373 | struct sock *sk = NULL, *sk1 = NULL; | 373 | struct sock *sk = NULL, *sk1 = NULL; |
374 | struct hlist_node *node; | 374 | struct hlist_node *node; |
@@ -392,7 +392,7 @@ static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | |||
392 | 392 | ||
393 | /* Find socket with given address (psm, src). | 393 | /* Find socket with given address (psm, src). |
394 | * Returns locked socket */ | 394 | * Returns locked socket */ |
395 | static inline struct sock *l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src) | 395 | static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) |
396 | { | 396 | { |
397 | struct sock *s; | 397 | struct sock *s; |
398 | read_lock(&l2cap_sk_list.lock); | 398 | read_lock(&l2cap_sk_list.lock); |
@@ -586,7 +586,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ | |||
586 | goto done; | 586 | goto done; |
587 | } | 587 | } |
588 | 588 | ||
589 | if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 && | 589 | if (la->l2_psm && btohs(la->l2_psm) < 0x1001 && |
590 | !capable(CAP_NET_BIND_SERVICE)) { | 590 | !capable(CAP_NET_BIND_SERVICE)) { |
591 | err = -EACCES; | 591 | err = -EACCES; |
592 | goto done; | 592 | goto done; |
@@ -873,7 +873,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len) | |||
873 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); | 873 | lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE)); |
874 | 874 | ||
875 | if (sk->sk_type == SOCK_DGRAM) | 875 | if (sk->sk_type == SOCK_DGRAM) |
876 | put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2)); | 876 | put_unaligned(l2cap_pi(sk)->psm, (__le16 *) skb_put(skb, 2)); |
877 | 877 | ||
878 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { | 878 | if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) { |
879 | err = -EFAULT; | 879 | err = -EFAULT; |
@@ -1256,11 +1256,11 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned | |||
1256 | break; | 1256 | break; |
1257 | 1257 | ||
1258 | case 2: | 1258 | case 2: |
1259 | *val = __le16_to_cpu(*((u16 *)opt->val)); | 1259 | *val = __le16_to_cpu(*((__le16 *)opt->val)); |
1260 | break; | 1260 | break; |
1261 | 1261 | ||
1262 | case 4: | 1262 | case 4: |
1263 | *val = __le32_to_cpu(*((u32 *)opt->val)); | 1263 | *val = __le32_to_cpu(*((__le32 *)opt->val)); |
1264 | break; | 1264 | break; |
1265 | 1265 | ||
1266 | default: | 1266 | default: |
@@ -1287,11 +1287,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val) | |||
1287 | break; | 1287 | break; |
1288 | 1288 | ||
1289 | case 2: | 1289 | case 2: |
1290 | *((u16 *) opt->val) = cpu_to_le16(val); | 1290 | *((__le16 *) opt->val) = cpu_to_le16(val); |
1291 | break; | 1291 | break; |
1292 | 1292 | ||
1293 | case 4: | 1293 | case 4: |
1294 | *((u32 *) opt->val) = cpu_to_le32(val); | 1294 | *((__le32 *) opt->val) = cpu_to_le32(val); |
1295 | break; | 1295 | break; |
1296 | 1296 | ||
1297 | default: | 1297 | default: |
@@ -1406,7 +1406,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1406 | int result = 0, status = 0; | 1406 | int result = 0, status = 0; |
1407 | 1407 | ||
1408 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); | 1408 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); |
1409 | u16 psm = req->psm; | 1409 | __le16 psm = req->psm; |
1410 | 1410 | ||
1411 | BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid); | 1411 | BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid); |
1412 | 1412 | ||
@@ -1863,7 +1863,7 @@ done: | |||
1863 | return 0; | 1863 | return 0; |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | static inline int l2cap_conless_channel(struct l2cap_conn *conn, u16 psm, struct sk_buff *skb) | 1866 | static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, struct sk_buff *skb) |
1867 | { | 1867 | { |
1868 | struct sock *sk; | 1868 | struct sock *sk; |
1869 | 1869 | ||
@@ -1893,7 +1893,8 @@ done: | |||
1893 | static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) | 1893 | static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) |
1894 | { | 1894 | { |
1895 | struct l2cap_hdr *lh = (void *) skb->data; | 1895 | struct l2cap_hdr *lh = (void *) skb->data; |
1896 | u16 cid, psm, len; | 1896 | u16 cid, len; |
1897 | __le16 psm; | ||
1897 | 1898 | ||
1898 | skb_pull(skb, L2CAP_HDR_SIZE); | 1899 | skb_pull(skb, L2CAP_HDR_SIZE); |
1899 | cid = __le16_to_cpu(lh->cid); | 1900 | cid = __le16_to_cpu(lh->cid); |
@@ -1907,7 +1908,7 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1907 | break; | 1908 | break; |
1908 | 1909 | ||
1909 | case 0x0002: | 1910 | case 0x0002: |
1910 | psm = get_unaligned((u16 *) skb->data); | 1911 | psm = get_unaligned((__le16 *) skb->data); |
1911 | skb_pull(skb, 2); | 1912 | skb_pull(skb, 2); |
1912 | l2cap_conless_channel(conn, psm, skb); | 1913 | l2cap_conless_channel(conn, psm, skb); |
1913 | break; | 1914 | break; |