aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-01-08 18:33:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-08 19:10:36 -0500
commit22a860a9e22fa077300e1e72170afb82bf695617 (patch)
tree8922ac6bbb77838a8a50c75a508328b6a88e1a94 /sound/core
parentce8c628abadaf16a44953301c68b9f54cf6898cc (diff)
snd_mixer_oss_build_input(): fix for __you_cannot_kmalloc_that_much failure with gcc-3.2
Rework this functions so that gcc-3.2 can successfully perform constant-folding. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/oss/mixer_oss.c101
1 files changed, 63 insertions, 38 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 3ace4a5680ba..c5a5ab9cae8c 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -925,6 +925,68 @@ static void mixer_slot_clear(struct snd_mixer_oss_slot *rslot)
925 rslot->number = idx; 925 rslot->number = idx;
926} 926}
927 927
928/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
929 snd_mixer_oss_build_input! */
930static int snd_mixer_oss_build_test_all(struct snd_mixer_oss *mixer,
931 struct snd_mixer_oss_assign_table *ptr,
932 struct slot *slot)
933{
934 char str[64];
935 int err;
936
937 err = snd_mixer_oss_build_test(mixer, slot, ptr->name, ptr->index,
938 SNDRV_MIXER_OSS_ITEM_GLOBAL);
939 if (err)
940 return err;
941 sprintf(str, "%s Switch", ptr->name);
942 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
943 SNDRV_MIXER_OSS_ITEM_GSWITCH);
944 if (err)
945 return err;
946 sprintf(str, "%s Route", ptr->name);
947 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
948 SNDRV_MIXER_OSS_ITEM_GROUTE);
949 if (err)
950 return err;
951 sprintf(str, "%s Volume", ptr->name);
952 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
953 SNDRV_MIXER_OSS_ITEM_GVOLUME);
954 if (err)
955 return err;
956 sprintf(str, "%s Playback Switch", ptr->name);
957 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
958 SNDRV_MIXER_OSS_ITEM_PSWITCH);
959 if (err)
960 return err;
961 sprintf(str, "%s Playback Route", ptr->name);
962 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
963 SNDRV_MIXER_OSS_ITEM_PROUTE);
964 if (err)
965 return err;
966 sprintf(str, "%s Playback Volume", ptr->name);
967 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
968 SNDRV_MIXER_OSS_ITEM_PVOLUME);
969 if (err)
970 return err;
971 sprintf(str, "%s Capture Switch", ptr->name);
972 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
973 SNDRV_MIXER_OSS_ITEM_CSWITCH);
974 if (err)
975 return err;
976 sprintf(str, "%s Capture Route", ptr->name);
977 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
978 SNDRV_MIXER_OSS_ITEM_CROUTE);
979 if (err)
980 return err;
981 sprintf(str, "%s Capture Volume", ptr->name);
982 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
983 SNDRV_MIXER_OSS_ITEM_CVOLUME);
984 if (err)
985 return err;
986
987 return 0;
988}
989
928/* 990/*
929 * build an OSS mixer element. 991 * build an OSS mixer element.
930 * ptr_allocated means the entry is dynamically allocated (change via proc file). 992 * ptr_allocated means the entry is dynamically allocated (change via proc file).
@@ -944,44 +1006,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
944 1006
945 memset(&slot, 0, sizeof(slot)); 1007 memset(&slot, 0, sizeof(slot));
946 memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */ 1008 memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */
947 if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index, 1009 if (snd_mixer_oss_build_test_all(mixer, ptr, &slot))
948 SNDRV_MIXER_OSS_ITEM_GLOBAL))
949 return 0;
950 sprintf(str, "%s Switch", ptr->name);
951 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
952 SNDRV_MIXER_OSS_ITEM_GSWITCH))
953 return 0;
954 sprintf(str, "%s Route", ptr->name);
955 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
956 SNDRV_MIXER_OSS_ITEM_GROUTE))
957 return 0;
958 sprintf(str, "%s Volume", ptr->name);
959 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
960 SNDRV_MIXER_OSS_ITEM_GVOLUME))
961 return 0;
962 sprintf(str, "%s Playback Switch", ptr->name);
963 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
964 SNDRV_MIXER_OSS_ITEM_PSWITCH))
965 return 0;
966 sprintf(str, "%s Playback Route", ptr->name);
967 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
968 SNDRV_MIXER_OSS_ITEM_PROUTE))
969 return 0;
970 sprintf(str, "%s Playback Volume", ptr->name);
971 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
972 SNDRV_MIXER_OSS_ITEM_PVOLUME))
973 return 0;
974 sprintf(str, "%s Capture Switch", ptr->name);
975 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
976 SNDRV_MIXER_OSS_ITEM_CSWITCH))
977 return 0;
978 sprintf(str, "%s Capture Route", ptr->name);
979 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
980 SNDRV_MIXER_OSS_ITEM_CROUTE))
981 return 0;
982 sprintf(str, "%s Capture Volume", ptr->name);
983 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
984 SNDRV_MIXER_OSS_ITEM_CVOLUME))
985 return 0; 1010 return 0;
986 down_read(&mixer->card->controls_rwsem); 1011 down_read(&mixer->card->controls_rwsem);
987 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { 1012 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {