From patchwork Mon Feb 15 13:33:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 8315081 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BE73F9F372 for ; Mon, 15 Feb 2016 13:34:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D5FB2020F for ; Mon, 15 Feb 2016 13:34:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7E241201FA for ; Mon, 15 Feb 2016 13:34:17 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7333A2652C3; Mon, 15 Feb 2016 14:34:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 37EB02625ED; Mon, 15 Feb 2016 14:33:30 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CFCFD2625E3; Mon, 15 Feb 2016 14:33:28 +0100 (CET) Received: from smtp303.phy.lolipop.jp (smtp303.phy.lolipop.jp [210.157.22.87]) by alsa0.perex.cz (Postfix) with ESMTP id A7EB3261721 for ; Mon, 15 Feb 2016 14:33:18 +0100 (CET) Received: from smtp303.phy.lolipop.lan (HELO smtp303.phy.lolipop.jp) (172.17.1.87) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp303.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Mon, 15 Feb 2016 22:33:16 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp303.phy.lolipop.jp (LOLIPOP-Fsecure); Mon, 15 Feb 2016 22:33:13 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz Date: Mon, 15 Feb 2016 22:33:10 +0900 Message-Id: <1455543193-28109-3-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455543193-28109-1-git-send-email-o-takashi@sakamocchi.jp> References: <1455543193-28109-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/5] control: rename variables so that it represents the number of channels which an element has X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP An element has some channels which can be changed in a single operation. In control API, variables to represents the number of channels is described as 'count'. On the other hand, in ALSA Ctl core, the number of elements in an element set is also described as 'count'. They're a bit confusing. This commit renames 'count' with 'channels'. The 'count' is reserved for future commit to describe the number of elements in an element set. Signed-off-by: Takashi Sakamoto --- src/control/control.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/control/control.c b/src/control/control.c index 691b69c..96dfbf6 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -264,14 +264,15 @@ int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info) * \brief Create and add an user INTEGER CTL element * \param ctl CTL handle * \param id CTL element id to add - * \param count number of elements + * \param channels number of elements * \param min minimum value * \param max maximum value * \param step value step * \return 0 on success otherwise a negative error code */ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - unsigned int count, long min, long max, long step) + unsigned int channels, long min, long max, + long step) { snd_ctl_elem_info_t *info; snd_ctl_elem_value_t *val; @@ -284,7 +285,7 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, info->type = SND_CTL_ELEM_TYPE_INTEGER; info->access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE; - info->count = count; + info->count = channels; info->value.integer.min = min; info->value.integer.max = max; info->value.integer.step = step; @@ -293,7 +294,7 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, return err; snd_ctl_elem_value_alloca(&val); val->id = info->id; - for (i = 0; i < count; i++) + for (i = 0; i < channels; i++) val->value.integer.value[i] = min; err = ctl->ops->element_write(ctl, val); return err; @@ -303,15 +304,15 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, * \brief Create and add an user INTEGER64 CTL element * \param ctl CTL handle * \param id CTL element id to add - * \param count number of elements + * \param channels number of elements * \param min minimum value * \param max maximum value * \param step value step * \return 0 on success otherwise a negative error code */ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - unsigned int count, long long min, long long max, - long long step) + unsigned int channels, long long min, + long long max, long long step) { snd_ctl_elem_info_t *info; snd_ctl_elem_value_t *val; @@ -322,7 +323,7 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, snd_ctl_elem_info_alloca(&info); info->id = *id; info->type = SND_CTL_ELEM_TYPE_INTEGER64; - info->count = count; + info->count = channels; info->value.integer64.min = min; info->value.integer64.max = max; info->value.integer64.step = step; @@ -331,7 +332,7 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, return err; snd_ctl_elem_value_alloca(&val); val->id = info->id; - for (i = 0; i < count; i++) + for (i = 0; i < channels; i++) val->value.integer64.value[i] = min; err = ctl->ops->element_write(ctl, val); return err; @@ -341,11 +342,11 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, * \brief Create and add an user BOOLEAN CTL element * \param ctl CTL handle * \param id CTL element id to add - * \param count number of elements + * \param channels number of elements * \return 0 on success otherwise a negative error code */ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - unsigned int count) + unsigned int channels) { snd_ctl_elem_info_t *info; @@ -353,7 +354,7 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, snd_ctl_elem_info_alloca(&info); info->id = *id; info->type = SND_CTL_ELEM_TYPE_BOOLEAN; - info->count = count; + info->count = channels; info->value.integer.min = 0; info->value.integer.max = 1; return ctl->ops->element_add(ctl, info); @@ -363,7 +364,7 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, * \brief Create and add a user-defined control element of type enumerated. * \param[in] ctl Control device handle. * \param[in] id ID of the new control element. - * \param[in] count Number of element values. + * \param[in] channels Number of element values. * \param[in] items Range of possible values (0 ... \a items - 1). * \param[in] names An array containing \a items strings. * \return Zero on success, otherwise a negative error code. @@ -380,9 +381,10 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, * \par Errors: *
*
-EBUSY
A control element with ID \a id already exists. - *
-EINVAL
\a count is not at least one or greater than 128, or \a items - * is not at least one, or a string in \a names is empty or longer than 63 - * bytes, or the strings in \a names require more than 64 KB storage. + *
-EINVAL
\a channels is not at least one or greater than 128, or \a + * items is not at least one, or a string in \a names is empty or longer + * than 63 bytes, or the strings in \a names require more than 64 KB + * storage. *
-ENOMEM
Out of memory, or there are too many user control elements. *
-ENXIO
This driver does not support (enumerated) user controls. *
-ENODEV
Device unplugged. @@ -392,7 +394,7 @@ int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, * snd_ctl_elem_add_enumerated() was introduced in ALSA 1.0.25. */ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - unsigned int count, unsigned int items, + unsigned int channels, unsigned int items, const char *const names[]) { snd_ctl_elem_info_t *info; @@ -405,7 +407,7 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, snd_ctl_elem_info_alloca(&info); info->id = *id; info->type = SND_CTL_ELEM_TYPE_ENUMERATED; - info->count = count; + info->count = channels; info->value.enumerated.items = items; bytes = 0;