mixer.c (d3ce8327194c0bcf742f2e03b5b0dc8f8cfe7f6b) mixer.c (eabe30fc9c3f2d6a3bc2fdcce18a0b9543b6c96e)
1/*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 575 unchanged lines hidden (view full) ---

584
585int
586mixer_delete(struct snd_mixer *m)
587{
588 KASSERT(m != NULL, ("NULL snd_mixer"));
589 KASSERT(m->type == MIXER_TYPE_SECONDARY,
590 ("%s(): illegal mixer type=%d", __func__, m->type));
591
1/*-
2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 575 unchanged lines hidden (view full) ---

584
585int
586mixer_delete(struct snd_mixer *m)
587{
588 KASSERT(m != NULL, ("NULL snd_mixer"));
589 KASSERT(m->type == MIXER_TYPE_SECONDARY,
590 ("%s(): illegal mixer type=%d", __func__, m->type));
591
592 snd_mtxlock(m->lock);
592 /* mixer uninit can sleep --hps */
593
594 MIXER_UNINIT(m);
595
596 snd_mtxfree(m->lock);
597 kobj_delete((kobj_t)m, M_MIXER);
598
599 --mixer_count;
600

--- 98 unchanged lines hidden (view full) ---

699
700 snd_mtxlock(m->lock);
701
702 if (m->busy) {
703 snd_mtxunlock(m->lock);
704 return EBUSY;
705 }
706
593
594 MIXER_UNINIT(m);
595
596 snd_mtxfree(m->lock);
597 kobj_delete((kobj_t)m, M_MIXER);
598
599 --mixer_count;
600

--- 98 unchanged lines hidden (view full) ---

699
700 snd_mtxlock(m->lock);
701
702 if (m->busy) {
703 snd_mtxunlock(m->lock);
704 return EBUSY;
705 }
706
707 /* destroy dev can sleep --hps */
708
709 snd_mtxunlock(m->lock);
710
707 pdev->si_drv1 = NULL;
708 destroy_dev(pdev);
709
711 pdev->si_drv1 = NULL;
712 destroy_dev(pdev);
713
714 snd_mtxlock(m->lock);
715
710 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
711 mixer_set(m, i, 0);
712
713 mixer_setrecsrc(m, SOUND_MASK_MIC);
714
716 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
717 mixer_set(m, i, 0);
718
719 mixer_setrecsrc(m, SOUND_MASK_MIC);
720
721 snd_mtxunlock(m->lock);
722
723 /* mixer uninit can sleep --hps */
724
715 MIXER_UNINIT(m);
716
717 snd_mtxfree(m->lock);
718 kobj_delete((kobj_t)m, M_MIXER);
719
720 d->mixer_dev = NULL;
721
722 --mixer_count;

--- 552 unchanged lines hidden (view full) ---

1275 pcm_unlock(d);
1276
1277 if (m != NULL)
1278 return (0);
1279 }
1280
1281 return (EINVAL);
1282}
725 MIXER_UNINIT(m);
726
727 snd_mtxfree(m->lock);
728 kobj_delete((kobj_t)m, M_MIXER);
729
730 d->mixer_dev = NULL;
731
732 --mixer_count;

--- 552 unchanged lines hidden (view full) ---

1285 pcm_unlock(d);
1286
1287 if (m != NULL)
1288 return (0);
1289 }
1290
1291 return (EINVAL);
1292}
1293
1294/*
1295 * Allow the sound driver to use the mixer lock to protect its mixer
1296 * data:
1297 */
1298struct mtx *
1299mixer_get_lock(struct snd_mixer *m)
1300{
1301 if (m->lock == NULL) {
1302 return (&Giant);
1303 }
1304 return (m->lock);
1305}