svn commit: r200895 - stable/8/sys/dev/fdc

Jaakko Heinonen jh at FreeBSD.org
Wed Dec 23 11:35:26 UTC 2009


Author: jh
Date: Wed Dec 23 11:35:25 2009
New Revision: 200895
URL: http://svn.freebsd.org/changeset/base/200895

Log:
  MFC r198520, r198857: fdc(4) module unload fixes
  
  PR:		kern/104079
  Approved by:	trasz (mentor)

Modified:
  stable/8/sys/dev/fdc/fdc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/fdc/fdc.c
==============================================================================
--- stable/8/sys/dev/fdc/fdc.c	Wed Dec 23 08:22:48 2009	(r200894)
+++ stable/8/sys/dev/fdc/fdc.c	Wed Dec 23 11:35:25 2009	(r200895)
@@ -1734,6 +1734,10 @@ fdc_detach(device_t dev)
 	if ((error = bus_generic_detach(dev)))
 		return (error);
 
+	if (fdc->fdc_intr)
+		bus_teardown_intr(dev, fdc->res_irq, fdc->fdc_intr);
+	fdc->fdc_intr = NULL;
+
 	/* kill worker thread */
 	mtx_lock(&fdc->fdc_mtx);
 	fdc->flags |= FDC_KTHREAD_EXIT;
@@ -2031,15 +2035,22 @@ fd_attach(device_t dev)
 	return (0);
 }
 
+static void
+fd_detach_geom(void *arg, int flag)
+{
+	struct	fd_data *fd = arg;
+
+	g_topology_assert();
+	g_wither_geom(fd->fd_geom, ENXIO);
+}
+
 static int
 fd_detach(device_t dev)
 {
 	struct	fd_data *fd;
 
 	fd = device_get_softc(dev);
-	g_topology_lock();
-	g_wither_geom(fd->fd_geom, ENXIO);
-	g_topology_unlock();
+	g_waitfor_event(fd_detach_geom, fd, M_WAITOK, NULL);
 	while (device_get_state(dev) == DS_BUSY)
 		tsleep(fd, PZERO, "fdd", hz/10);
 	callout_drain(&fd->toffhandle);
@@ -2068,8 +2079,7 @@ static int
 fdc_modevent(module_t mod, int type, void *data)
 {
 
-	g_modevent(NULL, type, &g_fd_class);
-	return (0);
+	return (g_modevent(NULL, type, &g_fd_class));
 }
 
 DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, fdc_modevent, 0);


More information about the svn-src-all mailing list