diff options
author | Len Brown <len.brown@intel.com> | 2005-12-06 17:31:30 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-12-06 17:31:30 -0500 |
commit | 3d5271f9883cba7b54762bc4fe027d4172f06db7 (patch) | |
tree | ab8a881a14478598a0c8bda0d26c62cdccfffd6d /net/bluetooth | |
parent | 378b2556f4e09fa6f87ff0cb5c4395ff28257d02 (diff) | |
parent | 9115a6c787596e687df03010d97fccc5e0762506 (diff) |
Pull release into acpica branch
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 18 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 14 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 4 | ||||
-rw-r--r-- | net/bluetooth/hidp/Kconfig | 2 | ||||
-rw-r--r-- | net/bluetooth/hidp/core.c | 17 | ||||
-rw-r--r-- | net/bluetooth/l2cap.c | 100 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/Makefile | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 169 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/crc.c | 71 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 92 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 2 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 94 |
14 files changed, 135 insertions, 462 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 12b43345b54f..ea616e3fc98e 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
39 | #include <linux/proc_fs.h> | ||
40 | #include <net/sock.h> | 39 | #include <net/sock.h> |
41 | 40 | ||
42 | #if defined(CONFIG_KMOD) | 41 | #if defined(CONFIG_KMOD) |
@@ -50,10 +49,7 @@ | |||
50 | #define BT_DBG(D...) | 49 | #define BT_DBG(D...) |
51 | #endif | 50 | #endif |
52 | 51 | ||
53 | #define VERSION "2.7" | 52 | #define VERSION "2.8" |
54 | |||
55 | struct proc_dir_entry *proc_bt; | ||
56 | EXPORT_SYMBOL(proc_bt); | ||
57 | 53 | ||
58 | /* Bluetooth sockets */ | 54 | /* Bluetooth sockets */ |
59 | #define BT_MAX_PROTO 8 | 55 | #define BT_MAX_PROTO 8 |
@@ -308,20 +304,10 @@ static struct net_proto_family bt_sock_family_ops = { | |||
308 | .create = bt_sock_create, | 304 | .create = bt_sock_create, |
309 | }; | 305 | }; |
310 | 306 | ||
311 | extern int hci_sock_init(void); | ||
312 | extern int hci_sock_cleanup(void); | ||
313 | |||
314 | extern int bt_sysfs_init(void); | ||
315 | extern int bt_sysfs_cleanup(void); | ||
316 | |||
317 | static int __init bt_init(void) | 307 | static int __init bt_init(void) |
318 | { | 308 | { |
319 | BT_INFO("Core ver %s", VERSION); | 309 | BT_INFO("Core ver %s", VERSION); |
320 | 310 | ||
321 | proc_bt = proc_mkdir("bluetooth", NULL); | ||
322 | if (proc_bt) | ||
323 | proc_bt->owner = THIS_MODULE; | ||
324 | |||
325 | sock_register(&bt_sock_family_ops); | 311 | sock_register(&bt_sock_family_ops); |
326 | 312 | ||
327 | BT_INFO("HCI device and connection manager initialized"); | 313 | BT_INFO("HCI device and connection manager initialized"); |
@@ -340,8 +326,6 @@ static void __exit bt_exit(void) | |||
340 | bt_sysfs_cleanup(); | 326 | bt_sysfs_cleanup(); |
341 | 327 | ||
342 | sock_unregister(PF_BLUETOOTH); | 328 | sock_unregister(PF_BLUETOOTH); |
343 | |||
344 | remove_proc_entry("bluetooth", NULL); | ||
345 | } | 329 | } |
346 | 330 | ||
347 | subsys_initcall(bt_init); | 331 | subsys_initcall(bt_init); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 55dc42eac92c..9106354c781e 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -87,7 +87,7 @@ int hci_unregister_notifier(struct notifier_block *nb) | |||
87 | return notifier_chain_unregister(&hci_notifier, nb); | 87 | return notifier_chain_unregister(&hci_notifier, nb); |
88 | } | 88 | } |
89 | 89 | ||
90 | void hci_notify(struct hci_dev *hdev, int event) | 90 | static void hci_notify(struct hci_dev *hdev, int event) |
91 | { | 91 | { |
92 | notifier_call_chain(&hci_notifier, event, hdev); | 92 | notifier_call_chain(&hci_notifier, event, hdev); |
93 | } | 93 | } |
@@ -183,7 +183,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt) | |||
183 | static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | 183 | static void hci_init_req(struct hci_dev *hdev, unsigned long opt) |
184 | { | 184 | { |
185 | struct sk_buff *skb; | 185 | struct sk_buff *skb; |
186 | __u16 param; | 186 | __le16 param; |
187 | 187 | ||
188 | BT_DBG("%s %ld", hdev->name, opt); | 188 | BT_DBG("%s %ld", hdev->name, opt); |
189 | 189 | ||
@@ -1347,7 +1347,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
1347 | kfree_skb(skb); | 1347 | kfree_skb(skb); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | void hci_rx_task(unsigned long arg) | 1350 | static void hci_rx_task(unsigned long arg) |
1351 | { | 1351 | { |
1352 | struct hci_dev *hdev = (struct hci_dev *) arg; | 1352 | struct hci_dev *hdev = (struct hci_dev *) arg; |
1353 | struct sk_buff *skb; | 1353 | struct sk_buff *skb; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b61b4e8e36fd..eb64555d1fb3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -242,7 +242,7 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb | |||
242 | break; | 242 | break; |
243 | 243 | ||
244 | status = *((__u8 *) skb->data); | 244 | status = *((__u8 *) skb->data); |
245 | setting = __le16_to_cpu(get_unaligned((__u16 *) sent)); | 245 | setting = __le16_to_cpu(get_unaligned((__le16 *) sent)); |
246 | 246 | ||
247 | if (!status && hdev->voice_setting != setting) { | 247 | if (!status && hdev->voice_setting != setting) { |
248 | hdev->voice_setting = setting; | 248 | hdev->voice_setting = setting; |
@@ -728,7 +728,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
728 | static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) | 728 | static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) |
729 | { | 729 | { |
730 | struct hci_ev_num_comp_pkts *ev = (struct hci_ev_num_comp_pkts *) skb->data; | 730 | struct hci_ev_num_comp_pkts *ev = (struct hci_ev_num_comp_pkts *) skb->data; |
731 | __u16 *ptr; | 731 | __le16 *ptr; |
732 | int i; | 732 | int i; |
733 | 733 | ||
734 | skb_pull(skb, sizeof(*ev)); | 734 | skb_pull(skb, sizeof(*ev)); |
@@ -742,7 +742,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s | |||
742 | 742 | ||
743 | tasklet_disable(&hdev->tx_task); | 743 | tasklet_disable(&hdev->tx_task); |
744 | 744 | ||
745 | for (i = 0, ptr = (__u16 *) skb->data; i < ev->num_hndl; i++) { | 745 | for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) { |
746 | struct hci_conn *conn; | 746 | struct hci_conn *conn; |
747 | __u16 handle, count; | 747 | __u16 handle, count; |
748 | 748 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 32ef7975a139..1d6d0a15c099 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -66,20 +66,20 @@ static struct hci_sec_filter hci_sec_filter = { | |||
66 | /* Packet types */ | 66 | /* Packet types */ |
67 | 0x10, | 67 | 0x10, |
68 | /* Events */ | 68 | /* Events */ |
69 | { 0x1000d9fe, 0x0000300c }, | 69 | { 0x1000d9fe, 0x0000b00c }, |
70 | /* Commands */ | 70 | /* Commands */ |
71 | { | 71 | { |
72 | { 0x0 }, | 72 | { 0x0 }, |
73 | /* OGF_LINK_CTL */ | 73 | /* OGF_LINK_CTL */ |
74 | { 0xbe000006, 0x00000001, 0x0000, 0x00 }, | 74 | { 0xbe000006, 0x00000001, 0x000000, 0x00 }, |
75 | /* OGF_LINK_POLICY */ | 75 | /* OGF_LINK_POLICY */ |
76 | { 0x00005200, 0x00000000, 0x0000, 0x00 }, | 76 | { 0x00005200, 0x00000000, 0x000000, 0x00 }, |
77 | /* OGF_HOST_CTL */ | 77 | /* OGF_HOST_CTL */ |
78 | { 0xaab00200, 0x2b402aaa, 0x0154, 0x00 }, | 78 | { 0xaab00200, 0x2b402aaa, 0x020154, 0x00 }, |
79 | /* OGF_INFO_PARAM */ | 79 | /* OGF_INFO_PARAM */ |
80 | { 0x000002be, 0x00000000, 0x0000, 0x00 }, | 80 | { 0x000002be, 0x00000000, 0x000000, 0x00 }, |
81 | /* OGF_STATUS_PARAM */ | 81 | /* OGF_STATUS_PARAM */ |
82 | { 0x000000ea, 0x00000000, 0x0000, 0x00 } | 82 | { 0x000000ea, 0x00000000, 0x000000, 0x00 } |
83 | } | 83 | } |
84 | }; | 84 | }; |
85 | 85 | ||
@@ -416,7 +416,7 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
416 | skb->dev = (void *) hdev; | 416 | skb->dev = (void *) hdev; |
417 | 417 | ||
418 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { | 418 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { |
419 | u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); | 419 | u16 opcode = __le16_to_cpu(get_unaligned((__le16 *) skb->data)); |
420 | u16 ogf = hci_opcode_ogf(opcode); | 420 | u16 ogf = hci_opcode_ogf(opcode); |
421 | u16 ocf = hci_opcode_ocf(opcode); | 421 | u16 ocf = hci_opcode_ocf(opcode); |
422 | 422 | ||
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 7856bc26accb..bd7568ac87fc 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -103,7 +103,7 @@ static void bt_release(struct class_device *cdev) | |||
103 | kfree(hdev); | 103 | kfree(hdev); |
104 | } | 104 | } |
105 | 105 | ||
106 | static struct class bt_class = { | 106 | struct class bt_class = { |
107 | .name = "bluetooth", | 107 | .name = "bluetooth", |
108 | .release = bt_release, | 108 | .release = bt_release, |
109 | #ifdef CONFIG_HOTPLUG | 109 | #ifdef CONFIG_HOTPLUG |
@@ -111,6 +111,8 @@ static struct class bt_class = { | |||
111 | #endif | 111 | #endif |
112 | }; | 112 | }; |
113 | 113 | ||
114 | EXPORT_SYMBOL_GPL(bt_class); | ||
115 | |||
114 | int hci_register_sysfs(struct hci_dev *hdev) | 116 | int hci_register_sysfs(struct hci_dev *hdev) |
115 | { | 117 | { |
116 | struct class_device *cdev = &hdev->class_dev; | 118 | struct class_device *cdev = &hdev->class_dev; |
diff --git a/net/bluetooth/hidp/Kconfig b/net/bluetooth/hidp/Kconfig index 4e958f7d9418..edfea772fb67 100644 --- a/net/bluetooth/hidp/Kconfig +++ b/net/bluetooth/hidp/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config BT_HIDP | 1 | config BT_HIDP |
2 | tristate "HIDP protocol support" | 2 | tristate "HIDP protocol support" |
3 | depends on BT && BT_L2CAP | 3 | depends on BT && BT_L2CAP && (BROKEN || !S390) |
4 | select INPUT | 4 | select INPUT |
5 | help | 5 | help |
6 | HIDP (Human Interface Device Protocol) is a transport layer | 6 | HIDP (Human Interface Device Protocol) is a transport layer |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index de8af5f42394..cdb9cfafd960 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -520,7 +520,7 @@ static int hidp_session(void *arg) | |||
520 | 520 | ||
521 | if (session->input) { | 521 | if (session->input) { |
522 | input_unregister_device(session->input); | 522 | input_unregister_device(session->input); |
523 | kfree(session->input); | 523 | session->input = NULL; |
524 | } | 524 | } |
525 | 525 | ||
526 | up_write(&hidp_session_sem); | 526 | up_write(&hidp_session_sem); |
@@ -536,6 +536,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co | |||
536 | 536 | ||
537 | input->private = session; | 537 | input->private = session; |
538 | 538 | ||
539 | input->name = "Bluetooth HID Boot Protocol Device"; | ||
540 | |||
539 | input->id.bustype = BUS_BLUETOOTH; | 541 | input->id.bustype = BUS_BLUETOOTH; |
540 | input->id.vendor = req->vendor; | 542 | input->id.vendor = req->vendor; |
541 | input->id.product = req->product; | 543 | input->id.product = req->product; |
@@ -582,16 +584,15 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, | |||
582 | return -ENOTUNIQ; | 584 | return -ENOTUNIQ; |
583 | 585 | ||
584 | session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL); | 586 | session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL); |
585 | if (!session) | 587 | if (!session) |
586 | return -ENOMEM; | 588 | return -ENOMEM; |
587 | memset(session, 0, sizeof(struct hidp_session)); | 589 | memset(session, 0, sizeof(struct hidp_session)); |
588 | 590 | ||
589 | session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 591 | session->input = input_allocate_device(); |
590 | if (!session->input) { | 592 | if (!session->input) { |
591 | kfree(session); | 593 | kfree(session); |
592 | return -ENOMEM; | 594 | return -ENOMEM; |
593 | } | 595 | } |
594 | memset(session->input, 0, sizeof(struct input_dev)); | ||
595 | 596 | ||
596 | down_write(&hidp_session_sem); | 597 | down_write(&hidp_session_sem); |
597 | 598 | ||
@@ -651,15 +652,15 @@ unlink: | |||
651 | 652 | ||
652 | __hidp_unlink_session(session); | 653 | __hidp_unlink_session(session); |
653 | 654 | ||
654 | if (session->input) | 655 | if (session->input) { |
655 | input_unregister_device(session->input); | 656 | input_unregister_device(session->input); |
657 | session->input = NULL; /* don't try to free it here */ | ||
658 | } | ||
656 | 659 | ||
657 | failed: | 660 | failed: |
658 | up_write(&hidp_session_sem); | 661 | up_write(&hidp_session_sem); |
659 | 662 | ||
660 | if (session->input) | 663 | kfree(session->input); |
661 | kfree(session->input); | ||
662 | |||
663 | kfree(session); | 664 | kfree(session); |
664 | return err; | 665 | return err; |
665 | } | 666 | } |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index d3d6bc547212..e3bb11ca4235 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -38,9 +38,8 @@ | |||
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/socket.h> | 39 | #include <linux/socket.h> |
40 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
41 | #include <linux/proc_fs.h> | ||
42 | #include <linux/seq_file.h> | ||
43 | #include <linux/list.h> | 41 | #include <linux/list.h> |
42 | #include <linux/device.h> | ||
44 | #include <net/sock.h> | 43 | #include <net/sock.h> |
45 | 44 | ||
46 | #include <asm/system.h> | 45 | #include <asm/system.h> |
@@ -56,7 +55,7 @@ | |||
56 | #define BT_DBG(D...) | 55 | #define BT_DBG(D...) |
57 | #endif | 56 | #endif |
58 | 57 | ||
59 | #define VERSION "2.7" | 58 | #define VERSION "2.8" |
60 | 59 | ||
61 | static struct proto_ops l2cap_sock_ops; | 60 | static struct proto_ops l2cap_sock_ops; |
62 | 61 | ||
@@ -372,7 +371,7 @@ static struct proto l2cap_proto = { | |||
372 | .obj_size = sizeof(struct l2cap_pinfo) | 371 | .obj_size = sizeof(struct l2cap_pinfo) |
373 | }; | 372 | }; |
374 | 373 | ||
375 | static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) | 374 | static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio) |
376 | { | 375 | { |
377 | struct sock *sk; | 376 | struct sock *sk; |
378 | 377 | ||
@@ -2137,94 +2136,29 @@ drop: | |||
2137 | return 0; | 2136 | return 0; |
2138 | } | 2137 | } |
2139 | 2138 | ||
2140 | /* ---- Proc fs support ---- */ | 2139 | static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) |
2141 | #ifdef CONFIG_PROC_FS | ||
2142 | static void *l2cap_seq_start(struct seq_file *seq, loff_t *pos) | ||
2143 | { | 2140 | { |
2144 | struct sock *sk; | 2141 | struct sock *sk; |
2145 | struct hlist_node *node; | 2142 | struct hlist_node *node; |
2146 | loff_t l = *pos; | 2143 | char *str = buf; |
2147 | 2144 | ||
2148 | read_lock_bh(&l2cap_sk_list.lock); | 2145 | read_lock_bh(&l2cap_sk_list.lock); |
2149 | 2146 | ||
2150 | sk_for_each(sk, node, &l2cap_sk_list.head) | 2147 | sk_for_each(sk, node, &l2cap_sk_list.head) { |
2151 | if (!l--) | 2148 | struct l2cap_pinfo *pi = l2cap_pi(sk); |
2152 | goto found; | ||
2153 | sk = NULL; | ||
2154 | found: | ||
2155 | return sk; | ||
2156 | } | ||
2157 | 2149 | ||
2158 | static void *l2cap_seq_next(struct seq_file *seq, void *e, loff_t *pos) | 2150 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", |
2159 | { | 2151 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
2160 | (*pos)++; | 2152 | sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, |
2161 | return sk_next(e); | 2153 | pi->omtu, pi->link_mode); |
2162 | } | 2154 | } |
2163 | 2155 | ||
2164 | static void l2cap_seq_stop(struct seq_file *seq, void *e) | ||
2165 | { | ||
2166 | read_unlock_bh(&l2cap_sk_list.lock); | 2156 | read_unlock_bh(&l2cap_sk_list.lock); |
2167 | } | ||
2168 | 2157 | ||
2169 | static int l2cap_seq_show(struct seq_file *seq, void *e) | 2158 | return (str - buf); |
2170 | { | ||
2171 | struct sock *sk = e; | ||
2172 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
2173 | |||
2174 | seq_printf(seq, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", | ||
2175 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | ||
2176 | sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, | ||
2177 | pi->omtu, pi->link_mode); | ||
2178 | return 0; | ||
2179 | } | 2159 | } |
2180 | 2160 | ||
2181 | static struct seq_operations l2cap_seq_ops = { | 2161 | static CLASS_ATTR(l2cap, S_IRUGO, l2cap_sysfs_show, NULL); |
2182 | .start = l2cap_seq_start, | ||
2183 | .next = l2cap_seq_next, | ||
2184 | .stop = l2cap_seq_stop, | ||
2185 | .show = l2cap_seq_show | ||
2186 | }; | ||
2187 | |||
2188 | static int l2cap_seq_open(struct inode *inode, struct file *file) | ||
2189 | { | ||
2190 | return seq_open(file, &l2cap_seq_ops); | ||
2191 | } | ||
2192 | |||
2193 | static struct file_operations l2cap_seq_fops = { | ||
2194 | .owner = THIS_MODULE, | ||
2195 | .open = l2cap_seq_open, | ||
2196 | .read = seq_read, | ||
2197 | .llseek = seq_lseek, | ||
2198 | .release = seq_release, | ||
2199 | }; | ||
2200 | |||
2201 | static int __init l2cap_proc_init(void) | ||
2202 | { | ||
2203 | struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); | ||
2204 | if (!p) | ||
2205 | return -ENOMEM; | ||
2206 | p->owner = THIS_MODULE; | ||
2207 | p->proc_fops = &l2cap_seq_fops; | ||
2208 | return 0; | ||
2209 | } | ||
2210 | |||
2211 | static void __exit l2cap_proc_cleanup(void) | ||
2212 | { | ||
2213 | remove_proc_entry("l2cap", proc_bt); | ||
2214 | } | ||
2215 | |||
2216 | #else /* CONFIG_PROC_FS */ | ||
2217 | |||
2218 | static int __init l2cap_proc_init(void) | ||
2219 | { | ||
2220 | return 0; | ||
2221 | } | ||
2222 | |||
2223 | static void __exit l2cap_proc_cleanup(void) | ||
2224 | { | ||
2225 | return; | ||
2226 | } | ||
2227 | #endif /* CONFIG_PROC_FS */ | ||
2228 | 2162 | ||
2229 | static struct proto_ops l2cap_sock_ops = { | 2163 | static struct proto_ops l2cap_sock_ops = { |
2230 | .family = PF_BLUETOOTH, | 2164 | .family = PF_BLUETOOTH, |
@@ -2266,7 +2200,7 @@ static struct hci_proto l2cap_hci_proto = { | |||
2266 | static int __init l2cap_init(void) | 2200 | static int __init l2cap_init(void) |
2267 | { | 2201 | { |
2268 | int err; | 2202 | int err; |
2269 | 2203 | ||
2270 | err = proto_register(&l2cap_proto, 0); | 2204 | err = proto_register(&l2cap_proto, 0); |
2271 | if (err < 0) | 2205 | if (err < 0) |
2272 | return err; | 2206 | return err; |
@@ -2284,7 +2218,7 @@ static int __init l2cap_init(void) | |||
2284 | goto error; | 2218 | goto error; |
2285 | } | 2219 | } |
2286 | 2220 | ||
2287 | l2cap_proc_init(); | 2221 | class_create_file(&bt_class, &class_attr_l2cap); |
2288 | 2222 | ||
2289 | BT_INFO("L2CAP ver %s", VERSION); | 2223 | BT_INFO("L2CAP ver %s", VERSION); |
2290 | BT_INFO("L2CAP socket layer initialized"); | 2224 | BT_INFO("L2CAP socket layer initialized"); |
@@ -2298,7 +2232,7 @@ error: | |||
2298 | 2232 | ||
2299 | static void __exit l2cap_exit(void) | 2233 | static void __exit l2cap_exit(void) |
2300 | { | 2234 | { |
2301 | l2cap_proc_cleanup(); | 2235 | class_remove_file(&bt_class, &class_attr_l2cap); |
2302 | 2236 | ||
2303 | if (bt_sock_unregister(BTPROTO_L2CAP) < 0) | 2237 | if (bt_sock_unregister(BTPROTO_L2CAP) < 0) |
2304 | BT_ERR("L2CAP socket unregistration failed"); | 2238 | BT_ERR("L2CAP socket unregistration failed"); |
diff --git a/net/bluetooth/rfcomm/Makefile b/net/bluetooth/rfcomm/Makefile index aecec45ec68d..fe07988a3705 100644 --- a/net/bluetooth/rfcomm/Makefile +++ b/net/bluetooth/rfcomm/Makefile | |||
@@ -4,5 +4,5 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_BT_RFCOMM) += rfcomm.o | 5 | obj-$(CONFIG_BT_RFCOMM) += rfcomm.o |
6 | 6 | ||
7 | rfcomm-y := core.o sock.o crc.o | 7 | rfcomm-y := core.o sock.o |
8 | rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o | 8 | rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 173f46e8cdae..0d89d6434136 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -35,9 +35,8 @@ | |||
35 | #include <linux/signal.h> | 35 | #include <linux/signal.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/wait.h> | 37 | #include <linux/wait.h> |
38 | #include <linux/device.h> | ||
38 | #include <linux/net.h> | 39 | #include <linux/net.h> |
39 | #include <linux/proc_fs.h> | ||
40 | #include <linux/seq_file.h> | ||
41 | #include <net/sock.h> | 40 | #include <net/sock.h> |
42 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
43 | #include <asm/unaligned.h> | 42 | #include <asm/unaligned.h> |
@@ -47,17 +46,13 @@ | |||
47 | #include <net/bluetooth/l2cap.h> | 46 | #include <net/bluetooth/l2cap.h> |
48 | #include <net/bluetooth/rfcomm.h> | 47 | #include <net/bluetooth/rfcomm.h> |
49 | 48 | ||
50 | #define VERSION "1.5" | 49 | #define VERSION "1.6" |
51 | 50 | ||
52 | #ifndef CONFIG_BT_RFCOMM_DEBUG | 51 | #ifndef CONFIG_BT_RFCOMM_DEBUG |
53 | #undef BT_DBG | 52 | #undef BT_DBG |
54 | #define BT_DBG(D...) | 53 | #define BT_DBG(D...) |
55 | #endif | 54 | #endif |
56 | 55 | ||
57 | #ifdef CONFIG_PROC_FS | ||
58 | struct proc_dir_entry *proc_bt_rfcomm; | ||
59 | #endif | ||
60 | |||
61 | static struct task_struct *rfcomm_thread; | 56 | static struct task_struct *rfcomm_thread; |
62 | 57 | ||
63 | static DECLARE_MUTEX(rfcomm_sem); | 58 | static DECLARE_MUTEX(rfcomm_sem); |
@@ -133,6 +128,49 @@ static inline void rfcomm_session_put(struct rfcomm_session *s) | |||
133 | 128 | ||
134 | /* ---- RFCOMM FCS computation ---- */ | 129 | /* ---- RFCOMM FCS computation ---- */ |
135 | 130 | ||
131 | /* reversed, 8-bit, poly=0x07 */ | ||
132 | static unsigned char rfcomm_crc_table[256] = { | ||
133 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, | ||
134 | 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, | ||
135 | 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, | ||
136 | 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67, | ||
137 | |||
138 | 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d, | ||
139 | 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43, | ||
140 | 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51, | ||
141 | 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f, | ||
142 | |||
143 | 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05, | ||
144 | 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b, | ||
145 | 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19, | ||
146 | 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17, | ||
147 | |||
148 | 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d, | ||
149 | 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33, | ||
150 | 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21, | ||
151 | 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f, | ||
152 | |||
153 | 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95, | ||
154 | 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b, | ||
155 | 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89, | ||
156 | 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87, | ||
157 | |||
158 | 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad, | ||
159 | 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3, | ||
160 | 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1, | ||
161 | 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf, | ||
162 | |||
163 | 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5, | ||
164 | 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb, | ||
165 | 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9, | ||
166 | 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7, | ||
167 | |||
168 | 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd, | ||
169 | 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3, | ||
170 | 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1, | ||
171 | 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf | ||
172 | }; | ||
173 | |||
136 | /* CRC on 2 bytes */ | 174 | /* CRC on 2 bytes */ |
137 | #define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]]) | 175 | #define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]]) |
138 | 176 | ||
@@ -229,7 +267,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d) | |||
229 | d->rx_credits = RFCOMM_DEFAULT_CREDITS; | 267 | d->rx_credits = RFCOMM_DEFAULT_CREDITS; |
230 | } | 268 | } |
231 | 269 | ||
232 | struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio) | 270 | struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio) |
233 | { | 271 | { |
234 | struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); | 272 | struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); |
235 | if (!d) | 273 | if (!d) |
@@ -1958,117 +1996,32 @@ static struct hci_cb rfcomm_cb = { | |||
1958 | .encrypt_cfm = rfcomm_encrypt_cfm | 1996 | .encrypt_cfm = rfcomm_encrypt_cfm |
1959 | }; | 1997 | }; |
1960 | 1998 | ||
1961 | /* ---- Proc fs support ---- */ | 1999 | static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) |
1962 | #ifdef CONFIG_PROC_FS | ||
1963 | static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) | ||
1964 | { | 2000 | { |
1965 | struct rfcomm_session *s; | 2001 | struct rfcomm_session *s; |
1966 | struct list_head *pp, *p; | 2002 | struct list_head *pp, *p; |
1967 | loff_t l = *pos; | 2003 | char *str = buf; |
1968 | 2004 | ||
1969 | rfcomm_lock(); | 2005 | rfcomm_lock(); |
1970 | 2006 | ||
1971 | list_for_each(p, &session_list) { | 2007 | list_for_each(p, &session_list) { |
1972 | s = list_entry(p, struct rfcomm_session, list); | 2008 | s = list_entry(p, struct rfcomm_session, list); |
1973 | list_for_each(pp, &s->dlcs) | 2009 | list_for_each(pp, &s->dlcs) { |
1974 | if (!l--) { | 2010 | struct sock *sk = s->sock->sk; |
1975 | seq->private = s; | 2011 | struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); |
1976 | return pp; | ||
1977 | } | ||
1978 | } | ||
1979 | return NULL; | ||
1980 | } | ||
1981 | |||
1982 | static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) | ||
1983 | { | ||
1984 | struct rfcomm_session *s = seq->private; | ||
1985 | struct list_head *pp, *p = e; | ||
1986 | (*pos)++; | ||
1987 | 2012 | ||
1988 | if (p->next != &s->dlcs) | 2013 | str += sprintf(str, "%s %s %ld %d %d %d %d\n", |
1989 | return p->next; | 2014 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
1990 | 2015 | d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); | |
1991 | list_for_each(p, &session_list) { | ||
1992 | s = list_entry(p, struct rfcomm_session, list); | ||
1993 | __list_for_each(pp, &s->dlcs) { | ||
1994 | seq->private = s; | ||
1995 | return pp; | ||
1996 | } | 2016 | } |
1997 | } | 2017 | } |
1998 | return NULL; | ||
1999 | } | ||
2000 | 2018 | ||
2001 | static void rfcomm_seq_stop(struct seq_file *seq, void *e) | ||
2002 | { | ||
2003 | rfcomm_unlock(); | 2019 | rfcomm_unlock(); |
2004 | } | ||
2005 | |||
2006 | static int rfcomm_seq_show(struct seq_file *seq, void *e) | ||
2007 | { | ||
2008 | struct rfcomm_session *s = seq->private; | ||
2009 | struct sock *sk = s->sock->sk; | ||
2010 | struct rfcomm_dlc *d = list_entry(e, struct rfcomm_dlc, list); | ||
2011 | |||
2012 | seq_printf(seq, "%s %s %ld %d %d %d %d\n", | ||
2013 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | ||
2014 | d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); | ||
2015 | return 0; | ||
2016 | } | ||
2017 | |||
2018 | static struct seq_operations rfcomm_seq_ops = { | ||
2019 | .start = rfcomm_seq_start, | ||
2020 | .next = rfcomm_seq_next, | ||
2021 | .stop = rfcomm_seq_stop, | ||
2022 | .show = rfcomm_seq_show | ||
2023 | }; | ||
2024 | 2020 | ||
2025 | static int rfcomm_seq_open(struct inode *inode, struct file *file) | 2021 | return (str - buf); |
2026 | { | ||
2027 | return seq_open(file, &rfcomm_seq_ops); | ||
2028 | } | ||
2029 | |||
2030 | static struct file_operations rfcomm_seq_fops = { | ||
2031 | .owner = THIS_MODULE, | ||
2032 | .open = rfcomm_seq_open, | ||
2033 | .read = seq_read, | ||
2034 | .llseek = seq_lseek, | ||
2035 | .release = seq_release, | ||
2036 | }; | ||
2037 | |||
2038 | static int __init rfcomm_proc_init(void) | ||
2039 | { | ||
2040 | struct proc_dir_entry *p; | ||
2041 | |||
2042 | proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt); | ||
2043 | if (proc_bt_rfcomm) { | ||
2044 | proc_bt_rfcomm->owner = THIS_MODULE; | ||
2045 | |||
2046 | p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm); | ||
2047 | if (p) | ||
2048 | p->proc_fops = &rfcomm_seq_fops; | ||
2049 | } | ||
2050 | return 0; | ||
2051 | } | ||
2052 | |||
2053 | static void __exit rfcomm_proc_cleanup(void) | ||
2054 | { | ||
2055 | remove_proc_entry("dlc", proc_bt_rfcomm); | ||
2056 | |||
2057 | remove_proc_entry("rfcomm", proc_bt); | ||
2058 | } | 2022 | } |
2059 | 2023 | ||
2060 | #else /* CONFIG_PROC_FS */ | 2024 | static CLASS_ATTR(rfcomm_dlc, S_IRUGO, rfcomm_dlc_sysfs_show, NULL); |
2061 | |||
2062 | static int __init rfcomm_proc_init(void) | ||
2063 | { | ||
2064 | return 0; | ||
2065 | } | ||
2066 | |||
2067 | static void __exit rfcomm_proc_cleanup(void) | ||
2068 | { | ||
2069 | return; | ||
2070 | } | ||
2071 | #endif /* CONFIG_PROC_FS */ | ||
2072 | 2025 | ||
2073 | /* ---- Initialization ---- */ | 2026 | /* ---- Initialization ---- */ |
2074 | static int __init rfcomm_init(void) | 2027 | static int __init rfcomm_init(void) |
@@ -2079,9 +2032,7 @@ static int __init rfcomm_init(void) | |||
2079 | 2032 | ||
2080 | kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); | 2033 | kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); |
2081 | 2034 | ||
2082 | BT_INFO("RFCOMM ver %s", VERSION); | 2035 | class_create_file(&bt_class, &class_attr_rfcomm_dlc); |
2083 | |||
2084 | rfcomm_proc_init(); | ||
2085 | 2036 | ||
2086 | rfcomm_init_sockets(); | 2037 | rfcomm_init_sockets(); |
2087 | 2038 | ||
@@ -2089,11 +2040,15 @@ static int __init rfcomm_init(void) | |||
2089 | rfcomm_init_ttys(); | 2040 | rfcomm_init_ttys(); |
2090 | #endif | 2041 | #endif |
2091 | 2042 | ||
2043 | BT_INFO("RFCOMM ver %s", VERSION); | ||
2044 | |||
2092 | return 0; | 2045 | return 0; |
2093 | } | 2046 | } |
2094 | 2047 | ||
2095 | static void __exit rfcomm_exit(void) | 2048 | static void __exit rfcomm_exit(void) |
2096 | { | 2049 | { |
2050 | class_remove_file(&bt_class, &class_attr_rfcomm_dlc); | ||
2051 | |||
2097 | hci_unregister_cb(&rfcomm_cb); | 2052 | hci_unregister_cb(&rfcomm_cb); |
2098 | 2053 | ||
2099 | /* Terminate working thread. | 2054 | /* Terminate working thread. |
@@ -2110,8 +2065,6 @@ static void __exit rfcomm_exit(void) | |||
2110 | #endif | 2065 | #endif |
2111 | 2066 | ||
2112 | rfcomm_cleanup_sockets(); | 2067 | rfcomm_cleanup_sockets(); |
2113 | |||
2114 | rfcomm_proc_cleanup(); | ||
2115 | } | 2068 | } |
2116 | 2069 | ||
2117 | module_init(rfcomm_init); | 2070 | module_init(rfcomm_init); |
diff --git a/net/bluetooth/rfcomm/crc.c b/net/bluetooth/rfcomm/crc.c deleted file mode 100644 index 1011bc4a8692..000000000000 --- a/net/bluetooth/rfcomm/crc.c +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* | ||
2 | RFCOMM implementation for Linux Bluetooth stack (BlueZ). | ||
3 | Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> | ||
4 | Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License version 2 as | ||
8 | published by the Free Software Foundation; | ||
9 | |||
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
18 | |||
19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
21 | SOFTWARE IS DISCLAIMED. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * RFCOMM FCS calculation. | ||
26 | * | ||
27 | * $Id: crc.c,v 1.2 2002/09/21 09:54:32 holtmann Exp $ | ||
28 | */ | ||
29 | |||
30 | /* reversed, 8-bit, poly=0x07 */ | ||
31 | unsigned char rfcomm_crc_table[256] = { | ||
32 | 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, | ||
33 | 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, | ||
34 | 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, | ||
35 | 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67, | ||
36 | |||
37 | 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d, | ||
38 | 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43, | ||
39 | 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51, | ||
40 | 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f, | ||
41 | |||
42 | 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05, | ||
43 | 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b, | ||
44 | 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19, | ||
45 | 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17, | ||
46 | |||
47 | 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d, | ||
48 | 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33, | ||
49 | 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21, | ||
50 | 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f, | ||
51 | |||
52 | 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95, | ||
53 | 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b, | ||
54 | 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89, | ||
55 | 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87, | ||
56 | |||
57 | 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad, | ||
58 | 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3, | ||
59 | 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1, | ||
60 | 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf, | ||
61 | |||
62 | 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5, | ||
63 | 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb, | ||
64 | 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9, | ||
65 | 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7, | ||
66 | |||
67 | 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd, | ||
68 | 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3, | ||
69 | 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1, | ||
70 | 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf | ||
71 | }; | ||
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index f49e7e938bfb..6c34261b232e 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -42,8 +42,7 @@ | |||
42 | #include <linux/socket.h> | 42 | #include <linux/socket.h> |
43 | #include <linux/skbuff.h> | 43 | #include <linux/skbuff.h> |
44 | #include <linux/list.h> | 44 | #include <linux/list.h> |
45 | #include <linux/proc_fs.h> | 45 | #include <linux/device.h> |
46 | #include <linux/seq_file.h> | ||
47 | #include <net/sock.h> | 46 | #include <net/sock.h> |
48 | 47 | ||
49 | #include <asm/system.h> | 48 | #include <asm/system.h> |
@@ -284,7 +283,7 @@ static struct proto rfcomm_proto = { | |||
284 | .obj_size = sizeof(struct rfcomm_pinfo) | 283 | .obj_size = sizeof(struct rfcomm_pinfo) |
285 | }; | 284 | }; |
286 | 285 | ||
287 | static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) | 286 | static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio) |
288 | { | 287 | { |
289 | struct rfcomm_dlc *d; | 288 | struct rfcomm_dlc *d; |
290 | struct sock *sk; | 289 | struct sock *sk; |
@@ -887,89 +886,26 @@ done: | |||
887 | return result; | 886 | return result; |
888 | } | 887 | } |
889 | 888 | ||
890 | /* ---- Proc fs support ---- */ | 889 | static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf) |
891 | #ifdef CONFIG_PROC_FS | ||
892 | static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) | ||
893 | { | 890 | { |
894 | struct sock *sk; | 891 | struct sock *sk; |
895 | struct hlist_node *node; | 892 | struct hlist_node *node; |
896 | loff_t l = *pos; | 893 | char *str = buf; |
897 | 894 | ||
898 | read_lock_bh(&rfcomm_sk_list.lock); | 895 | read_lock_bh(&rfcomm_sk_list.lock); |
899 | 896 | ||
900 | sk_for_each(sk, node, &rfcomm_sk_list.head) | 897 | sk_for_each(sk, node, &rfcomm_sk_list.head) { |
901 | if (!l--) | 898 | str += sprintf(str, "%s %s %d %d\n", |
902 | return sk; | 899 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
903 | return NULL; | 900 | sk->sk_state, rfcomm_pi(sk)->channel); |
904 | } | 901 | } |
905 | |||
906 | static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) | ||
907 | { | ||
908 | struct sock *sk = e; | ||
909 | (*pos)++; | ||
910 | return sk_next(sk); | ||
911 | } | ||
912 | 902 | ||
913 | static void rfcomm_seq_stop(struct seq_file *seq, void *e) | ||
914 | { | ||
915 | read_unlock_bh(&rfcomm_sk_list.lock); | 903 | read_unlock_bh(&rfcomm_sk_list.lock); |
916 | } | ||
917 | 904 | ||
918 | static int rfcomm_seq_show(struct seq_file *seq, void *e) | 905 | return (str - buf); |
919 | { | ||
920 | struct sock *sk = e; | ||
921 | seq_printf(seq, "%s %s %d %d\n", | ||
922 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | ||
923 | sk->sk_state, rfcomm_pi(sk)->channel); | ||
924 | return 0; | ||
925 | } | ||
926 | |||
927 | static struct seq_operations rfcomm_seq_ops = { | ||
928 | .start = rfcomm_seq_start, | ||
929 | .next = rfcomm_seq_next, | ||
930 | .stop = rfcomm_seq_stop, | ||
931 | .show = rfcomm_seq_show | ||
932 | }; | ||
933 | |||
934 | static int rfcomm_seq_open(struct inode *inode, struct file *file) | ||
935 | { | ||
936 | return seq_open(file, &rfcomm_seq_ops); | ||
937 | } | 906 | } |
938 | 907 | ||
939 | static struct file_operations rfcomm_seq_fops = { | 908 | static CLASS_ATTR(rfcomm, S_IRUGO, rfcomm_sock_sysfs_show, NULL); |
940 | .owner = THIS_MODULE, | ||
941 | .open = rfcomm_seq_open, | ||
942 | .read = seq_read, | ||
943 | .llseek = seq_lseek, | ||
944 | .release = seq_release, | ||
945 | }; | ||
946 | |||
947 | static int __init rfcomm_sock_proc_init(void) | ||
948 | { | ||
949 | struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm); | ||
950 | if (!p) | ||
951 | return -ENOMEM; | ||
952 | p->proc_fops = &rfcomm_seq_fops; | ||
953 | return 0; | ||
954 | } | ||
955 | |||
956 | static void __exit rfcomm_sock_proc_cleanup(void) | ||
957 | { | ||
958 | remove_proc_entry("sock", proc_bt_rfcomm); | ||
959 | } | ||
960 | |||
961 | #else /* CONFIG_PROC_FS */ | ||
962 | |||
963 | static int __init rfcomm_sock_proc_init(void) | ||
964 | { | ||
965 | return 0; | ||
966 | } | ||
967 | |||
968 | static void __exit rfcomm_sock_proc_cleanup(void) | ||
969 | { | ||
970 | return; | ||
971 | } | ||
972 | #endif /* CONFIG_PROC_FS */ | ||
973 | 909 | ||
974 | static struct proto_ops rfcomm_sock_ops = { | 910 | static struct proto_ops rfcomm_sock_ops = { |
975 | .family = PF_BLUETOOTH, | 911 | .family = PF_BLUETOOTH, |
@@ -997,7 +933,7 @@ static struct net_proto_family rfcomm_sock_family_ops = { | |||
997 | .create = rfcomm_sock_create | 933 | .create = rfcomm_sock_create |
998 | }; | 934 | }; |
999 | 935 | ||
1000 | int __init rfcomm_init_sockets(void) | 936 | int __init rfcomm_init_sockets(void) |
1001 | { | 937 | { |
1002 | int err; | 938 | int err; |
1003 | 939 | ||
@@ -1009,7 +945,7 @@ int __init rfcomm_init_sockets(void) | |||
1009 | if (err < 0) | 945 | if (err < 0) |
1010 | goto error; | 946 | goto error; |
1011 | 947 | ||
1012 | rfcomm_sock_proc_init(); | 948 | class_create_file(&bt_class, &class_attr_rfcomm); |
1013 | 949 | ||
1014 | BT_INFO("RFCOMM socket layer initialized"); | 950 | BT_INFO("RFCOMM socket layer initialized"); |
1015 | 951 | ||
@@ -1023,7 +959,7 @@ error: | |||
1023 | 959 | ||
1024 | void __exit rfcomm_cleanup_sockets(void) | 960 | void __exit rfcomm_cleanup_sockets(void) |
1025 | { | 961 | { |
1026 | rfcomm_sock_proc_cleanup(); | 962 | class_remove_file(&bt_class, &class_attr_rfcomm); |
1027 | 963 | ||
1028 | if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) | 964 | if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) |
1029 | BT_ERR("RFCOMM socket layer unregistration failed"); | 965 | BT_ERR("RFCOMM socket layer unregistration failed"); |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 1bca860a6109..158a9c46d863 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de | |||
286 | skb->destructor = rfcomm_wfree; | 286 | skb->destructor = rfcomm_wfree; |
287 | } | 287 | } |
288 | 288 | ||
289 | static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority) | 289 | static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, gfp_t priority) |
290 | { | 290 | { |
291 | if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { | 291 | if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { |
292 | struct sk_buff *skb = alloc_skb(size, priority); | 292 | struct sk_buff *skb = alloc_skb(size, priority); |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index ce7ab7dfa0b2..9cb00dc6c08c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -38,8 +38,7 @@ | |||
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/socket.h> | 39 | #include <linux/socket.h> |
40 | #include <linux/skbuff.h> | 40 | #include <linux/skbuff.h> |
41 | #include <linux/proc_fs.h> | 41 | #include <linux/device.h> |
42 | #include <linux/seq_file.h> | ||
43 | #include <linux/list.h> | 42 | #include <linux/list.h> |
44 | #include <net/sock.h> | 43 | #include <net/sock.h> |
45 | 44 | ||
@@ -55,7 +54,7 @@ | |||
55 | #define BT_DBG(D...) | 54 | #define BT_DBG(D...) |
56 | #endif | 55 | #endif |
57 | 56 | ||
58 | #define VERSION "0.4" | 57 | #define VERSION "0.5" |
59 | 58 | ||
60 | static struct proto_ops sco_sock_ops; | 59 | static struct proto_ops sco_sock_ops; |
61 | 60 | ||
@@ -418,7 +417,7 @@ static struct proto sco_proto = { | |||
418 | .obj_size = sizeof(struct sco_pinfo) | 417 | .obj_size = sizeof(struct sco_pinfo) |
419 | }; | 418 | }; |
420 | 419 | ||
421 | static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) | 420 | static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio) |
422 | { | 421 | { |
423 | struct sock *sk; | 422 | struct sock *sk; |
424 | 423 | ||
@@ -893,91 +892,26 @@ drop: | |||
893 | return 0; | 892 | return 0; |
894 | } | 893 | } |
895 | 894 | ||
896 | /* ---- Proc fs support ---- */ | 895 | static ssize_t sco_sysfs_show(struct class *dev, char *buf) |
897 | #ifdef CONFIG_PROC_FS | ||
898 | static void *sco_seq_start(struct seq_file *seq, loff_t *pos) | ||
899 | { | 896 | { |
900 | struct sock *sk; | 897 | struct sock *sk; |
901 | struct hlist_node *node; | 898 | struct hlist_node *node; |
902 | loff_t l = *pos; | 899 | char *str = buf; |
903 | 900 | ||
904 | read_lock_bh(&sco_sk_list.lock); | 901 | read_lock_bh(&sco_sk_list.lock); |
905 | 902 | ||
906 | sk_for_each(sk, node, &sco_sk_list.head) | 903 | sk_for_each(sk, node, &sco_sk_list.head) { |
907 | if (!l--) | 904 | str += sprintf(str, "%s %s %d\n", |
908 | goto found; | 905 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
909 | sk = NULL; | 906 | sk->sk_state); |
910 | found: | 907 | } |
911 | return sk; | ||
912 | } | ||
913 | |||
914 | static void *sco_seq_next(struct seq_file *seq, void *e, loff_t *pos) | ||
915 | { | ||
916 | struct sock *sk = e; | ||
917 | (*pos)++; | ||
918 | return sk_next(sk); | ||
919 | } | ||
920 | 908 | ||
921 | static void sco_seq_stop(struct seq_file *seq, void *e) | ||
922 | { | ||
923 | read_unlock_bh(&sco_sk_list.lock); | 909 | read_unlock_bh(&sco_sk_list.lock); |
924 | } | ||
925 | |||
926 | static int sco_seq_show(struct seq_file *seq, void *e) | ||
927 | { | ||
928 | struct sock *sk = e; | ||
929 | seq_printf(seq, "%s %s %d\n", | ||
930 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), sk->sk_state); | ||
931 | return 0; | ||
932 | } | ||
933 | 910 | ||
934 | static struct seq_operations sco_seq_ops = { | 911 | return (str - buf); |
935 | .start = sco_seq_start, | ||
936 | .next = sco_seq_next, | ||
937 | .stop = sco_seq_stop, | ||
938 | .show = sco_seq_show | ||
939 | }; | ||
940 | |||
941 | static int sco_seq_open(struct inode *inode, struct file *file) | ||
942 | { | ||
943 | return seq_open(file, &sco_seq_ops); | ||
944 | } | 912 | } |
945 | 913 | ||
946 | static struct file_operations sco_seq_fops = { | 914 | static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); |
947 | .owner = THIS_MODULE, | ||
948 | .open = sco_seq_open, | ||
949 | .read = seq_read, | ||
950 | .llseek = seq_lseek, | ||
951 | .release = seq_release, | ||
952 | }; | ||
953 | |||
954 | static int __init sco_proc_init(void) | ||
955 | { | ||
956 | struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); | ||
957 | if (!p) | ||
958 | return -ENOMEM; | ||
959 | p->owner = THIS_MODULE; | ||
960 | p->proc_fops = &sco_seq_fops; | ||
961 | return 0; | ||
962 | } | ||
963 | |||
964 | static void __exit sco_proc_cleanup(void) | ||
965 | { | ||
966 | remove_proc_entry("sco", proc_bt); | ||
967 | } | ||
968 | |||
969 | #else /* CONFIG_PROC_FS */ | ||
970 | |||
971 | static int __init sco_proc_init(void) | ||
972 | { | ||
973 | return 0; | ||
974 | } | ||
975 | |||
976 | static void __exit sco_proc_cleanup(void) | ||
977 | { | ||
978 | return; | ||
979 | } | ||
980 | #endif /* CONFIG_PROC_FS */ | ||
981 | 915 | ||
982 | static struct proto_ops sco_sock_ops = { | 916 | static struct proto_ops sco_sock_ops = { |
983 | .family = PF_BLUETOOTH, | 917 | .family = PF_BLUETOOTH, |
@@ -1035,7 +969,7 @@ static int __init sco_init(void) | |||
1035 | goto error; | 969 | goto error; |
1036 | } | 970 | } |
1037 | 971 | ||
1038 | sco_proc_init(); | 972 | class_create_file(&bt_class, &class_attr_sco); |
1039 | 973 | ||
1040 | BT_INFO("SCO (Voice Link) ver %s", VERSION); | 974 | BT_INFO("SCO (Voice Link) ver %s", VERSION); |
1041 | BT_INFO("SCO socket layer initialized"); | 975 | BT_INFO("SCO socket layer initialized"); |
@@ -1049,7 +983,7 @@ error: | |||
1049 | 983 | ||
1050 | static void __exit sco_exit(void) | 984 | static void __exit sco_exit(void) |
1051 | { | 985 | { |
1052 | sco_proc_cleanup(); | 986 | class_remove_file(&bt_class, &class_attr_sco); |
1053 | 987 | ||
1054 | if (bt_sock_unregister(BTPROTO_SCO) < 0) | 988 | if (bt_sock_unregister(BTPROTO_SCO) < 0) |
1055 | BT_ERR("SCO socket unregistration failed"); | 989 | BT_ERR("SCO socket unregistration failed"); |