ALSA: hda - Add hdaudio bus modalias support
authorSubhransu S. Prusty <subhransu.s.prusty@intel.com>
Tue, 29 Sep 2015 08:26:47 +0000 (13:56 +0530)
committerTakashi Iwai <tiwai@suse.de>
Tue, 20 Oct 2015 08:15:09 +0000 (10:15 +0200)
This patch just adds modalias sysfs entry to each hdaudio bus entry.

[rewritten to call the common helper function by tiwai]

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/hdac_sysfs.c

index c71142dea98a18f5355f1395c4c34200a773c52e..42d61bf41969c2176f1e10842e0c8e651d202a23 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
 };