[Bluetooth] Make use of virtual devices tree
[pandora-kernel.git] / net / bluetooth / hci_sysfs.c
index 989b22d..954eb74 100644 (file)
@@ -242,10 +242,14 @@ static void add_conn(void *data)
        struct hci_conn *conn = data;
        int i;
 
-       device_register(&conn->dev);
+       if (device_register(&conn->dev) < 0) {
+               BT_ERR("Failed to register connection device");
+               return;
+       }
 
        for (i = 0; conn_attrs[i]; i++)
-               device_create_file(&conn->dev, conn_attrs[i]);
+               if (device_create_file(&conn->dev, conn_attrs[i]) < 0)
+                       BT_ERR("Failed to create connection attribute");
 }
 
 void hci_conn_add_sysfs(struct hci_conn *conn)
@@ -295,11 +299,7 @@ int hci_register_sysfs(struct hci_dev *hdev)
        BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
 
        dev->class = bt_class;
-
-       if (hdev->parent)
-               dev->parent = hdev->parent;
-       else
-               dev->parent = &bt_platform->dev;
+       dev->parent = hdev->parent;
 
        strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
 
@@ -312,7 +312,8 @@ int hci_register_sysfs(struct hci_dev *hdev)
                return err;
 
        for (i = 0; bt_attrs[i]; i++)
-               device_create_file(dev, bt_attrs[i]);
+               if (device_create_file(dev, bt_attrs[i]) < 0)
+                       BT_ERR("Failed to create device attribute");
 
        return 0;
 }