diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-02-09 20:59:03 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-14 16:39:29 -0500 |
commit | f87c24e74e88d767e7024c4464d0d1fb3642fb5e (patch) | |
tree | e142db29a6e9c1c810331ebbb4382099cf68b1f0 | |
parent | 136c373bf0e8c445fc028427674817333df602e3 (diff) |
Revert "Bluetooth: Move rfcomm_get_device() before rfcomm_dev_activate()"
This reverts commit e228b63390536f5b737056059a9a04ea016b1abf.
This is the third of a 3-patch revert, together with
Revert "Bluetooth: Remove rfcomm_carrier_raised()" and
Revert "Bluetooth: Always wait for a connection on RFCOMM open()".
Commit 4a2fb3ecc7467c775b154813861f25a0ddc11aa0,
"Bluetooth: Always wait for a connection on RFCOMM open()" open-codes
blocking on tty open(), rather than using the default behavior
implemented by the tty port.
The reasons for reverting that patch are detailed in that changelog;
this patch restores required functionality for that revert.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Tested-By: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 32ef9f91965c..a535ef148ef6 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -103,22 +103,6 @@ static void rfcomm_dev_destruct(struct tty_port *port) | |||
103 | module_put(THIS_MODULE); | 103 | module_put(THIS_MODULE); |
104 | } | 104 | } |
105 | 105 | ||
106 | static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | ||
107 | { | ||
108 | struct hci_dev *hdev; | ||
109 | struct hci_conn *conn; | ||
110 | |||
111 | hdev = hci_get_route(&dev->dst, &dev->src); | ||
112 | if (!hdev) | ||
113 | return NULL; | ||
114 | |||
115 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | ||
116 | |||
117 | hci_dev_put(hdev); | ||
118 | |||
119 | return conn ? &conn->dev : NULL; | ||
120 | } | ||
121 | |||
122 | /* device-specific initialization: open the dlc */ | 106 | /* device-specific initialization: open the dlc */ |
123 | static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) | 107 | static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) |
124 | { | 108 | { |
@@ -185,6 +169,22 @@ static struct rfcomm_dev *rfcomm_dev_get(int id) | |||
185 | return dev; | 169 | return dev; |
186 | } | 170 | } |
187 | 171 | ||
172 | static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | ||
173 | { | ||
174 | struct hci_dev *hdev; | ||
175 | struct hci_conn *conn; | ||
176 | |||
177 | hdev = hci_get_route(&dev->dst, &dev->src); | ||
178 | if (!hdev) | ||
179 | return NULL; | ||
180 | |||
181 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | ||
182 | |||
183 | hci_dev_put(hdev); | ||
184 | |||
185 | return conn ? &conn->dev : NULL; | ||
186 | } | ||
187 | |||
188 | static ssize_t show_address(struct device *tty_dev, struct device_attribute *attr, char *buf) | 188 | static ssize_t show_address(struct device *tty_dev, struct device_attribute *attr, char *buf) |
189 | { | 189 | { |
190 | struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); | 190 | struct rfcomm_dev *dev = dev_get_drvdata(tty_dev); |