aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap.c19
-rw-r--r--net/bluetooth/rfcomm/core.c12
2 files changed, 16 insertions, 15 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);
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 374536e050aa..e50566ebf9f9 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -679,7 +679,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
679 679
680 bacpy(&addr.l2_bdaddr, dst); 680 bacpy(&addr.l2_bdaddr, dst);
681 addr.l2_family = AF_BLUETOOTH; 681 addr.l2_family = AF_BLUETOOTH;
682 addr.l2_psm = htobs(RFCOMM_PSM); 682 addr.l2_psm = cpu_to_le16(RFCOMM_PSM);
683 addr.l2_cid = 0; 683 addr.l2_cid = 0;
684 *err = kernel_connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); 684 *err = kernel_connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK);
685 if (*err == 0 || *err == -EINPROGRESS) 685 if (*err == 0 || *err == -EINPROGRESS)
@@ -852,9 +852,9 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d
852 } 852 }
853 853
854 if (cr && channel_mtu >= 0) 854 if (cr && channel_mtu >= 0)
855 pn->mtu = htobs(channel_mtu); 855 pn->mtu = cpu_to_le16(channel_mtu);
856 else 856 else
857 pn->mtu = htobs(d->mtu); 857 pn->mtu = cpu_to_le16(d->mtu);
858 858
859 *ptr = __fcs(buf); ptr++; 859 *ptr = __fcs(buf); ptr++;
860 860
@@ -1056,7 +1056,7 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr)
1056 1056
1057 if (len > 127) { 1057 if (len > 127) {
1058 hdr = (void *) skb_push(skb, 4); 1058 hdr = (void *) skb_push(skb, 4);
1059 put_unaligned(htobs(__len16(len)), (__le16 *) &hdr->len); 1059 put_unaligned(cpu_to_le16(__len16(len)), (__le16 *) &hdr->len);
1060 } else { 1060 } else {
1061 hdr = (void *) skb_push(skb, 3); 1061 hdr = (void *) skb_push(skb, 3);
1062 hdr->len = __len8(len); 1062 hdr->len = __len8(len);
@@ -1289,7 +1289,7 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)
1289 1289
1290 d->priority = pn->priority; 1290 d->priority = pn->priority;
1291 1291
1292 d->mtu = btohs(pn->mtu); 1292 d->mtu = __le16_to_cpu(pn->mtu);
1293 1293
1294 if (cr && d->mtu > s->mtu) 1294 if (cr && d->mtu > s->mtu)
1295 d->mtu = s->mtu; 1295 d->mtu = s->mtu;
@@ -1922,7 +1922,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
1922 /* Bind socket */ 1922 /* Bind socket */
1923 bacpy(&addr.l2_bdaddr, ba); 1923 bacpy(&addr.l2_bdaddr, ba);
1924 addr.l2_family = AF_BLUETOOTH; 1924 addr.l2_family = AF_BLUETOOTH;
1925 addr.l2_psm = htobs(RFCOMM_PSM); 1925 addr.l2_psm = cpu_to_le16(RFCOMM_PSM);
1926 addr.l2_cid = 0; 1926 addr.l2_cid = 0;
1927 err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr)); 1927 err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
1928 if (err < 0) { 1928 if (err < 0) {