Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Mostly stylistic change, making comments and pri...
details: https://anonhg.NetBSD.org/src/rev/b54f9fc0bc47
branches: trunk
changeset: 551669:b54f9fc0bc47
user: mycroft <mycroft%NetBSD.org@localhost>
date: Wed Sep 10 06:38:28 2003 +0000
description:
Mostly stylistic change, making comments and printf()s similar between BBB
and CBI.
diffstat:
sys/dev/usb/umass.c | 87 ++++++++++++++++++++++++++++------------------------
1 files changed, 47 insertions(+), 40 deletions(-)
diffs (180 lines):
diff -r f47ea3cfbf1e -r b54f9fc0bc47 sys/dev/usb/umass.c
--- a/sys/dev/usb/umass.c Wed Sep 10 05:51:06 2003 +0000
+++ b/sys/dev/usb/umass.c Wed Sep 10 06:38:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umass.c,v 1.102 2003/09/10 05:42:18 mycroft Exp $ */
+/* $NetBSD: umass.c,v 1.103 2003/09/10 06:38:28 mycroft Exp $ */
/*
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -131,7 +131,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.102 2003/09/10 05:42:18 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.103 2003/09/10 06:38:28 mycroft Exp $");
#include "atapibus.h"
#include "scsibus.h"
@@ -1059,12 +1059,14 @@
/* FALLTHROUGH if no data phase, err == 0 */
case TSTATE_BBB_DATA:
- /* Command transport phase, error handling (ignored if no data
+ /* Command transport phase error handling (ignored if no data
* phase (fallthrough from previous state)) */
if (sc->transfer_dir != DIR_NONE) {
/* retrieve the length of the transfer that was done */
usbd_get_xfer_status(xfer, NULL, NULL,
- &sc->transfer_actlen, NULL);
+ &sc->transfer_actlen, NULL);
+ DPRINTF(UDMASS_BBB, ("%s: BBB_DATA actlen=%d\n",
+ USBDEVNAME(sc->sc_dev), sc->transfer_actlen));
if (err) {
DPRINTF(UDMASS_BBB, ("%s: Data-%s %d failed, "
@@ -1078,14 +1080,13 @@
(sc->transfer_dir == DIR_IN?
UMASS_BULKIN:UMASS_BULKOUT),
sc->transfer_xfer[XFER_BBB_DCLEAR]);
- return;
} else {
/* Unless the error is a pipe stall the
* error is fatal.
*/
umass_bbb_reset(sc,STATUS_WIRE_FAILED);
- return;
}
+ return;
}
}
@@ -1108,11 +1109,10 @@
* err == 0 and the following if block is passed.
*/
if (err) { /* should not occur */
- /* try the transfer below, even if clear stall failed */
- DPRINTF(UDMASS_BBB, ("%s: bulk-%s stall clear failed"
- ", %s\n", USBDEVNAME(sc->sc_dev),
- (sc->transfer_dir == DIR_IN? "in":"out"),
- usbd_errstr(err)));
+ printf("%s: BBB bulk-%s stall clear failed, %s\n",
+ USBDEVNAME(sc->sc_dev),
+ (sc->transfer_dir == DIR_IN? "in":"out"),
+ usbd_errstr(err));
umass_bbb_reset(sc, STATUS_WIRE_FAILED);
return;
}
@@ -1475,10 +1475,10 @@
DPRINTF(UDMASS_CBI, ("%s: failed to send ADSC\n",
USBDEVNAME(sc->sc_dev)));
umass_cbi_reset(sc, STATUS_WIRE_FAILED);
-
return;
}
+ /* Data transport phase, setup transfer */
sc->transfer_state = TSTATE_CBI_DATA;
if (sc->transfer_dir == DIR_IN) {
if (umass_setup_transfer(sc, sc->sc_pipe[UMASS_BULKIN],
@@ -1487,6 +1487,7 @@
sc->transfer_xfer[XFER_CBI_DATA]))
umass_cbi_reset(sc, STATUS_WIRE_FAILED);
+ return;
} else if (sc->transfer_dir == DIR_OUT) {
memcpy(sc->data_buffer, sc->transfer_data,
sc->transfer_datalen);
@@ -1496,33 +1497,43 @@
sc->transfer_xfer[XFER_CBI_DATA]))
umass_cbi_reset(sc, STATUS_WIRE_FAILED);
+ return;
} else {
DPRINTF(UDMASS_CBI, ("%s: no data phase\n",
USBDEVNAME(sc->sc_dev)));
- goto dostatus;
}
- return;
+ /* FALLTHROUGH if no data phase, err == 0 */
case TSTATE_CBI_DATA:
- /* retrieve the length of the transfer that was done */
- usbd_get_xfer_status(xfer,NULL,NULL,&sc->transfer_actlen,NULL);
- DPRINTF(UDMASS_CBI, ("%s: CBI_DATA actlen=%d\n",
- USBDEVNAME(sc->sc_dev), sc->transfer_actlen));
+ /* Command transport phase error handling (ignored if no data
+ * phase (fallthrough from previous state)) */
+ if (sc->transfer_dir != DIR_NONE) {
+ /* retrieve the length of the transfer that was done */
+ usbd_get_xfer_status(xfer, NULL, NULL,
+ &sc->transfer_actlen, NULL);
+ DPRINTF(UDMASS_CBI, ("%s: CBI_DATA actlen=%d\n",
+ USBDEVNAME(sc->sc_dev), sc->transfer_actlen));
- if (err) {
- DPRINTF(UDMASS_CBI, ("%s: Data-%s %d failed, "
- "%s\n", USBDEVNAME(sc->sc_dev),
- (sc->transfer_dir == DIR_IN?"in":"out"),
- sc->transfer_datalen,usbd_errstr(err)));
+ if (err) {
+ DPRINTF(UDMASS_CBI, ("%s: Data-%s %d failed, "
+ "%s\n", USBDEVNAME(sc->sc_dev),
+ (sc->transfer_dir == DIR_IN?"in":"out"),
+ sc->transfer_datalen,usbd_errstr(err)));
- if (err == USBD_STALLED) {
- sc->transfer_state = TSTATE_CBI_DCLEAR;
- umass_clear_endpoint_stall(sc, UMASS_BULKIN,
+ if (err == USBD_STALLED) {
+ sc->transfer_state = TSTATE_CBI_DCLEAR;
+ umass_clear_endpoint_stall(sc,
+ (sc->transfer_dir == DIR_IN?
+ UMASS_BULKIN:UMASS_BULKOUT),
sc->transfer_xfer[XFER_CBI_DCLEAR]);
- } else {
- umass_cbi_reset(sc, STATUS_WIRE_FAILED);
+ } else {
+ /* Unless the error is a pipe stall the
+ * error is fatal.
+ */
+ umass_cbi_reset(sc, STATUS_WIRE_FAILED);
+ }
+ return;
}
- return;
}
if (sc->transfer_dir == DIR_IN)
@@ -1533,7 +1544,7 @@
umass_dump_buffer(sc, sc->transfer_data,
sc->transfer_actlen, 48));
- dostatus:
+ /* Status phase */
if (sc->sc_wire == UMASS_WPROTO_CBI_I) {
sc->transfer_state = TSTATE_CBI_STATUS;
memset(&sc->sbl, 0, sizeof(sc->sbl));
@@ -1635,16 +1646,12 @@
return;
case TSTATE_CBI_DCLEAR:
- if (err) { /* should not occur */
- printf("%s: CBI bulk-in/out stall clear failed, %s\n",
- USBDEVNAME(sc->sc_dev), usbd_errstr(err));
- umass_cbi_reset(sc, STATUS_WIRE_FAILED);
- }
-
- sc->transfer_state = TSTATE_IDLE;
- sc->transfer_cb(sc, sc->transfer_priv,
- sc->transfer_datalen,
- STATUS_CMD_FAILED);
+ if (err) /* should not occur */
+ printf("%s: CBI bulk-%s stall clear failed, %s\n",
+ USBDEVNAME(sc->sc_dev),
+ (sc->transfer_dir == DIR_IN? "in":"out"),
+ usbd_errstr(err));
+ umass_cbi_reset(sc, STATUS_WIRE_FAILED);
return;
case TSTATE_CBI_SCLEAR:
Home |
Main Index |
Thread Index |
Old Index