mac80211: fix peer HT capabilities
[safe/jmp/linux-2.6] / net / bluetooth / hci_sysfs.c
index 582d887..2bc6f6a 100644 (file)
@@ -68,7 +68,7 @@ static struct attribute_group bt_link_group = {
        .attrs = bt_link_attrs,
 };
 
-static struct attribute_group *bt_link_groups[] = {
+static const struct attribute_group *bt_link_groups[] = {
        &bt_link_group,
        NULL
 };
@@ -88,14 +88,18 @@ static struct device_type bt_link = {
 static void add_conn(struct work_struct *work)
 {
        struct hci_conn *conn = container_of(work, struct hci_conn, work_add);
+       struct hci_dev *hdev = conn->hdev;
+
+       dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
 
-       /* ensure previous del is complete */
-       flush_work(&conn->work_del);
+       dev_set_drvdata(&conn->dev, conn);
 
        if (device_add(&conn->dev) < 0) {
                BT_ERR("Failed to register connection device");
                return;
        }
+
+       hci_dev_hold(hdev);
 }
 
 /*
@@ -113,9 +117,6 @@ static void del_conn(struct work_struct *work)
        struct hci_conn *conn = container_of(work, struct hci_conn, work_del);
        struct hci_dev *hdev = conn->hdev;
 
-       /* ensure previous add is complete */
-       flush_work(&conn->work_add);
-
        if (!device_is_registered(&conn->dev))
                return;
 
@@ -131,6 +132,7 @@ static void del_conn(struct work_struct *work)
 
        device_del(&conn->dev);
        put_device(&conn->dev);
+
        hci_dev_put(hdev);
 }
 
@@ -144,8 +146,6 @@ void hci_conn_init_sysfs(struct hci_conn *conn)
        conn->dev.class = bt_class;
        conn->dev.parent = &hdev->dev;
 
-       dev_set_drvdata(&conn->dev, conn);
-
        device_initialize(&conn->dev);
 
        INIT_WORK(&conn->work_add, add_conn);
@@ -154,12 +154,8 @@ void hci_conn_init_sysfs(struct hci_conn *conn)
 
 void hci_conn_add_sysfs(struct hci_conn *conn)
 {
-       struct hci_dev *hdev = conn->hdev;
-
        BT_DBG("conn %p", conn);
 
-       dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
-
        queue_work(bt_workq, &conn->work_add);
 }
 
@@ -396,7 +392,7 @@ static struct attribute_group bt_host_group = {
        .attrs = bt_host_attrs,
 };
 
-static struct attribute_group *bt_host_groups[] = {
+static const struct attribute_group *bt_host_groups[] = {
        &bt_host_group,
        NULL
 };