From owner-svn-src-user@FreeBSD.ORG  Tue Jan 27 16:09:39 2009
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2CB6210656C6;
	Tue, 27 Jan 2009 16:09:39 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0FB588FC14;
	Tue, 27 Jan 2009 16:09:39 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0RG9crO090442;
	Tue, 27 Jan 2009 16:09:38 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0RG9c8b090440;
	Tue, 27 Jan 2009 16:09:38 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200901271609.n0RG9c8b090440@svn.freebsd.org>
From: Andrew Thompson <thompsa@FreeBSD.org>
Date: Tue, 27 Jan 2009 16:09:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r187774 - user/thompsa/usb/sys/dev/usb2/wlan
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 27 Jan 2009 16:09:39 -0000

Author: thompsa
Date: Tue Jan 27 16:09:38 2009
New Revision: 187774
URL: http://svn.freebsd.org/changeset/base/187774

Log:
  Revert r187773. The reason that I had write commands waiting was the data is on
  the stack, just use a different wait channel.

Modified:
  user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c
  user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h

Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c
==============================================================================
--- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c	Tue Jan 27 15:40:09 2009	(r187773)
+++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c	Tue Jan 27 16:09:38 2009	(r187774)
@@ -757,12 +757,7 @@ zyd_intr_read_callback(struct usb2_xfer 
 				}
 				if (i != rqp->olen)
 					continue;
-
-				/* copy answer into caller-supplied buffer */
-				bcopy(cmd->data, rqp->odata,
-				    sizeof(struct zyd_pair) * rqp->olen);
-				wakeup(rqp->odata);	/* wakeup caller */
-
+				wakeup(rqp);	/* wakeup caller */
 				return;
 			}
 			return;	/* unexpected IORD notification */
@@ -817,6 +812,9 @@ zyd_intr_write_callback(struct usb2_xfer
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
 		DPRINTF(sc, ZYD_DEBUG_ANY, "length=%d\n", xfer->actlen);
+		rqp = xfer->priv_fifo;
+		if ((rqp->flags & ZYD_CMD_FLAG_READ) == 0)
+			wakeup(rqp);	/* wakeup caller */
 
 		/* FALLTHROUGH */
 	case USB_ST_SETUP:
@@ -835,7 +833,6 @@ zyd_intr_write_callback(struct usb2_xfer
 			xfer->priv_fifo = rqp;
 			rqp->flags |= ZYD_CMD_FLAG_SENT;
 			usb2_start_hardware(xfer);
-			break;
 		}
 		break;
 
@@ -849,7 +846,7 @@ zyd_intr_write_callback(struct usb2_xfer
 			usb2_transfer_start(sc->sc_xfer[ZYD_INTR_CS_WR]);
 		}
 		rqp = xfer->priv_fifo;
-		wakeup(rqp->odata);	/* wakeup caller */
+		wakeup(rqp);	/* wakeup caller */
 		break;
 	}
 }
@@ -886,19 +883,17 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c
 	rq.cmd = &cmd;
 	rq.idata = idata;
 	rq.ilen = sizeof(uint16_t) + ilen;
-	rq.odata = odata;
 	rq.olen = olen / sizeof(struct zyd_pair);
 	rq.flags = flags;
 	STAILQ_INSERT_TAIL(&sc->sc_rqh, &rq, rq);
 	usb2_transfer_start(sc->sc_xfer[ZYD_INTR_DT_WR]);
 
-	if (!(flags & ZYD_CMD_FLAG_READ))
-		return (0);	/* write: don't wait for reply */
 	/* wait at most one second for command reply */
-	error = mtx_sleep(odata, &sc->sc_mtx, 0 , "zydcmd", hz);
+	error = mtx_sleep(&rq, &sc->sc_mtx, 0 , "zydcmd", hz);
 	if (error)
 		device_printf(sc->sc_dev, "command timeout\n");
 	STAILQ_REMOVE(&sc->sc_rqh, &rq, zyd_rq, rq);
+	bcopy(cmd.data, odata, olen);	/* copy answer into caller buffer */
 
 	return (error);
 }
@@ -3154,7 +3149,7 @@ zyd_wakeup(struct zyd_softc *sc)
 	struct zyd_rq *rqp;
 
 	STAILQ_FOREACH(rqp, &sc->sc_rqh, rq)
-		wakeup(rqp->odata);		/* wakeup sleeping caller */
+		wakeup(rqp);		/* wakeup sleeping caller */
 }
 
 static device_method_t zyd_methods[] = {

Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h
==============================================================================
--- user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h	Tue Jan 27 15:40:09 2009	(r187773)
+++ user/thompsa/usb/sys/dev/usb2/wlan/if_zydreg.h	Tue Jan 27 16:09:38 2009	(r187774)
@@ -1231,7 +1231,6 @@ struct zyd_rf {
 struct zyd_rq {
 	struct zyd_cmd		*cmd;
 	const uint16_t		*idata;
-	struct zyd_pair		*odata;
 	int			ilen;
 	int			olen;
 	int			flags;