[alsa-devel] [PATCH for-5.6 0/4] ALSA: ctl: UAPI updates for obsoleted members
Hi,
As a result of applying patchset for Y2038 issue[1], 'snd_ctl_elem_value' structure is changed to lost 'tstamp' member. This change should corresponds to removal of an access flag of 'snd_ctl_elem_info' structure. These changes brings slight lose of backward compatibility, thus it's better to bump protocol version.
Additionally, for recent few year I work to obsolete 'dimen' member from 'snd_ctl_elem_info' structure. It's good timing to attempt toward it.
This patchset includes these changes and bump the version up to v2.1.0.
[1] https://mailman.alsa-project.org/pipermail/alsa-devel/2019-December/160082.h...
Takashi Sakamoto (4): ALSA: ctl: remove unused macro for timestamping of elem_value ALSA: pci: echoaudio: remove usage of dimen menber of elem_value structure ALSA: ctl: remove dimen member from elem_info structure ALSA: ctl: bump protocol version up to v2.1.0
include/uapi/sound/asound.h | 10 +++------- sound/core/control.c | 32 -------------------------------- sound/pci/echoaudio/echoaudio.c | 11 ----------- 3 files changed, 3 insertions(+), 50 deletions(-)
In a former commit, 'tstamp' member was removed from 'struct snd_ctl_elem_value' in a middle way toward solution of Y2038 issue. In a protocol of ALSA control interface, this member is designed to deliver timestamp information in the value structure when the target element supports SNDRV_CTL_ELEM_ACCESS_TIMESTAMP flag.
Actually, the feature is neither used by kernel space nor user space, especiall alsa-lib has no API for the feature. Therefore it's reasonable to remove both of them. Practically, the timestamp information corresponds to no information about type of clock ID. It can bring confusions to applications.
Reference: a4e7dd35b9da ("ALSA: Avoid using timespec for struct snd_ctl_elem_value") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- include/uapi/sound/asound.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index e7943302359e..efd9e1398e07 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -974,7 +974,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ -#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ +// (1 << 3) is unused. #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
In a couple of years ago, 'echomixer' userspace application was revised not to use 'dimen' member of 'struct snd_ctl_elem_info'.
This commit removes usage of 'dimen' member from echoaudio PCI driver so that no implementation uses the member.
Reference: 275353bb684e ("ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members") Reference: 51db452df07b ("Revert "ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members") Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- sound/pci/echoaudio/echoaudio.c | 11 ----------- 1 file changed, 11 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index a9ac9fc635aa..abad652a4006 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1237,8 +1237,6 @@ static int snd_echo_mixer_info(struct snd_kcontrol *kcontrol, uinfo->count = 1; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = ECHOGAIN_MAXOUT; - uinfo->dimen.d[0] = num_busses_out(chip); - uinfo->dimen.d[1] = num_busses_in(chip); return 0; }
@@ -1309,8 +1307,6 @@ static int snd_echo_vmixer_info(struct snd_kcontrol *kcontrol, uinfo->count = 1; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = ECHOGAIN_MAXOUT; - uinfo->dimen.d[0] = num_busses_out(chip); - uinfo->dimen.d[1] = num_pipes_out(chip); return 0; }
@@ -1693,13 +1689,6 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, uinfo->count = 96; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = 0; -#ifdef ECHOCARD_HAS_VMIXER - uinfo->dimen.d[0] = 3; /* Out, In, Virt */ -#else - uinfo->dimen.d[0] = 2; /* Out, In */ -#endif - uinfo->dimen.d[1] = 16; /* 16 channels */ - uinfo->dimen.d[2] = 2; /* 0=level, 1=peak */ return 0; }
The 'dimen' member of 'struct snd_ctl_elem_info' is designed to deliver information to use an array of value as multi-dimensional values. This feature is used just by echoaudio PCI driver, and fortunately it's not used by the other applications than 'echomixer' in alsa-tools.
In a previous commit, usage of 'dimen' member is removed from echoaudio PCI driver. Nowadays no driver/application use the feature.
This commit removes the member from structure.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- include/uapi/sound/asound.h | 6 +----- sound/core/control.c | 32 -------------------------------- 2 files changed, 1 insertion(+), 37 deletions(-)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index efd9e1398e07..06033fc78ee4 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -1040,11 +1040,7 @@ struct snd_ctl_elem_info { } enumerated; unsigned char reserved[128]; } value; - union { - unsigned short d[4]; /* dimensions */ - unsigned short *d_ptr; /* indirect - obsoleted */ - } dimen; - unsigned char reserved[64-4*sizeof(unsigned short)]; + unsigned char reserved[64]; };
struct snd_ctl_elem_value { diff --git a/sound/core/control.c b/sound/core/control.c index 7a4d8690ce41..3fa1171dc1c2 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -758,36 +758,6 @@ static int snd_ctl_elem_list(struct snd_card *card, return err; }
-static bool validate_element_member_dimension(struct snd_ctl_elem_info *info) -{ - unsigned int members; - unsigned int i; - - if (info->dimen.d[0] == 0) - return true; - - members = 1; - for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) { - if (info->dimen.d[i] == 0) - break; - members *= info->dimen.d[i]; - - /* - * info->count should be validated in advance, to guarantee - * calculation soundness. - */ - if (members > info->count) - return false; - } - - for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) { - if (info->dimen.d[i] > 0) - return false; - } - - return members == info->count; -} - static int snd_ctl_elem_info(struct snd_ctl_file *ctl, struct snd_ctl_elem_info *info) { @@ -1280,8 +1250,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, if (info->count < 1 || info->count > max_value_counts[info->type]) return -EINVAL; - if (!validate_element_member_dimension(info)) - return -EINVAL; private_size = value_sizes[info->type] * info->count;
/*
In a development period for v5.6 kernel, some changes are introduced to structures in ALSA control interface: - 'tstamp' member is removed from 'struct snd_ctl_elem_value - 'TSTAMP' flag is removed from a set of access flags for 'struct snd_ctl_elem_info' - 'dimen' member is removed from 'struct snd_ctl_elem_info
Although these changes were introduced with enough consideration for backward compatibility, they include slightly lose of it. This commit bumps protocol version of ALSA control interface up to v2.1.0.
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- include/uapi/sound/asound.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 06033fc78ee4..e36dadaf84ba 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -936,7 +936,7 @@ struct snd_timer_tread { * * ****************************************************************************/
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 1, 0)
struct snd_ctl_card_info { int card; /* card number */
On Mon, 23 Dec 2019 03:39:17 +0100, Takashi Sakamoto wrote:
Hi,
As a result of applying patchset for Y2038 issue[1], 'snd_ctl_elem_value' structure is changed to lost 'tstamp' member. This change should corresponds to removal of an access flag of 'snd_ctl_elem_info' structure. These changes brings slight lose of backward compatibility, thus it's better to bump protocol version.
Additionally, for recent few year I work to obsolete 'dimen' member from 'snd_ctl_elem_info' structure. It's good timing to attempt toward it.
This patchset includes these changes and bump the version up to v2.1.0.
[1] https://mailman.alsa-project.org/pipermail/alsa-devel/2019-December/160082.h...
Takashi Sakamoto (4): ALSA: ctl: remove unused macro for timestamping of elem_value ALSA: pci: echoaudio: remove usage of dimen menber of elem_value structure ALSA: ctl: remove dimen member from elem_info structure ALSA: ctl: bump protocol version up to v2.1.0
Applied all four patches now. Thanks.
Takashi
participants (2)
-
Takashi Iwai
-
Takashi Sakamoto