diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 2 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 14 |
3 files changed, 9 insertions, 13 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 61309b26f271..fa47d5d84f5c 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -171,10 +171,8 @@ static void hci_conn_timeout(unsigned long arg) | |||
171 | switch (conn->state) { | 171 | switch (conn->state) { |
172 | case BT_CONNECT: | 172 | case BT_CONNECT: |
173 | case BT_CONNECT2: | 173 | case BT_CONNECT2: |
174 | if (conn->type == ACL_LINK) | 174 | if (conn->type == ACL_LINK && conn->out) |
175 | hci_acl_connect_cancel(conn); | 175 | hci_acl_connect_cancel(conn); |
176 | else | ||
177 | hci_acl_disconn(conn, 0x13); | ||
178 | break; | 176 | break; |
179 | case BT_CONFIG: | 177 | case BT_CONFIG: |
180 | case BT_CONNECTED: | 178 | case BT_CONNECTED: |
@@ -292,6 +290,8 @@ int hci_conn_del(struct hci_conn *conn) | |||
292 | 290 | ||
293 | hci_conn_del_sysfs(conn); | 291 | hci_conn_del_sysfs(conn); |
294 | 292 | ||
293 | hci_dev_put(hdev); | ||
294 | |||
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | 297 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 4e7cb88e5da9..184ba0a88ec0 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1493,7 +1493,7 @@ static inline void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff | |||
1493 | hci_dev_lock(hdev); | 1493 | hci_dev_lock(hdev); |
1494 | 1494 | ||
1495 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); | 1495 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); |
1496 | if (conn) { | 1496 | if (conn && conn->state == BT_CONNECTED) { |
1497 | hci_conn_hold(conn); | 1497 | hci_conn_hold(conn); |
1498 | conn->disc_timeout = HCI_PAIRING_TIMEOUT; | 1498 | conn->disc_timeout = HCI_PAIRING_TIMEOUT; |
1499 | hci_conn_put(conn); | 1499 | hci_conn_put(conn); |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 582d8877078c..95f7a7a544b4 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -88,14 +88,16 @@ static struct device_type bt_link = { | |||
88 | static void add_conn(struct work_struct *work) | 88 | static void add_conn(struct work_struct *work) |
89 | { | 89 | { |
90 | struct hci_conn *conn = container_of(work, struct hci_conn, work_add); | 90 | struct hci_conn *conn = container_of(work, struct hci_conn, work_add); |
91 | struct hci_dev *hdev = conn->hdev; | ||
91 | 92 | ||
92 | /* ensure previous del is complete */ | 93 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); |
93 | flush_work(&conn->work_del); | ||
94 | 94 | ||
95 | if (device_add(&conn->dev) < 0) { | 95 | if (device_add(&conn->dev) < 0) { |
96 | BT_ERR("Failed to register connection device"); | 96 | BT_ERR("Failed to register connection device"); |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | |||
100 | hci_dev_hold(hdev); | ||
99 | } | 101 | } |
100 | 102 | ||
101 | /* | 103 | /* |
@@ -113,9 +115,6 @@ static void del_conn(struct work_struct *work) | |||
113 | struct hci_conn *conn = container_of(work, struct hci_conn, work_del); | 115 | struct hci_conn *conn = container_of(work, struct hci_conn, work_del); |
114 | struct hci_dev *hdev = conn->hdev; | 116 | struct hci_dev *hdev = conn->hdev; |
115 | 117 | ||
116 | /* ensure previous add is complete */ | ||
117 | flush_work(&conn->work_add); | ||
118 | |||
119 | if (!device_is_registered(&conn->dev)) | 118 | if (!device_is_registered(&conn->dev)) |
120 | return; | 119 | return; |
121 | 120 | ||
@@ -131,6 +130,7 @@ static void del_conn(struct work_struct *work) | |||
131 | 130 | ||
132 | device_del(&conn->dev); | 131 | device_del(&conn->dev); |
133 | put_device(&conn->dev); | 132 | put_device(&conn->dev); |
133 | |||
134 | hci_dev_put(hdev); | 134 | hci_dev_put(hdev); |
135 | } | 135 | } |
136 | 136 | ||
@@ -154,12 +154,8 @@ void hci_conn_init_sysfs(struct hci_conn *conn) | |||
154 | 154 | ||
155 | void hci_conn_add_sysfs(struct hci_conn *conn) | 155 | void hci_conn_add_sysfs(struct hci_conn *conn) |
156 | { | 156 | { |
157 | struct hci_dev *hdev = conn->hdev; | ||
158 | |||
159 | BT_DBG("conn %p", conn); | 157 | BT_DBG("conn %p", conn); |
160 | 158 | ||
161 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); | ||
162 | |||
163 | queue_work(bt_workq, &conn->work_add); | 159 | queue_work(bt_workq, &conn->work_add); |
164 | } | 160 | } |
165 | 161 | ||