aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:47 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:40 -0400
commit5e246b850df563224be26f1d409cf66fd6c968df (patch)
tree970e7faf60b86cb2c489a08ca506075c398165e5 /sound/ppc
parentda3cec35dd3c31d8706db4bf379372ce70d92118 (diff)
ALSA: Kill snd_assert() in other places
Kill snd_assert() in other places, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/ppc')
-rw-r--r--sound/ppc/awacs.c23
-rw-r--r--sound/ppc/beep.c6
-rw-r--r--sound/ppc/tumbler.c17
3 files changed, 18 insertions, 28 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 106c48225bba..7bd33e6552ab 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -319,7 +319,8 @@ static void awacs_amp_set_master(struct awacs_amp *amp, int vol)
319static void awacs_amp_free(struct snd_pmac *chip) 319static void awacs_amp_free(struct snd_pmac *chip)
320{ 320{
321 struct awacs_amp *amp = chip->mixer_data; 321 struct awacs_amp *amp = chip->mixer_data;
322 snd_assert(amp, return); 322 if (!amp)
323 return;
323 kfree(amp); 324 kfree(amp);
324 chip->mixer_data = NULL; 325 chip->mixer_data = NULL;
325 chip->mixer_free = NULL; 326 chip->mixer_free = NULL;
@@ -345,8 +346,7 @@ static int snd_pmac_awacs_get_volume_amp(struct snd_kcontrol *kcontrol,
345 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 346 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
346 int index = kcontrol->private_value; 347 int index = kcontrol->private_value;
347 struct awacs_amp *amp = chip->mixer_data; 348 struct awacs_amp *amp = chip->mixer_data;
348 snd_assert(amp, return -EINVAL); 349
349 snd_assert(index >= 0 && index <= 1, return -EINVAL);
350 ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31); 350 ucontrol->value.integer.value[0] = 31 - (amp->amp_vol[index][0] & 31);
351 ucontrol->value.integer.value[1] = 31 - (amp->amp_vol[index][1] & 31); 351 ucontrol->value.integer.value[1] = 31 - (amp->amp_vol[index][1] & 31);
352 return 0; 352 return 0;
@@ -359,8 +359,6 @@ static int snd_pmac_awacs_put_volume_amp(struct snd_kcontrol *kcontrol,
359 int index = kcontrol->private_value; 359 int index = kcontrol->private_value;
360 int vol[2]; 360 int vol[2];
361 struct awacs_amp *amp = chip->mixer_data; 361 struct awacs_amp *amp = chip->mixer_data;
362 snd_assert(amp, return -EINVAL);
363 snd_assert(index >= 0 && index <= 1, return -EINVAL);
364 362
365 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31)) 363 vol[0] = (31 - (ucontrol->value.integer.value[0] & 31))
366 | (amp->amp_vol[index][0] & 32); 364 | (amp->amp_vol[index][0] & 32);
@@ -375,8 +373,7 @@ static int snd_pmac_awacs_get_switch_amp(struct snd_kcontrol *kcontrol,
375 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 373 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
376 int index = kcontrol->private_value; 374 int index = kcontrol->private_value;
377 struct awacs_amp *amp = chip->mixer_data; 375 struct awacs_amp *amp = chip->mixer_data;
378 snd_assert(amp, return -EINVAL); 376
379 snd_assert(index >= 0 && index <= 1, return -EINVAL);
380 ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32) 377 ucontrol->value.integer.value[0] = (amp->amp_vol[index][0] & 32)
381 ? 0 : 1; 378 ? 0 : 1;
382 ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32) 379 ucontrol->value.integer.value[1] = (amp->amp_vol[index][1] & 32)
@@ -391,8 +388,6 @@ static int snd_pmac_awacs_put_switch_amp(struct snd_kcontrol *kcontrol,
391 int index = kcontrol->private_value; 388 int index = kcontrol->private_value;
392 int vol[2]; 389 int vol[2];
393 struct awacs_amp *amp = chip->mixer_data; 390 struct awacs_amp *amp = chip->mixer_data;
394 snd_assert(amp, return -EINVAL);
395 snd_assert(index >= 0 && index <= 1, return -EINVAL);
396 391
397 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32) 392 vol[0] = (ucontrol->value.integer.value[0] ? 0 : 32)
398 | (amp->amp_vol[index][0] & 31); 393 | (amp->amp_vol[index][0] & 31);
@@ -417,8 +412,7 @@ static int snd_pmac_awacs_get_tone_amp(struct snd_kcontrol *kcontrol,
417 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 412 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
418 int index = kcontrol->private_value; 413 int index = kcontrol->private_value;
419 struct awacs_amp *amp = chip->mixer_data; 414 struct awacs_amp *amp = chip->mixer_data;
420 snd_assert(amp, return -EINVAL); 415
421 snd_assert(index >= 0 && index <= 1, return -EINVAL);
422 ucontrol->value.integer.value[0] = amp->amp_tone[index]; 416 ucontrol->value.integer.value[0] = amp->amp_tone[index];
423 return 0; 417 return 0;
424} 418}
@@ -430,8 +424,7 @@ static int snd_pmac_awacs_put_tone_amp(struct snd_kcontrol *kcontrol,
430 int index = kcontrol->private_value; 424 int index = kcontrol->private_value;
431 struct awacs_amp *amp = chip->mixer_data; 425 struct awacs_amp *amp = chip->mixer_data;
432 unsigned int val; 426 unsigned int val;
433 snd_assert(amp, return -EINVAL); 427
434 snd_assert(index >= 0 && index <= 1, return -EINVAL);
435 val = ucontrol->value.integer.value[0]; 428 val = ucontrol->value.integer.value[0];
436 if (val > 14) 429 if (val > 14)
437 return -EINVAL; 430 return -EINVAL;
@@ -458,7 +451,7 @@ static int snd_pmac_awacs_get_master_amp(struct snd_kcontrol *kcontrol,
458{ 451{
459 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 452 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
460 struct awacs_amp *amp = chip->mixer_data; 453 struct awacs_amp *amp = chip->mixer_data;
461 snd_assert(amp, return -EINVAL); 454
462 ucontrol->value.integer.value[0] = amp->amp_master; 455 ucontrol->value.integer.value[0] = amp->amp_master;
463 return 0; 456 return 0;
464} 457}
@@ -469,7 +462,7 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol,
469 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 462 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
470 struct awacs_amp *amp = chip->mixer_data; 463 struct awacs_amp *amp = chip->mixer_data;
471 unsigned int val; 464 unsigned int val;
472 snd_assert(amp, return -EINVAL); 465
473 val = ucontrol->value.integer.value[0]; 466 val = ucontrol->value.integer.value[0];
474 if (val > 99) 467 if (val > 99)
475 return -EINVAL; 468 return -EINVAL;
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index baa2a7237370..89f5c328acfe 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -185,7 +185,8 @@ static int snd_pmac_get_beep(struct snd_kcontrol *kcontrol,
185 struct snd_ctl_elem_value *ucontrol) 185 struct snd_ctl_elem_value *ucontrol)
186{ 186{
187 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 187 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
188 snd_assert(chip->beep, return -ENXIO); 188 if (snd_BUG_ON(!chip->beep))
189 return -ENXIO;
189 ucontrol->value.integer.value[0] = chip->beep->volume; 190 ucontrol->value.integer.value[0] = chip->beep->volume;
190 return 0; 191 return 0;
191} 192}
@@ -195,7 +196,8 @@ static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol,
195{ 196{
196 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 197 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
197 unsigned int oval, nval; 198 unsigned int oval, nval;
198 snd_assert(chip->beep, return -ENXIO); 199 if (snd_BUG_ON(!chip->beep))
200 return -ENXIO;
199 oval = chip->beep->volume; 201 oval = chip->beep->volume;
200 nval = ucontrol->value.integer.value[0]; 202 nval = ucontrol->value.integer.value[0];
201 if (nval > 100) 203 if (nval > 100)
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 009df8dd37a8..f746e15b8481 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -263,7 +263,7 @@ static int tumbler_get_master_volume(struct snd_kcontrol *kcontrol,
263{ 263{
264 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 264 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
265 struct pmac_tumbler *mix = chip->mixer_data; 265 struct pmac_tumbler *mix = chip->mixer_data;
266 snd_assert(mix, return -ENODEV); 266
267 ucontrol->value.integer.value[0] = mix->master_vol[0]; 267 ucontrol->value.integer.value[0] = mix->master_vol[0];
268 ucontrol->value.integer.value[1] = mix->master_vol[1]; 268 ucontrol->value.integer.value[1] = mix->master_vol[1];
269 return 0; 269 return 0;
@@ -277,7 +277,6 @@ static int tumbler_put_master_volume(struct snd_kcontrol *kcontrol,
277 unsigned int vol[2]; 277 unsigned int vol[2];
278 int change; 278 int change;
279 279
280 snd_assert(mix, return -ENODEV);
281 vol[0] = ucontrol->value.integer.value[0]; 280 vol[0] = ucontrol->value.integer.value[0];
282 vol[1] = ucontrol->value.integer.value[1]; 281 vol[1] = ucontrol->value.integer.value[1];
283 if (vol[0] >= ARRAY_SIZE(master_volume_table) || 282 if (vol[0] >= ARRAY_SIZE(master_volume_table) ||
@@ -299,7 +298,7 @@ static int tumbler_get_master_switch(struct snd_kcontrol *kcontrol,
299{ 298{
300 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 299 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
301 struct pmac_tumbler *mix = chip->mixer_data; 300 struct pmac_tumbler *mix = chip->mixer_data;
302 snd_assert(mix, return -ENODEV); 301
303 ucontrol->value.integer.value[0] = mix->master_switch[0]; 302 ucontrol->value.integer.value[0] = mix->master_switch[0];
304 ucontrol->value.integer.value[1] = mix->master_switch[1]; 303 ucontrol->value.integer.value[1] = mix->master_switch[1];
305 return 0; 304 return 0;
@@ -312,7 +311,6 @@ static int tumbler_put_master_switch(struct snd_kcontrol *kcontrol,
312 struct pmac_tumbler *mix = chip->mixer_data; 311 struct pmac_tumbler *mix = chip->mixer_data;
313 int change; 312 int change;
314 313
315 snd_assert(mix, return -ENODEV);
316 change = mix->master_switch[0] != ucontrol->value.integer.value[0] || 314 change = mix->master_switch[0] != ucontrol->value.integer.value[0] ||
317 mix->master_switch[1] != ucontrol->value.integer.value[1]; 315 mix->master_switch[1] != ucontrol->value.integer.value[1];
318 if (change) { 316 if (change) {
@@ -807,7 +805,6 @@ static int snapper_get_capture_source(struct snd_kcontrol *kcontrol,
807 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 805 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
808 struct pmac_tumbler *mix = chip->mixer_data; 806 struct pmac_tumbler *mix = chip->mixer_data;
809 807
810 snd_assert(mix, return -ENODEV);
811 ucontrol->value.enumerated.item[0] = mix->capture_source; 808 ucontrol->value.enumerated.item[0] = mix->capture_source;
812 return 0; 809 return 0;
813} 810}
@@ -819,7 +816,6 @@ static int snapper_put_capture_source(struct snd_kcontrol *kcontrol,
819 struct pmac_tumbler *mix = chip->mixer_data; 816 struct pmac_tumbler *mix = chip->mixer_data;
820 int change; 817 int change;
821 818
822 snd_assert(mix, return -ENODEV);
823 change = ucontrol->value.enumerated.item[0] != mix->capture_source; 819 change = ucontrol->value.enumerated.item[0] != mix->capture_source;
824 if (change) { 820 if (change) {
825 mix->capture_source = !!ucontrol->value.enumerated.item[0]; 821 mix->capture_source = !!ucontrol->value.enumerated.item[0];
@@ -978,7 +974,8 @@ static void device_change_handler(struct work_struct *work)
978 return; 974 return;
979 975
980 mix = chip->mixer_data; 976 mix = chip->mixer_data;
981 snd_assert(mix, return); 977 if (snd_BUG_ON(!mix))
978 return;
982 979
983 headphone = tumbler_detect_headphone(chip); 980 headphone = tumbler_detect_headphone(chip);
984 lineout = tumbler_detect_lineout(chip); 981 lineout = tumbler_detect_lineout(chip);
@@ -1033,7 +1030,8 @@ static void tumbler_update_automute(struct snd_pmac *chip, int do_notify)
1033 if (chip->auto_mute) { 1030 if (chip->auto_mute) {
1034 struct pmac_tumbler *mix; 1031 struct pmac_tumbler *mix;
1035 mix = chip->mixer_data; 1032 mix = chip->mixer_data;
1036 snd_assert(mix, return); 1033 if (snd_BUG_ON(!mix))
1034 return;
1037 mix->auto_mute_notify = do_notify; 1035 mix->auto_mute_notify = do_notify;
1038 schedule_work(&device_change); 1036 schedule_work(&device_change);
1039 } 1037 }
@@ -1227,8 +1225,6 @@ static void tumbler_resume(struct snd_pmac *chip)
1227{ 1225{
1228 struct pmac_tumbler *mix = chip->mixer_data; 1226 struct pmac_tumbler *mix = chip->mixer_data;
1229 1227
1230 snd_assert(mix, return);
1231
1232 mix->acs &= ~1; 1228 mix->acs &= ~1;
1233 mix->master_switch[0] = mix->save_master_switch[0]; 1229 mix->master_switch[0] = mix->save_master_switch[0];
1234 mix->master_switch[1] = mix->save_master_switch[1]; 1230 mix->master_switch[1] = mix->save_master_switch[1];
@@ -1275,7 +1271,6 @@ static int __init tumbler_init(struct snd_pmac *chip)
1275{ 1271{
1276 int irq; 1272 int irq;
1277 struct pmac_tumbler *mix = chip->mixer_data; 1273 struct pmac_tumbler *mix = chip->mixer_data;
1278 snd_assert(mix, return -EINVAL);
1279 1274
1280 if (tumbler_find_device("audio-hw-reset", 1275 if (tumbler_find_device("audio-hw-reset",
1281 "platform-do-hw-reset", 1276 "platform-do-hw-reset",