diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-06-07 12:06:51 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-06-08 08:50:01 -0400 |
commit | b4324b5dc5b62ba76372e1bf8927230cf744df66 (patch) | |
tree | 0827bb177760bd2bdac41fbf6466eb1c825b9d88 /net/bluetooth/l2cap.c | |
parent | 47ec1dcd696d56a7c396e5838516a566ecd4b03d (diff) |
Bluetooth: Remove pointless endian conversion helpers
The Bluetooth source uses some endian conversion helpers, that in the end
translate to kernel standard routines. So remove this obfuscation since it
is fully pointless.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 338295007c4b..bd0a4c1bced0 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -812,7 +812,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
812 | goto done; | 812 | goto done; |
813 | } | 813 | } |
814 | 814 | ||
815 | if (la.l2_psm && btohs(la.l2_psm) < 0x1001 && | 815 | if (la.l2_psm && __le16_to_cpu(la.l2_psm) < 0x1001 && |
816 | !capable(CAP_NET_BIND_SERVICE)) { | 816 | !capable(CAP_NET_BIND_SERVICE)) { |
817 | err = -EACCES; | 817 | err = -EACCES; |
818 | goto done; | 818 | goto done; |
@@ -829,7 +829,8 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
829 | l2cap_pi(sk)->sport = la.l2_psm; | 829 | l2cap_pi(sk)->sport = la.l2_psm; |
830 | sk->sk_state = BT_BOUND; | 830 | sk->sk_state = BT_BOUND; |
831 | 831 | ||
832 | if (btohs(la.l2_psm) == 0x0001 || btohs(la.l2_psm) == 0x0003) | 832 | if (__le16_to_cpu(la.l2_psm) == 0x0001 || |
833 | __le16_to_cpu(la.l2_psm) == 0x0003) | ||
833 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; | 834 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; |
834 | } | 835 | } |
835 | 836 | ||
@@ -1015,9 +1016,9 @@ static int l2cap_sock_listen(struct socket *sock, int backlog) | |||
1015 | write_lock_bh(&l2cap_sk_list.lock); | 1016 | write_lock_bh(&l2cap_sk_list.lock); |
1016 | 1017 | ||
1017 | for (psm = 0x1001; psm < 0x1100; psm += 2) | 1018 | for (psm = 0x1001; psm < 0x1100; psm += 2) |
1018 | if (!__l2cap_get_sock_by_addr(htobs(psm), src)) { | 1019 | if (!__l2cap_get_sock_by_addr(cpu_to_le16(psm), src)) { |
1019 | l2cap_pi(sk)->psm = htobs(psm); | 1020 | l2cap_pi(sk)->psm = cpu_to_le16(psm); |
1020 | l2cap_pi(sk)->sport = htobs(psm); | 1021 | l2cap_pi(sk)->sport = cpu_to_le16(psm); |
1021 | err = 0; | 1022 | err = 0; |
1022 | break; | 1023 | break; |
1023 | } | 1024 | } |
@@ -1106,11 +1107,11 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l | |||
1106 | if (peer) { | 1107 | if (peer) { |
1107 | la->l2_psm = l2cap_pi(sk)->psm; | 1108 | la->l2_psm = l2cap_pi(sk)->psm; |
1108 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); | 1109 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst); |
1109 | la->l2_cid = htobs(l2cap_pi(sk)->dcid); | 1110 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->dcid); |
1110 | } else { | 1111 | } else { |
1111 | la->l2_psm = l2cap_pi(sk)->sport; | 1112 | la->l2_psm = l2cap_pi(sk)->sport; |
1112 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); | 1113 | bacpy(&la->l2_bdaddr, &bt_sk(sk)->src); |
1113 | la->l2_cid = htobs(l2cap_pi(sk)->scid); | 1114 | la->l2_cid = cpu_to_le16(l2cap_pi(sk)->scid); |
1114 | } | 1115 | } |
1115 | 1116 | ||
1116 | return 0; | 1117 | return 0; |
@@ -2720,8 +2721,8 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) | |||
2720 | 2721 | ||
2721 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", | 2722 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", |
2722 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | 2723 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
2723 | sk->sk_state, btohs(pi->psm), pi->scid, pi->dcid, | 2724 | sk->sk_state, __le16_to_cpu(pi->psm), pi->scid, |
2724 | pi->imtu, pi->omtu, pi->sec_level); | 2725 | pi->dcid, pi->imtu, pi->omtu, pi->sec_level); |
2725 | } | 2726 | } |
2726 | 2727 | ||
2727 | read_unlock_bh(&l2cap_sk_list.lock); | 2728 | read_unlock_bh(&l2cap_sk_list.lock); |