summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2009-06-05 01:21:03 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2009-06-05 01:21:03 +0000
commit0e8c02fad4108564f81c8208ae1eb50988bcf989 (patch)
tree72ecb471df7529f5f03effccee0085328c8c99f2 /sys/dev/usb
parent41d607b5268ed1274426b6506ef9e48729d011df (diff)
reduce diff i will send in a minute
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_urtw.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c
index 10f087312d4..9c266781e9b 100644
--- a/sys/dev/usb/if_urtw.c
+++ b/sys/dev/usb/if_urtw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_urtw.c,v 1.19 2009/06/04 23:42:02 martynas Exp $ */
+/* $OpenBSD: if_urtw.c,v 1.20 2009/06/05 01:21:02 martynas Exp $ */
/*-
* Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org>
@@ -744,7 +744,7 @@ urtw_alloc_rx_data_list(struct urtw_softc *sc)
int i, error;
for (i = 0; i < URTW_RX_DATA_LIST_COUNT; i++) {
- struct urtw_rx_data *data = &sc->sc_rxdata[i];
+ struct urtw_rx_data *data = &sc->sc_rx_data[i];
data->sc = sc;
@@ -756,6 +756,13 @@ urtw_alloc_rx_data_list(struct urtw_softc *sc)
goto fail;
}
+ if (usbd_alloc_buffer(data->xfer, URTW_RX_MAXSIZE) == NULL) {
+ printf("%s: could not allocate rx buffer\n",
+ sc->sc_dev.dv_xname);
+ error = ENOMEM;
+ goto fail;
+ }
+
MGETHDR(data->m, M_DONTWAIT, MT_DATA);
if (data->m == NULL) {
printf("%s: could not allocate rx mbuf\n",
@@ -790,7 +797,7 @@ urtw_free_rx_data_list(struct urtw_softc *sc)
usbd_abort_pipe(sc->sc_rxpipe);
for (i = 0; i < URTW_RX_DATA_LIST_COUNT; i++) {
- struct urtw_rx_data *data = &sc->sc_rxdata[i];
+ struct urtw_rx_data *data = &sc->sc_rx_data[i];
if (data->xfer != NULL) {
usbd_free_xfer(data->xfer);
@@ -809,7 +816,7 @@ urtw_alloc_tx_data_list(struct urtw_softc *sc)
int i, error;
for (i = 0; i < URTW_TX_DATA_LIST_COUNT; i++) {
- struct urtw_tx_data *data = &sc->sc_txdata[i];
+ struct urtw_tx_data *data = &sc->sc_tx_data[i];
data->sc = sc;
data->ni = NULL;
@@ -855,7 +862,7 @@ urtw_free_tx_data_list(struct urtw_softc *sc)
usbd_abort_pipe(sc->sc_txpipe_normal);
for (i = 0; i < URTW_TX_DATA_LIST_COUNT; i++) {
- struct urtw_tx_data *data = &sc->sc_txdata[i];
+ struct urtw_tx_data *data = &sc->sc_tx_data[i];
if (data->xfer != NULL) {
usbd_free_xfer(data->xfer);
@@ -1999,7 +2006,7 @@ usbd_status
urtw_rx_enable(struct urtw_softc *sc)
{
int i;
- struct urtw_rx_data *rxdata;
+ struct urtw_rx_data *rx_data;
uint8_t data;
usbd_status error;
@@ -2007,12 +2014,12 @@ urtw_rx_enable(struct urtw_softc *sc)
* Start up the receive pipe.
*/
for (i = 0; i < URTW_RX_DATA_LIST_COUNT; i++) {
- rxdata = &sc->sc_rxdata[i];
+ rx_data = &sc->sc_rx_data[i];
- usbd_setup_xfer(rxdata->xfer, sc->sc_rxpipe, rxdata,
- rxdata->buf, MCLBYTES, USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT,
- urtw_rxeof);
- error = usbd_transfer(rxdata->xfer);
+ usbd_setup_xfer(rx_data->xfer, sc->sc_rxpipe, rx_data,
+ rx_data->buf, MCLBYTES, USBD_SHORT_XFER_OK,
+ USBD_NO_TIMEOUT, urtw_rxeof);
+ error = usbd_transfer(rx_data->xfer);
if (error != USBD_IN_PROGRESS && error != 0) {
printf("%s: could not queue Rx transfer\n",
sc->sc_dev.dv_xname);
@@ -2494,7 +2501,7 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0,
if ((0 == xferlen % 64) || (0 == xferlen % 512))
xferlen += 1;
- data = &sc->sc_txdata[sc->sc_txidx];
+ data = &sc->sc_tx_data[sc->sc_txidx];
sc->sc_txidx = (sc->sc_txidx + 1) % URTW_TX_DATA_LIST_COUNT;
bzero(data->buf, URTW_TX_MAXSIZE);