From: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
To: alsa-devel@alsa-project.org
Cc: liam.r.girdwood@linux.intel.com, mengdong.lin@linux.intel.com,
vinod.koul@intel.com,
Vaibhav Agarwal <vaibhav.agarwal@linaro.org>,
peter.ujfalusi@ti.com, broonie@kernel.org
Subject: [RFC 2/4] alsa: add locked variant for snd_ctl_remove_id
Date: Mon, 15 Feb 2016 17:49:30 +0530 [thread overview]
Message-ID: <1455538772-24926-3-git-send-email-vaibhav.agarwal@linaro.org> (raw)
In-Reply-To: <1455538772-24926-1-git-send-email-vaibhav.agarwal@linaro.org>
While removing kcontrols due to dynamic dai_link/codec removal,
mutex/semaphore for soc-card/sound card is already acquired.
Thus, added lock already acquired variant for ctl_remove_id.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
---
include/sound/control.h | 1 +
sound/core/control.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/sound/control.h b/include/sound/control.h
index 21d047f..8faea10 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -125,6 +125,7 @@ int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, bool add_on_replace);
int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
+int snd_ctl_remove_id_locked(struct snd_card *card, struct snd_ctl_elem_id *id);
int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id,
int active);
diff --git a/sound/core/control.c b/sound/core/control.c
index a85d455..dca1998 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -530,6 +530,29 @@ int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id)
EXPORT_SYMBOL(snd_ctl_remove_id);
/**
+ * snd_ctl_remove_id_locked - remove the control of the given id and release it
+ * @card: the card instance
+ * @id: the control id to remove
+ *
+ * Finds the control instance with the given id, removes it from the
+ * card list and releases it.
+ *
+ * Return: 0 if successful, or a negative error code on failure.
+ */
+int snd_ctl_remove_id_locked(struct snd_card *card, struct snd_ctl_elem_id *id)
+{
+ struct snd_kcontrol *kctl;
+ int ret;
+
+ kctl = snd_ctl_find_id(card, id);
+ if (kctl == NULL)
+ return -ENOENT;
+ ret = snd_ctl_remove(card, kctl);
+ return ret;
+}
+EXPORT_SYMBOL(snd_ctl_remove_id_locked);
+
+/**
* snd_ctl_remove_user_ctl - remove and release the unlocked user control
* @file: active control handle
* @id: the control id to remove
--
2.1.4
next prev parent reply other threads:[~2016-02-15 12:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 12:19 [RFC 0/4] Add support for DAI link addition dynamically Vaibhav Agarwal
2016-02-15 12:19 ` [RFC 1/4] ASoc: Use ref_count for soc DAI & component Vaibhav Agarwal
2016-02-15 13:59 ` Mark Brown
2016-02-16 13:27 ` Vaibhav Agarwal
2016-02-15 12:19 ` Vaibhav Agarwal [this message]
2016-02-15 14:02 ` [RFC 2/4] alsa: add locked variant for snd_ctl_remove_id Mark Brown
2016-02-16 13:54 ` Vaibhav Agarwal
2016-02-16 14:13 ` Takashi Iwai
2016-02-16 14:15 ` Vaibhav Agarwal
2016-02-15 12:19 ` [RFC 3/4] ASoC: Enable dynamic DAIlink insertion & removal Vaibhav Agarwal
2016-02-15 17:02 ` Mark Brown
2016-02-16 14:34 ` Vaibhav Agarwal
2016-02-16 19:03 ` Mark Brown
2016-02-15 12:19 ` [RFC 4/4] ASoC: Change soc-card codec_conf array to a list Vaibhav Agarwal
2016-02-15 17:11 ` Mark Brown
2016-02-15 14:22 ` [RFC 0/4] Add support for DAI link addition dynamically Lars-Peter Clausen
2016-02-17 5:52 ` Mengdong Lin
2016-02-17 8:25 ` Mengdong Lin
2016-02-17 9:31 ` Vaibhav Agarwal
2016-02-18 5:23 ` Mengdong Lin
2016-02-18 7:57 ` Vaibhav Agarwal
2016-02-18 13:39 ` Mark Brown
2016-02-22 8:51 ` Mengdong Lin
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=1455538772-24926-3-git-send-email-vaibhav.agarwal@linaro.org \
--to=vaibhav.agarwal@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=mengdong.lin@linux.intel.com \
--cc=peter.ujfalusi@ti.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 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).