Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2006 22:45:25 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 92150 for review
Message-ID:  <200602212245.k1LMjPZf080506@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92150

Change 92150 by jhb@jhb_slimer on 2006/02/21 22:44:35

	- Don't use callout_drain() when we can't use it.
	- Axe unused callout tohandle.

Affected files ...

.. //depot/projects/smpng/sys/dev/fdc/fdc.c#20 edit

Differences ...

==== //depot/projects/smpng/sys/dev/fdc/fdc.c#20 (text+ko) ====

@@ -250,7 +250,6 @@
 #define FD_NO_TRACK	 -2
 	int	options;	/* FDOPT_* */
 	struct	callout toffhandle;
-	struct	callout tohandle;
 	struct g_geom *fd_geom;
 	struct g_provider *fd_provider;
 	device_t dev;
@@ -647,7 +646,12 @@
 		fdc->fdout |= (FDO_MOEN0 << fd->fdsu);
 		callout_reset(&fd->toffhandle, hz, fd_turnon, fd);
 	} else {
-		callout_drain(&fd->toffhandle);
+		/*
+		 * We can't call drain from a callout and we can't call it
+		 * while holding a lock needed by the callout being drained,
+		 * so use stop for now.
+		 */
+		callout_stop(&fd->toffhandle);
 		fd->flags &= ~(FD_MOTOR|FD_MOTORWAIT);
 		fdc->fdout &= ~(FDO_MOEN0 << fd->fdsu);
 	}
@@ -1199,7 +1203,8 @@
 	mtx_lock(&fdc->fdc_mtx);
 	/* If we go from idle, cancel motor turnoff */
 	if (fd->fd_iocount++ == 0)
-		callout_drain(&fd->toffhandle);
+		/* XXX: Can't drain while holding mutex. */
+		callout_stop(&fd->toffhandle);
 	if (fd->flags & FD_MOTOR) {
 		/* The motor is on, send it directly to the controller */
 		bioq_disksort(&fdc->head, bp);
@@ -1940,7 +1945,6 @@
 	fd->fdsu = fdsu;
 	fd->options = 0;
 	callout_init(&fd->toffhandle, 1);
-	callout_init(&fd->tohandle, 1);
 
 	/* initialize densities for subdevices */
 	fdsettype(fd, fd_native_types[fd->type]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602212245.k1LMjPZf080506>