Date: Tue, 27 Jan 2009 16:09:38 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r187774 - user/thompsa/usb/sys/dev/usb2/wlan Message-ID: <200901271609.n0RG9c8b090440@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901271609.n0RG9c8b090440>