X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=net%2Fbluetooth%2Frfcomm%2Ftty.c;h=26f322737db0c83702267b25190dca8fa925c324;hp=bd8d671a0ba6f1622ee54e463c2d393b0a6a8943;hb=0a85b964e141a4b8db6eaf500ceace12f8f52f93;hpb=b219e3ac66183fc9771b94af931fb5fd41d586ec 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 @@ #include #include +#include #include #ifndef CONFIG_BT_RFCOMM_DEBUG @@ -161,6 +162,24 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) return dev; } +static struct device *rfcomm_get_device(struct rfcomm_dev *dev) +{ + struct hci_dev *hdev; + struct hci_conn *conn; + + hdev = hci_get_route(&dev->dst, &dev->src); + if (!hdev) + return NULL; + + conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); + if (!conn) + return NULL; + + hci_dev_put(hdev); + + return &conn->dev; +} + static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) { struct rfcomm_dev *dev; @@ -244,7 +263,7 @@ out: return err; } - tty_register_device(rfcomm_tty_driver, dev->id, NULL); + tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev)); return dev->id; }