Bluetooth: Fix hci core device initialization
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / hci_sysfs.c
index a6c3aa8be1f79796dbfa051af03b3503f23fbe4e..a7d5de3a6b5ad0009fd8e907a5f279cd69c86431 100644 (file)
@@ -23,6 +23,8 @@ static inline char *link_typetostr(int type)
                return "SCO";
        case ESCO_LINK:
                return "eSCO";
+       case LE_LINK:
+               return "LE";
        default:
                return "UNKNOWN";
        }
@@ -540,6 +542,17 @@ static int auto_accept_delay_get(void *data, u64 *val)
 DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get,
                                        auto_accept_delay_set, "%llu\n");
 
+void hci_init_sysfs(struct hci_dev *hdev)
+{
+       struct device *dev = &hdev->dev;
+
+       dev->type = &bt_host;
+       dev->class = bt_class;
+
+       dev_set_drvdata(dev, hdev);
+       device_initialize(dev);
+}
+
 int hci_register_sysfs(struct hci_dev *hdev)
 {
        struct device *dev = &hdev->dev;
@@ -547,15 +560,10 @@ int hci_register_sysfs(struct hci_dev *hdev)
 
        BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
 
-       dev->type = &bt_host;
-       dev->class = bt_class;
        dev->parent = hdev->parent;
-
        dev_set_name(dev, "%s", hdev->name);
 
-       dev_set_drvdata(dev, hdev);
-
-       err = device_register(dev);
+       err = device_add(dev);
        if (err < 0)
                return err;