Skip to content

Commit

Permalink
[BLUETOOTH]: Fix bugs in previous conn add/del workqueue changes.
Browse files Browse the repository at this point in the history
Jens Axboe noticed that we were queueing &conn->work on both btaddconn
and keventd_wq.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dave Young authored and David S. Miller committed Feb 1, 2008
1 parent 30a50cc commit 5396c93
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ static void add_conn(struct work_struct *work)
int i;

flush_workqueue(btdelconn);

if (device_add(&conn->dev) < 0) {
BT_ERR("Failed to register connection device");
return;
Expand Down Expand Up @@ -317,7 +318,6 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
INIT_WORK(&conn->work, add_conn);

queue_work(btaddconn, &conn->work);
schedule_work(&conn->work);
}

static int __match_tty(struct device *dev, void *data)
Expand Down Expand Up @@ -354,7 +354,6 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
INIT_WORK(&conn->work, del_conn);

queue_work(btdelconn, &conn->work);
schedule_work(&conn->work);
}

int hci_register_sysfs(struct hci_dev *hdev)
Expand Down Expand Up @@ -408,6 +407,7 @@ int __init bt_sysfs_init(void)
err = -ENOMEM;
goto out;
}

btdelconn = create_singlethread_workqueue("btdelconn");
if (!btdelconn) {
err = -ENOMEM;
Expand Down Expand Up @@ -447,8 +447,12 @@ int __init bt_sysfs_init(void)
void bt_sysfs_cleanup(void)
{
destroy_workqueue(btaddconn);

destroy_workqueue(btdelconn);

class_destroy(bt_class);

bus_unregister(&bt_bus);

platform_device_unregister(bt_platform);
}

0 comments on commit 5396c93

Please sign in to comment.