These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / sound / hda / hdac_sysfs.c
index 0a6ce3b..42d61bf 100644 (file)
@@ -45,6 +45,13 @@ CODEC_ATTR(mfg);
 CODEC_ATTR_STR(vendor_name);
 CODEC_ATTR_STR(chip_name);
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+{
+       return snd_hdac_codec_modalias(dev_to_hdac_dev(dev), buf, 256);
+}
+static DEVICE_ATTR_RO(modalias);
+
 static struct attribute *hdac_dev_attrs[] = {
        &dev_attr_type.attr,
        &dev_attr_vendor_id.attr,
@@ -54,6 +61,7 @@ static struct attribute *hdac_dev_attrs[] = {
        &dev_attr_mfg.attr,
        &dev_attr_vendor_name.attr,
        &dev_attr_chip_name.attr,
+       &dev_attr_modalias.attr,
        NULL
 };
 
@@ -321,8 +329,7 @@ static void widget_tree_free(struct hdac_device *codec)
                        free_widget_node(*p, &widget_node_group);
                kfree(tree->nodes);
        }
-       if (tree->root)
-               kobject_put(tree->root);
+       kobject_put(tree->root);
        kfree(tree);
        codec->widgets = NULL;
 }
@@ -391,6 +398,9 @@ int hda_widget_sysfs_init(struct hdac_device *codec)
 {
        int err;
 
+       if (codec->widgets)
+               return 0; /* already created */
+
        err = widget_tree_create(codec);
        if (err < 0) {
                widget_tree_free(codec);