Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2006 16:53:10 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 106069 for review
Message-ID:  <200609131653.k8DGrAXg027362@repoman.freebsd.org>

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

Change 106069 by hselasky@hselasky_mini_itx on 2006/09/13 16:52:14

	Factorize the clear stall code. Add missing "_callout" 
	to two function names.

Affected files ...

.. //depot/projects/usb/src/sys/dev/ata/ata-usb.c#6 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/ata/ata-usb.c#6 (text) ====

@@ -148,25 +148,23 @@
 atausb_t_bbb_reset3_callback(struct usbd_xfer *xfer);
 
 static void
-atausb_t_bbb_data_read_clear_stall_callback(struct usbd_xfer *xfer,
-					    u_int8_t next_xfer);
+atausb_t_bbb_data_clear_stall_callback(struct usbd_xfer *xfer,
+				       u_int8_t next_xfer,
+				       u_int8_t stall_xfer);
 static void
-atausb_t_bbb_data_write_clear_stall_callback(struct usbd_xfer *xfer, 
-					     u_int8_t next_xfer);
-static void
 atausb_t_bbb_command_callback(struct usbd_xfer *xfer);
 
 static void
 atausb_t_bbb_data_read_callback(struct usbd_xfer *xfer);
 
 static void
-atausb_t_bbb_data_rd_cs(struct usbd_xfer *xfer);
+atausb_t_bbb_data_rd_cs_callback(struct usbd_xfer *xfer);
 
 static void
 atausb_t_bbb_data_write_callback(struct usbd_xfer *xfer);
 
 static void
-atausb_t_bbb_data_wr_cs(struct usbd_xfer *xfer);
+atausb_t_bbb_data_wr_cs_callback(struct usbd_xfer *xfer);
 
 static void
 atausb_t_bbb_status_callback(struct usbd_xfer *xfer);
@@ -249,7 +247,7 @@
       .direction = -1,
       .bufsize   = sizeof(usb_device_request_t),
       .flags     = USBD_USE_DMA,
-      .callback  = &atausb_t_bbb_data_rd_cs,
+      .callback  = &atausb_t_bbb_data_rd_cs_callback,
       .timeout   = 5000, /* 5 seconds */
     },
 
@@ -269,7 +267,7 @@
       .direction = -1,
       .bufsize   = sizeof(usb_device_request_t),
       .flags     = USBD_USE_DMA,
-      .callback  = &atausb_t_bbb_data_wr_cs,
+      .callback  = &atausb_t_bbb_data_wr_cs_callback,
       .timeout   = 5000, /* 5 seconds */
     },
 
@@ -573,20 +571,23 @@
 static void
 atausb_t_bbb_reset2_callback(struct usbd_xfer *xfer)
 {
-    atausb_t_bbb_data_read_clear_stall_callback(xfer, ATAUSB_T_BBB_RESET3);
+    atausb_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_RESET3,
+					   ATAUSB_T_BBB_DATA_READ);
     return;
 }
 
 static void
 atausb_t_bbb_reset3_callback(struct usbd_xfer *xfer)
 {
-    atausb_t_bbb_data_write_clear_stall_callback(xfer, ATAUSB_T_BBB_COMMAND);
+    atausb_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_COMMAND,
+					   ATAUSB_T_BBB_DATA_WRITE);
     return;
 }
 
 static void
-atausb_t_bbb_data_read_clear_stall_callback(struct usbd_xfer *xfer, 
-					    u_int8_t next_xfer)
+atausb_t_bbb_data_clear_stall_callback(struct usbd_xfer *xfer, 
+				       u_int8_t next_xfer,
+				       u_int8_t stall_xfer)
 {
     struct atausb_softc *sc = xfer->priv_sc;
 
@@ -601,34 +602,12 @@
     return;
 
  tr_setup:
-    usbd_clear_stall_tr_setup(xfer, sc->xfer[ATAUSB_T_BBB_DATA_READ]);
-    usbd_clear_stall_tr_transferred(xfer, sc->xfer[ATAUSB_T_BBB_DATA_READ]);
+    usbd_clear_stall_tr_setup(xfer, sc->xfer[stall_xfer]);
+    usbd_clear_stall_tr_transferred(xfer, sc->xfer[stall_xfer]);
     return;
 }
 
 static void
-atausb_t_bbb_data_write_clear_stall_callback(struct usbd_xfer *xfer,
-					     u_int8_t next_xfer)
-{
-    struct atausb_softc *sc = xfer->priv_sc;
-
-    USBD_CHECK_STATUS(xfer);
-
- tr_error:
-    atausb_tr_error(xfer);
-    return;
-
- tr_transferred:
-    atausb_transfer_start(sc, next_xfer);
-    return;
-
- tr_setup:
-    usbd_clear_stall_tr_setup(xfer, sc->xfer[ATAUSB_T_BBB_DATA_WRITE]);
-    usbd_clear_stall_tr_transferred(xfer, sc->xfer[ATAUSB_T_BBB_DATA_WRITE]);
-    return;
-}
-
-static void
 atausb_t_bbb_command_callback(struct usbd_xfer *xfer)
 {
     struct atausb_softc *sc = xfer->priv_sc;
@@ -731,9 +710,10 @@
 }
 
 static void
-atausb_t_bbb_data_rd_cs(struct usbd_xfer *xfer)
+atausb_t_bbb_data_rd_cs_callback(struct usbd_xfer *xfer)
 {
-    atausb_t_bbb_data_read_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS);
+    atausb_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS,
+					   ATAUSB_T_BBB_DATA_READ);
     return;
 }
 
@@ -786,10 +766,11 @@
 }
 
 static void
-atausb_t_bbb_data_wr_cs(struct usbd_xfer *xfer)
+atausb_t_bbb_data_wr_cs_callback(struct usbd_xfer *xfer)
 {
-	atausb_t_bbb_data_write_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS);
-	return;
+    atausb_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS,
+					   ATAUSB_T_BBB_DATA_WRITE);
+    return;
 }
 
 static void



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