[alsa-devel] [PATCH 8/8] ALSA: control: arrange snd_ctl_new() as a local function

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed Feb 11 11:37:32 CET 2015


The snd_ctl_new1() was added in 2001. I guess that snd_ctl_new() becames
a local function in this timing.

This commit arranges the function as a local helper function, remove
'snd_' prefix and comments, change comments to refer to the function.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 sound/core/control.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index 04534f3..af95783 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -193,18 +193,8 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
 }
 EXPORT_SYMBOL(snd_ctl_notify);
 
-/**
- * snd_ctl_new - create a control instance from the template
- * @control: the control template
- * @access: the default control access
- *
- * Allocates a new struct snd_kcontrol instance and copies the given template 
- * to the new instance. It does not copy volatile data (access).
- *
- * Return: The pointer of the new instance, or %NULL on failure.
- */
-static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
-					unsigned int access)
+static struct snd_kcontrol *ctl_new(struct snd_kcontrol *control,
+				    unsigned int access)
 {
 	struct snd_kcontrol *kctl;
 	unsigned int size;
@@ -273,7 +263,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
 	kctl.tlv.p = ncontrol->tlv.p;
 	kctl.private_value = ncontrol->private_value;
 	kctl.private_data = private_data;
-	return snd_ctl_new(&kctl, access);
+	return ctl_new(&kctl, access);
 }
 EXPORT_SYMBOL(snd_ctl_new1);
 
@@ -281,9 +271,8 @@ EXPORT_SYMBOL(snd_ctl_new1);
  * snd_ctl_free_one - release the control instance
  * @kcontrol: the control instance
  *
- * Releases the control instance created via snd_ctl_new()
- * or snd_ctl_new1().
- * Don't call this after the control was added to the card.
+ * Releases the control instance created via ctl_new() or snd_ctl_new1(). Don't
+ * call this after the control was added to the card.
  */
 void snd_ctl_free_one(struct snd_kcontrol *kcontrol)
 {
@@ -334,9 +323,8 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
  * @card: the card instance
  * @kcontrol: the control instance to add
  *
- * Adds the control instance created via snd_ctl_new() or
- * snd_ctl_new1() to the given card. Assigns also an unique
- * numid used for fast search.
+ * Adds the control instance created via ctl_new() or snd_ctl_new1() to the
+ * given card. Assigns also an unique numid used for fast search.
  *
  * It frees automatically the control which cannot be added.
  *
@@ -1254,7 +1242,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
 		}
 	}
 	kctl.private_free = snd_ctl_elem_user_free;
-	_kctl = snd_ctl_new(&kctl, access);
+	_kctl = ctl_new(&kctl, access);
 	if (_kctl == NULL) {
 		kfree(ue->priv_data);
 		kfree(ue);
-- 
2.1.0



More information about the Alsa-devel mailing list