diff options
Diffstat (limited to 'net/bluetooth/rfcomm/tty.c')
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index bd8d671a0ba6..26f322737db0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/skbuff.h> | 38 | #include <linux/skbuff.h> |
39 | 39 | ||
40 | #include <net/bluetooth/bluetooth.h> | 40 | #include <net/bluetooth/bluetooth.h> |
41 | #include <net/bluetooth/hci_core.h> | ||
41 | #include <net/bluetooth/rfcomm.h> | 42 | #include <net/bluetooth/rfcomm.h> |
42 | 43 | ||
43 | #ifndef CONFIG_BT_RFCOMM_DEBUG | 44 | #ifndef CONFIG_BT_RFCOMM_DEBUG |
@@ -161,6 +162,24 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) | |||
161 | return dev; | 162 | return dev; |
162 | } | 163 | } |
163 | 164 | ||
165 | static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | ||
166 | { | ||
167 | struct hci_dev *hdev; | ||
168 | struct hci_conn *conn; | ||
169 | |||
170 | hdev = hci_get_route(&dev->dst, &dev->src); | ||
171 | if (!hdev) | ||
172 | return NULL; | ||
173 | |||
174 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | ||
175 | if (!conn) | ||
176 | return NULL; | ||
177 | |||
178 | hci_dev_put(hdev); | ||
179 | |||
180 | return &conn->dev; | ||
181 | } | ||
182 | |||
164 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | 183 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) |
165 | { | 184 | { |
166 | struct rfcomm_dev *dev; | 185 | struct rfcomm_dev *dev; |
@@ -244,7 +263,7 @@ out: | |||
244 | return err; | 263 | return err; |
245 | } | 264 | } |
246 | 265 | ||
247 | tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 266 | tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev)); |
248 | 267 | ||
249 | return dev->id; | 268 | return dev->id; |
250 | } | 269 | } |