aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-01-03 15:16:34 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-03 15:16:34 -0500
commit57adc1fcbae2c13104ce291b40f23e40a414fa87 (patch)
treea22d95cd3a96cbd515cd24fb0833739576c5e92f /net/bluetooth/rfcomm
parentfaa85aa24286a9e14ae7cc797352350c3ac39986 (diff)
parentdc0d633e35643662f27a0b1c531da3cd6b204b9c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/b43/dma.c drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r--net/bluetooth/rfcomm/Kconfig2
-rw-r--r--net/bluetooth/rfcomm/core.c41
2 files changed, 15 insertions, 28 deletions
diff --git a/net/bluetooth/rfcomm/Kconfig b/net/bluetooth/rfcomm/Kconfig
index 405a0e61e7dc..22e718b554e4 100644
--- a/net/bluetooth/rfcomm/Kconfig
+++ b/net/bluetooth/rfcomm/Kconfig
@@ -1,6 +1,6 @@
1config BT_RFCOMM 1config BT_RFCOMM
2 tristate "RFCOMM protocol support" 2 tristate "RFCOMM protocol support"
3 depends on BT && BT_L2CAP 3 depends on BT
4 help 4 help
5 RFCOMM provides connection oriented stream transport. RFCOMM 5 RFCOMM provides connection oriented stream transport. RFCOMM
6 support is required for Dialup Networking, OBEX and other Bluetooth 6 support is required for Dialup Networking, OBEX and other Bluetooth
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index eac849b935a1..501649bf5596 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -65,8 +65,7 @@ static DEFINE_MUTEX(rfcomm_mutex);
65 65
66static LIST_HEAD(session_list); 66static LIST_HEAD(session_list);
67 67
68static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, 68static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len);
69 u32 priority);
70static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci); 69static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci);
71static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci); 70static int rfcomm_send_disc(struct rfcomm_session *s, u8 dlci);
72static int rfcomm_queue_disc(struct rfcomm_dlc *d); 71static int rfcomm_queue_disc(struct rfcomm_dlc *d);
@@ -748,32 +747,23 @@ void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *d
748} 747}
749 748
750/* ---- RFCOMM frame sending ---- */ 749/* ---- RFCOMM frame sending ---- */
751static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len, 750static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len)
752 u32 priority)
753{ 751{
754 struct socket *sock = s->sock;
755 struct sock *sk = sock->sk;
756 struct kvec iv = { data, len }; 752 struct kvec iv = { data, len };
757 struct msghdr msg; 753 struct msghdr msg;
758 754
759 BT_DBG("session %p len %d priority %u", s, len, priority); 755 BT_DBG("session %p len %d", s, len);
760
761 if (sk->sk_priority != priority) {
762 lock_sock(sk);
763 sk->sk_priority = priority;
764 release_sock(sk);
765 }
766 756
767 memset(&msg, 0, sizeof(msg)); 757 memset(&msg, 0, sizeof(msg));
768 758
769 return kernel_sendmsg(sock, &msg, &iv, 1, len); 759 return kernel_sendmsg(s->sock, &msg, &iv, 1, len);
770} 760}
771 761
772static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd) 762static int rfcomm_send_cmd(struct rfcomm_session *s, struct rfcomm_cmd *cmd)
773{ 763{
774 BT_DBG("%p cmd %u", s, cmd->ctrl); 764 BT_DBG("%p cmd %u", s, cmd->ctrl);
775 765
776 return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd), HCI_PRIO_MAX); 766 return rfcomm_send_frame(s, (void *) cmd, sizeof(*cmd));
777} 767}
778 768
779static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci) 769static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci)
@@ -829,8 +819,6 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d)
829 if (!skb) 819 if (!skb)
830 return -ENOMEM; 820 return -ENOMEM;
831 821
832 skb->priority = HCI_PRIO_MAX;
833
834 cmd = (void *) __skb_put(skb, sizeof(*cmd)); 822 cmd = (void *) __skb_put(skb, sizeof(*cmd));
835 cmd->addr = d->addr; 823 cmd->addr = d->addr;
836 cmd->ctrl = __ctrl(RFCOMM_DISC, 1); 824 cmd->ctrl = __ctrl(RFCOMM_DISC, 1);
@@ -878,7 +866,7 @@ static int rfcomm_send_nsc(struct rfcomm_session *s, int cr, u8 type)
878 866
879 *ptr = __fcs(buf); ptr++; 867 *ptr = __fcs(buf); ptr++;
880 868
881 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 869 return rfcomm_send_frame(s, buf, ptr - buf);
882} 870}
883 871
884static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d) 872static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d)
@@ -920,7 +908,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d
920 908
921 *ptr = __fcs(buf); ptr++; 909 *ptr = __fcs(buf); ptr++;
922 910
923 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 911 return rfcomm_send_frame(s, buf, ptr - buf);
924} 912}
925 913
926int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, 914int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
@@ -958,7 +946,7 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
958 946
959 *ptr = __fcs(buf); ptr++; 947 *ptr = __fcs(buf); ptr++;
960 948
961 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 949 return rfcomm_send_frame(s, buf, ptr - buf);
962} 950}
963 951
964static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status) 952static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status)
@@ -985,7 +973,7 @@ static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status)
985 973
986 *ptr = __fcs(buf); ptr++; 974 *ptr = __fcs(buf); ptr++;
987 975
988 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 976 return rfcomm_send_frame(s, buf, ptr - buf);
989} 977}
990 978
991static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig) 979static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig)
@@ -1012,7 +1000,7 @@ static int rfcomm_send_msc(struct rfcomm_session *s, int cr, u8 dlci, u8 v24_sig
1012 1000
1013 *ptr = __fcs(buf); ptr++; 1001 *ptr = __fcs(buf); ptr++;
1014 1002
1015 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 1003 return rfcomm_send_frame(s, buf, ptr - buf);
1016} 1004}
1017 1005
1018static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr) 1006static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr)
@@ -1034,7 +1022,7 @@ static int rfcomm_send_fcoff(struct rfcomm_session *s, int cr)
1034 1022
1035 *ptr = __fcs(buf); ptr++; 1023 *ptr = __fcs(buf); ptr++;
1036 1024
1037 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 1025 return rfcomm_send_frame(s, buf, ptr - buf);
1038} 1026}
1039 1027
1040static int rfcomm_send_fcon(struct rfcomm_session *s, int cr) 1028static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
@@ -1056,7 +1044,7 @@ static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
1056 1044
1057 *ptr = __fcs(buf); ptr++; 1045 *ptr = __fcs(buf); ptr++;
1058 1046
1059 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 1047 return rfcomm_send_frame(s, buf, ptr - buf);
1060} 1048}
1061 1049
1062static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len) 1050static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len)
@@ -1107,7 +1095,7 @@ static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits)
1107 1095
1108 *ptr = __fcs(buf); ptr++; 1096 *ptr = __fcs(buf); ptr++;
1109 1097
1110 return rfcomm_send_frame(s, buf, ptr - buf, HCI_PRIO_MAX); 1098 return rfcomm_send_frame(s, buf, ptr - buf);
1111} 1099}
1112 1100
1113static void rfcomm_make_uih(struct sk_buff *skb, u8 addr) 1101static void rfcomm_make_uih(struct sk_buff *skb, u8 addr)
@@ -1786,8 +1774,7 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
1786 return skb_queue_len(&d->tx_queue); 1774 return skb_queue_len(&d->tx_queue);
1787 1775
1788 while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) { 1776 while (d->tx_credits && (skb = skb_dequeue(&d->tx_queue))) {
1789 err = rfcomm_send_frame(d->session, skb->data, skb->len, 1777 err = rfcomm_send_frame(d->session, skb->data, skb->len);
1790 skb->priority);
1791 if (err < 0) { 1778 if (err < 0) {
1792 skb_queue_head(&d->tx_queue, skb); 1779 skb_queue_head(&d->tx_queue, skb);
1793 break; 1780 break;