Fix the detach code to actually detach the disk instance created

during attach.
This commit is contained in:
Poul-Henning Kamp 2003-02-23 18:31:17 +00:00
parent 6ccf52c822
commit 7d0bbeb87c

View file

@ -83,7 +83,6 @@ static struct cdevsw id_cdevsw = {
static devclass_t idad_devclass;
static struct cdevsw idaddisk_cdevsw;
static int disks_registered = 0;
static device_method_t idad_methods[] = {
DEVMETHOD(device_probe, idad_probe),
@ -269,7 +268,6 @@ idad_attach(device_t dev)
dsk->si_drv1 = drv;
dsk->si_iosize_max = DFLTPHYS; /* XXX guess? */
disks_registered++;
return (0);
}
@ -281,8 +279,6 @@ idad_detach(device_t dev)
drv = (struct idad_softc *)device_get_softc(dev);
devstat_remove_entry(&drv->stats);
if (--disks_registered == 0)
cdevsw_remove(&idaddisk_cdevsw);
disk_destroy(&drv->disk);
return (0);
}