* Fix panic during driver unload on second attempt after failure on
first (device busy). * Fix module unloading for sound.ko itself. Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@
This commit is contained in:
parent
32069af652
commit
7233abab86
@ -74,7 +74,7 @@ static d_close_t mixer_close;
|
||||
|
||||
static struct cdevsw mixer_cdevsw = {
|
||||
.d_version = D_VERSION,
|
||||
.d_flags = D_NEEDGIANT,
|
||||
.d_flags = D_TRACKCLOSE | D_NEEDGIANT,
|
||||
.d_open = mixer_open,
|
||||
.d_close = mixer_close,
|
||||
.d_ioctl = mixer_ioctl,
|
||||
|
@ -654,7 +654,14 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
|
||||
|
||||
d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* d->flags should be cleared by the allocator of the softc.
|
||||
* We cannot clear this field here because several devices set
|
||||
* this flag before calling pcm_register().
|
||||
*/
|
||||
d->flags = 0;
|
||||
#endif
|
||||
d->dev = dev;
|
||||
d->devinfo = devinfo;
|
||||
d->devcount = 0;
|
||||
@ -725,6 +732,12 @@ pcm_unregister(device_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (mixer_uninit(dev)) {
|
||||
device_printf(dev, "unregister: mixer busy\n");
|
||||
snd_mtxunlock(d->lock);
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
SLIST_FOREACH(sce, &d->channels, link) {
|
||||
destroy_dev(sce->dsp_devt);
|
||||
destroy_dev(sce->dspW_devt);
|
||||
@ -733,12 +746,6 @@ pcm_unregister(device_t dev)
|
||||
destroy_dev(sce->dspr_devt);
|
||||
}
|
||||
|
||||
if (mixer_uninit(dev)) {
|
||||
device_printf(dev, "unregister: mixer busy\n");
|
||||
snd_mtxunlock(d->lock);
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
#ifdef SND_DYNSYSCTL
|
||||
d->sysctl_tree_top = NULL;
|
||||
sysctl_ctx_free(&d->sysctl_tree);
|
||||
@ -972,15 +979,15 @@ sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if notyet
|
||||
static int
|
||||
sound_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
#if 0
|
||||
return (midi_modevent(mod, type, data));
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEV_MODULE(sound, sound_modevent, NULL);
|
||||
#else
|
||||
DEV_MODULE(sound, NULL, NULL);
|
||||
#endif /* notyet */
|
||||
MODULE_VERSION(sound, SOUND_MODVER);
|
||||
|
Loading…
Reference in New Issue
Block a user