2.4.19 Bluetooth [1/5] core fixes
PATCH 1/1 2.4.19 Bluetooth [1/5] core fixes
Hi Marcelo, Alan,
Here is another round of Bluetooth updates.
Bluetooth core.
- Device and socket locking fixes
- Fix poll()/select() on connecting socket
- Support for hotplug
- Other minor and trivial fixes
include/net/bluetooth/hci.h | 10 +++--- include/net/bluetooth/hci_core.h | 4 +- net/bluetooth/af_bluetooth.c | 15 ++++++---- net/bluetooth/hci_conn.c | 8 ++--- net/bluetooth/hci_core.c | 57 ++++++++++++++++++++++++++++----------- net/bluetooth/hci_event.c | 14 +++------ net/bluetooth/hci_sock.c | 3 -- 7 files changed, 68 insertions(+), 43 deletions(-)
http://bluez.sourceforge.net/patches/patch-2.4.19-bluetooth-core.gz
Please apply
Max
net/bluetooth/af_bluetooth.c +9 -6
@@ -25,9 +25,9 @@/* * BlueZ Bluetooth address family and sockets. * -* $Id: af_bluetooth.c,v 1.6 2002/06/25 22:03:39 maxk Exp $ +* $Id: af_bluetooth.c,v 1.8 2002/07/22 20:32:54 maxk Exp $ */ -#define VERSION "2.1" +#define VERSION "2.2"#include <linux/config.h> #include <linux/module.h>
@@ -111,18 +111,18 @@void bluez_sock_link (struct bluez_sock_list *l,struct sock *sk) { -write_lock (&l->lock); +write_lock_bh (&l->lock); sk->next = l->head; l->head = sk;sock_hold (sk); -write_unlock (&l->lock); +write_unlock_bh (&l->lock); }void bluez_sock_unlink (struct bluez_sock_list *l,struct sock *sk) {struct sock **skp; -write_lock (&l->lock); +write_lock_bh (&l->lock);for (skp = &l->head; *skp; skp = &((*skp)->next)) {if (*skp == sk) { *skp = sk->next;
@@ -130,7 +130,7 @@break ; } } -write_unlock (&l->lock); +write_unlock_bh (&l->lock); }void bluez_accept_enqueue (struct sock *parent,struct sock *sk)
@@ -242,6 +242,9 @@if (sk->state ==BT_CLOSED ) mask |=POLLHUP ; +if (sk->state ==BT_CONNECT || sk->state ==BT_CONNECT2 ) +return mask; +if (sock_writeable (sk)) mask |=POLLOUT |POLLWRNORM |POLLWRBAND ;else
net/bluetooth/hci_conn.c +4 -4
@@ -25,7 +25,7 @@/* * HCI Connection handling. * -* $Id: hci_conn.c,v 1.3 2002/06/25 22:03:39 maxk Exp $ +* $Id: hci_conn.c,v 1.5 2002/07/17 18:46:25 maxk Exp $ */ #include <linux/config.h>
@@ -73,7 +73,7 @@bacpy (&cp.bdaddr, &conn->dst);if ((ie =inquiry_cache_lookup (hdev, &conn->dst)) && -inquiry_entry_age (ie) >INQUIRY_ENTRY_AGE_MAX ) { +inquiry_entry_age (ie) <=INQUIRY_ENTRY_AGE_MAX ) { cp.pscan_rep_mode = ie->info.pscan_rep_mode; cp.pscan_mode = ie->info.pscan_mode; cp.clock_offset = ie->info.clock_offset |__cpu_to_le16 (0x8000 );
@@ -217,7 +217,7 @@BT_DBG ("%s -> %s" ,batostr (src),batostr (dst)); -spin_lock_bh (&hdev_list_lock); +read_lock_bh (&hdev_list_lock);list_for_each (p, &hdev_list) {struct hci_dev *d;
@@ -245,7 +245,7 @@if (hdev)hci_dev_hold (hdev); -spin_unlock_bh (&hdev_list_lock); +read_unlock_bh (&hdev_list_lock);return hdev; }
net/bluetooth/hci_core.c +42 -15
135 lines not on this page · raw message
net/bluetooth/hci_event.c +5 -9
@@ -25,7 +25,7 @@/* * HCI Events. * -* $Id: hci_event.c,v 1.3 2002/04/17 17:37:16 maxk Exp $ +* $Id: hci_event.c,v 1.4 2002/07/27 18:14:38 maxk Exp $ */ #include <linux/config.h>
@@ -352,16 +352,12 @@hci_dev_lock (hdev); acl =conn_hash_lookup_handle (hdev, handle); -if (!acl || !(sco = acl->link)) { -hci_dev_unlock (hdev); -break ; +if (acl && (sco = acl->link)) { + sco->state =BT_CLOSED ; +hci_proto_connect_cfm (sco, status); +hci_conn_del (sco); } - sco->state =BT_CLOSED ; - -hci_proto_connect_cfm (sco, status); -hci_conn_del (sco); -hci_dev_unlock (hdev); }break ;
net/bluetooth/hci_sock.c +1 -2
@@ -25,7 +25,7 @@/* * BlueZ HCI socket layer. * -* $Id: hci_sock.c,v 1.4 2002/04/18 22:26:14 maxk Exp $ +* $Id: hci_sock.c,v 1.5 2002/07/22 20:32:54 maxk Exp $ */ #include <linux/config.h>
@@ -129,7 +129,6 @@if (sock_queue_rcv_skb (sk, nskb))kfree_skb (nskb); - }read_unlock (&hci_sk_list.lock); }
include/net/bluetooth/hci.h +5 -5
@@ -23,7 +23,7 @@*/ /* -* $Id: hci.h,v 1.4 2002/04/18 22:26:15 maxk Exp $ +* $Id: hci.h,v 1.5 2002/06/27 17:29:30 maxk Exp $ */ #ifndef __HCI_H
@@ -113,10 +113,10 @@#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)/* ACL flags */ -#define ACL_CONT 0x0001 -#define ACL_START 0x0002 -#define ACL_ACTIVE_BCAST 0x0010 -#define ACL_PICO_BCAST 0x0020 +#define ACL_CONT 0x01 +#define ACL_START 0x02 +#define ACL_ACTIVE_BCAST 0x04 +#define ACL_PICO_BCAST 0x08/* Baseband links */ #define SCO_LINK 0x00
include/net/bluetooth/hci_core.h +2 -2
@@ -23,7 +23,7 @@*/ /* -* $Id: hci_core.h,v 1.4 2002/06/25 22:04:43 maxk Exp $ +* $Id: hci_core.h,v 1.5 2002/06/27 04:56:30 maxk Exp $ */ #ifndef __HCI_CORE_H
@@ -149,7 +149,7 @@extern struct hci_proto *hci_proto[];extern struct list_head hdev_list; -extern spinlock_t hdev_list_lock; +extern rwlock_t hdev_list_lock;/* ----- Inquiry cache ----- */ #define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds