diff options
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index e13cf5ef144c..84360c117d4e 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -320,28 +320,34 @@ void hci_conn_add_sysfs(struct hci_conn *conn) | |||
320 | queue_work(btaddconn, &conn->work); | 320 | queue_work(btaddconn, &conn->work); |
321 | } | 321 | } |
322 | 322 | ||
323 | /* | ||
324 | * The rfcomm tty device will possibly retain even when conn | ||
325 | * is down, and sysfs doesn't support move zombie device, | ||
326 | * so we should move the device before conn device is destroyed. | ||
327 | */ | ||
323 | static int __match_tty(struct device *dev, void *data) | 328 | static int __match_tty(struct device *dev, void *data) |
324 | { | 329 | { |
325 | /* The rfcomm tty device will possibly retain even when conn | 330 | return !strncmp(dev->bus_id, "rfcomm", 6); |
326 | * is down, and sysfs doesn't support move zombie device, | ||
327 | * so we should move the device before conn device is destroyed. | ||
328 | * Due to the only child device of hci_conn dev is rfcomm | ||
329 | * tty_dev, here just return 1 | ||
330 | */ | ||
331 | return 1; | ||
332 | } | 331 | } |
333 | 332 | ||
334 | static void del_conn(struct work_struct *work) | 333 | static void del_conn(struct work_struct *work) |
335 | { | 334 | { |
336 | struct device *dev; | ||
337 | struct hci_conn *conn = container_of(work, struct hci_conn, work); | 335 | struct hci_conn *conn = container_of(work, struct hci_conn, work); |
336 | struct hci_dev *hdev = conn->hdev; | ||
337 | |||
338 | while (1) { | ||
339 | struct device *dev; | ||
338 | 340 | ||
339 | while (dev = device_find_child(&conn->dev, NULL, __match_tty)) { | 341 | dev = device_find_child(&conn->dev, NULL, __match_tty); |
342 | if (!dev) | ||
343 | break; | ||
340 | device_move(dev, NULL); | 344 | device_move(dev, NULL); |
341 | put_device(dev); | 345 | put_device(dev); |
342 | } | 346 | } |
347 | |||
343 | device_del(&conn->dev); | 348 | device_del(&conn->dev); |
344 | put_device(&conn->dev); | 349 | put_device(&conn->dev); |
350 | hci_dev_put(hdev); | ||
345 | } | 351 | } |
346 | 352 | ||
347 | void hci_conn_del_sysfs(struct hci_conn *conn) | 353 | void hci_conn_del_sysfs(struct hci_conn *conn) |