aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdc/fdc.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-11-08 18:53:52 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-11-08 18:53:52 +0000
commitf8353ede58132ea200d95139602672d23ddd2565 (patch)
tree03642e45f4f80e202237110e6c002561b3ce4ad9 /sys/dev/fdc/fdc.c
parent3d54848fc206718ac2288aa3694e9a42354328c1 (diff)
downloadsrc-f8353ede58132ea200d95139602672d23ddd2565.tar.gz
src-f8353ede58132ea200d95139602672d23ddd2565.zip
Add the last missing bits to make this unloadable: Two wakeups and
calling of the GEOM modevent from the drivers modevent so we know the order things happen.
Notes
Notes: svn path=/head/; revision=137398
Diffstat (limited to 'sys/dev/fdc/fdc.c')
-rw-r--r--sys/dev/fdc/fdc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 62ed45cc8c9c..a2193f048d6b 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1157,6 +1157,7 @@ fdc_thread(void *arg)
mtx_lock(&fdc->fdc_mtx);
}
fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
+ wakeup(&fdc->fdc_thread);
mtx_unlock(&fdc->fdc_mtx);
kthread_exit(0);
@@ -1329,8 +1330,6 @@ struct g_class g_fd_class = {
.ioctl = fd_ioctl,
};
-DECLARE_GEOM_CLASS(g_fd_class, g_fd);
-
static int
fd_access(struct g_provider *pp, int r, int w, int e)
{
@@ -1660,6 +1659,7 @@ fdc_detach(device_t dev)
/* kill worker thread */
fdc->flags |= FDC_KTHREAD_EXIT;
mtx_lock(&fdc->fdc_mtx);
+ wakeup(&fdc->head);
while ((fdc->flags & FDC_KTHREAD_ALIVE) != 0)
msleep(&fdc->fdc_thread, &fdc->fdc_mtx, PRIBIO, "fdcdet", 0);
mtx_unlock(&fdc->fdc_mtx);
@@ -1979,4 +1979,12 @@ static driver_t fd_driver = {
sizeof(struct fd_data)
};
-DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, 0, 0);
+static int
+fdc_modevent(module_t mod, int type, void *data)
+{
+
+ g_modevent(NULL, type, &g_fd_class);
+ return (0);
+}
+
+DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, fdc_modevent, 0);