All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Vinod Koul <vinod.koul@intel.com>, Jeeja Kp <jeeja.kp@intel.com>,
	Subhransu S Prusty <subhransu.s.prusty@intel.com>,
	Liam Girdwood <liam.r.girdwood@intel.com>
Subject: [PATCH 3/6] ALSA: hda - Add a common helper to give the codec modalias string
Date: Fri, 16 Oct 2015 18:20:55 +0200	[thread overview]
Message-ID: <1445012458-3337-4-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1445012458-3337-1-git-send-email-tiwai@suse.de>

This patch provide a new common helper function,
snd_hdac_codec_modalias(), to give the codec modalias name string.
This function will be used by multiple places in the later patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/sound/hdaudio.h |  1 +
 sound/hda/hdac_device.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index ddca48eb02e0..e2b712c90d3f 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -109,6 +109,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);
 int snd_hdac_device_register(struct hdac_device *codec);
 void snd_hdac_device_unregister(struct hdac_device *codec);
 int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name);
+int snd_hdac_codec_modalias(struct hdac_device *hdac, char *buf, size_t size);
 
 int snd_hdac_refresh_widgets(struct hdac_device *codec);
 int snd_hdac_refresh_widget_sysfs(struct hdac_device *codec);
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 4b06b26cee06..bbdb25f5bbb9 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -186,6 +186,21 @@ int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name)
 EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name);
 
 /**
+ * snd_hdac_codec_modalias - give the module alias name
+ * @codec: HDAC device
+ * @buf: string buffer to store
+ * @size: string buffer size
+ *
+ * Returns the size of string, like snprintf(), or a negative error code.
+ */
+int snd_hdac_codec_modalias(struct hdac_device *codec, char *buf, size_t size)
+{
+	return snprintf(buf, size, "hdaudio:v%08Xr%08Xa%02X\n",
+			codec->vendor_id, codec->revision_id, codec->type);
+}
+EXPORT_SYMBOL_GPL(snd_hdac_codec_modalias);
+
+/**
  * snd_hdac_make_cmd - compose a 32bit command word to be sent to the
  *	HD-audio controller
  * @codec: the codec object
-- 
2.6.1

  parent reply	other threads:[~2015-10-16 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 16:20 [PATCH 0/6] HD-audio modalias support patchset Takashi Iwai
2015-10-16 16:20 ` [PATCH 1/6] ALSA: hda - Add api_version to hda_device_id struct Takashi Iwai
2015-10-16 16:20 ` [PATCH 2/6] ALSA: hda - Add hduadio support to DEVTABLE Takashi Iwai
2015-10-16 16:20 ` Takashi Iwai [this message]
2015-10-16 16:20 ` [PATCH 4/6] ALSA: hda - Add hdaudio bus modalias support Takashi Iwai
2015-10-16 16:20 ` [PATCH 5/6] ALSA: hda - convert to hda_device_id Takashi Iwai
2015-10-16 16:20 ` [PATCH 6/6] ALSA: hda - Advertise MODALIAS in uevent Takashi Iwai
2015-10-18 15:11 ` [PATCH 0/6] HD-audio modalias support patchset Vinod Koul
2015-10-20  6:16   ` Vinod Koul
2015-10-20  9:02     ` Takashi Iwai

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=1445012458-3337-4-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.