Skip to content

Commit ff16351

Browse files
takaswietiwai
authored andcommitted
ALSA: ctl: remove dimen member from elem_info structure
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> Link: https://lore.kernel.org/r/20191223023921.8151-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e67c3f0 commit ff16351

2 files changed

Lines changed: 1 addition & 37 deletions

File tree

‎include/uapi/sound/asound.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,11 +1040,7 @@ struct snd_ctl_elem_info {
10401040
} enumerated;
10411041
unsigned char reserved[128];
10421042
} value;
1043-
union {
1044-
unsigned short d[4]; /* dimensions */
1045-
unsigned short *d_ptr; /* indirect - obsoleted */
1046-
} dimen;
1047-
unsigned char reserved[64-4*sizeof(unsigned short)];
1043+
unsigned char reserved[64];
10481044
};
10491045

10501046
struct snd_ctl_elem_value {

‎sound/core/control.c‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -758,36 +758,6 @@ static int snd_ctl_elem_list(struct snd_card *card,
758758
return err;
759759
}
760760

761-
static bool validate_element_member_dimension(struct snd_ctl_elem_info *info)
762-
{
763-
unsigned int members;
764-
unsigned int i;
765-
766-
if (info->dimen.d[0] == 0)
767-
return true;
768-
769-
members = 1;
770-
for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) {
771-
if (info->dimen.d[i] == 0)
772-
break;
773-
members *= info->dimen.d[i];
774-
775-
/*
776-
* info->count should be validated in advance, to guarantee
777-
* calculation soundness.
778-
*/
779-
if (members > info->count)
780-
return false;
781-
}
782-
783-
for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) {
784-
if (info->dimen.d[i] > 0)
785-
return false;
786-
}
787-
788-
return members == info->count;
789-
}
790-
791761
static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
792762
struct snd_ctl_elem_info *info)
793763
{
@@ -1280,8 +1250,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
12801250
if (info->count < 1 ||
12811251
info->count > max_value_counts[info->type])
12821252
return -EINVAL;
1283-
if (!validate_element_member_dimension(info))
1284-
return -EINVAL;
12851253
private_size = value_sizes[info->type] * info->count;
12861254

12871255
/*

0 commit comments

Comments
 (0)