alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org, Tyler Baker <tyler.baker@linaro.org>,
	Kevin Hilman <khilman@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>,
	linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] ALSA: hda - Advertise MODALIAS in uevent
Date: Thu, 17 Sep 2015 12:00:05 +0200	[thread overview]
Message-ID: <1442484006-9614-3-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1442484006-9614-1-git-send-email-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

By setting the MODALIAS variable in uevents, userspace helpers will be
enabled to load modules via the module alias associated with a device.

This information is required to automatically load HDA codec drivers
instead of having to explicitly request the various modules in the HDA
core code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 sound/hda/hda_bus_type.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/hda/hda_bus_type.c b/sound/hda/hda_bus_type.c
index 89c2711baaaf..5adf24c9f9cc 100644
--- a/sound/hda/hda_bus_type.c
+++ b/sound/hda/hda_bus_type.c
@@ -63,9 +63,21 @@ static int hda_bus_match(struct device *dev, struct device_driver *drv)
 	return 1;
 }
 
+static int hda_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	struct hdac_device *hdev = dev_to_hdac_dev(dev);
+
+	if (add_uevent_var(env, "MODALIAS=snd-hda-codec-id:%08x",
+			   hdev->vendor_id))
+		return -ENOMEM;
+
+	return 0;
+}
+
 struct bus_type snd_hda_bus_type = {
 	.name = "hdaudio",
 	.match = hda_bus_match,
+	.uevent = hda_uevent,
 };
 EXPORT_SYMBOL_GPL(snd_hda_bus_type);
 
-- 
2.5.0

  parent reply	other threads:[~2015-09-17 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 10:00 [PATCH 0/3] ALSA: hda - Avoid potential deadlock Thierry Reding
2015-09-17 10:00 ` [PATCH 1/3] ALSA: hda/hdmi - Add missing MODALIAS information Thierry Reding
2015-09-17 10:00 ` Thierry Reding [this message]
2015-09-17 10:00 ` [PATCH 3/3] ALSA: hda: Do not rely on explicit module loading Thierry Reding
     [not found] ` <1442484006-9614-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-09-19 16:42   ` [PATCH 0/3] ALSA: hda - Avoid potential deadlock Takashi Iwai
2015-09-23  9:03   ` Takashi Iwai
     [not found]     ` <s5hfv258q33.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2015-09-24  9:49       ` Takashi Iwai
     [not found]         ` <s5hio705epm.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2015-09-24 10:50           ` Thierry Reding
2015-09-24 11:49             ` Takashi Iwai
2015-09-23 18:01 ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442484006-9614-3-git-send-email-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=tyler.baker@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).