From owner-svn-src-head@FreeBSD.ORG Thu Jan 15 16:04:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3BD310656CE; Thu, 15 Jan 2009 16:04:11 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B141A8FC12; Thu, 15 Jan 2009 16:04:11 +0000 (UTC) (envelope-from takawata@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 n0FG4BMA081031; Thu, 15 Jan 2009 16:04:11 GMT (envelope-from takawata@svn.freebsd.org) Received: (from takawata@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0FG4Bof081030; Thu, 15 Jan 2009 16:04:11 GMT (envelope-from takawata@svn.freebsd.org) Message-Id: <200901151604.n0FG4Bof081030@svn.freebsd.org> From: Takanori Watanabe Date: Thu, 15 Jan 2009 16:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187299 - head/sys/dev/usb2/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 16:04:12 -0000 Author: takawata Date: Thu Jan 15 16:04:11 2009 New Revision: 187299 URL: http://svn.freebsd.org/changeset/base/187299 Log: Name the items of xfer array. Modified: head/sys/dev/usb2/serial/ufoma2.c Modified: head/sys/dev/usb2/serial/ufoma2.c ============================================================================== --- head/sys/dev/usb2/serial/ufoma2.c Thu Jan 15 12:15:46 2009 (r187298) +++ head/sys/dev/usb2/serial/ufoma2.c Thu Jan 15 16:04:11 2009 (r187299) @@ -143,8 +143,21 @@ typedef struct ufoma_mobile_acm_descript #define UFOMA_BULK_BUF_SIZE 1024 /* bytes */ -#define UFOMA_CTRL_ENDPT_MAX 4 /* units */ -#define UFOMA_BULK_ENDPT_MAX 4 /* units */ +enum { + UFOMA_CTRL_ENDPT_INTR, + UFOMA_CTRL_ENDPT_INTR_CLEAR, + UFOMA_CTRL_ENDPT_READ, + UFOMA_CTRL_ENDPT_WRITE, + UFOMA_CTRL_ENDPT_MAX = 4, +}; + +enum { + UFOMA_BULK_ENDPT_WRITE, + UFOMA_BULK_ENDPT_READ, + UFOMA_BULK_ENDPT_WRITE_CLEAR, + UFOMA_BULK_ENDPT_READ_CLEAR, + UFOMA_BULK_ENDPT_MAX = 4, +}; struct ufoma_softc { struct usb2_com_super_softc sc_super_ucom; @@ -227,7 +240,7 @@ static int ufoma_sysctl_open(SYSCTL_HAND static const struct usb2_config ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = { - [0] = { + [UFOMA_CTRL_ENDPT_INTR] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -236,7 +249,7 @@ static const struct usb2_config .mh.callback = &ufoma_intr_callback, }, - [1] = { + [UFOMA_CTRL_ENDPT_INTR_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -247,7 +260,7 @@ static const struct usb2_config .mh.interval = 50, /* 50ms */ }, - [2] = { + [UFOMA_CTRL_ENDPT_READ] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -257,7 +270,7 @@ static const struct usb2_config .mh.timeout = 1000, /* 1 second */ }, - [3] = { + [UFOMA_CTRL_ENDPT_WRITE] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -271,7 +284,7 @@ static const struct usb2_config static const struct usb2_config ufoma_bulk_config[UFOMA_BULK_ENDPT_MAX] = { - [0] = { + [UFOMA_BULK_ENDPT_WRITE] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -280,7 +293,7 @@ static const struct usb2_config .mh.callback = &ufoma_bulk_write_callback, }, - [1] = { + [UFOMA_BULK_ENDPT_READ] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -289,7 +302,7 @@ static const struct usb2_config .mh.callback = &ufoma_bulk_read_callback, }, - [2] = { + [UFOMA_BULK_ENDPT_WRITE_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -300,7 +313,7 @@ static const struct usb2_config .mh.interval = 50, /* 50ms */ }, - [3] = { + [UFOMA_BULK_ENDPT_READ_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -701,7 +714,7 @@ static void ufoma_intr_clear_stall_callback(struct usb2_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[0]; + struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -758,7 +771,7 @@ ufoma_intr_callback(struct usb2_xfer *xf if (sc->sc_num_msg != 0xFF) { sc->sc_num_msg++; } - usb2_transfer_start(sc->sc_ctrl_xfer[2]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); break; case UCDC_N_SERIAL_STATE: @@ -803,7 +816,7 @@ ufoma_intr_callback(struct usb2_xfer *xf case USB_ST_SETUP: tr_setup: if (sc->sc_flags & UFOMA_FLAG_INTR_STALL) { - usb2_transfer_start(sc->sc_ctrl_xfer[1]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]); } else { xfer->frlengths[0] = xfer->max_data_length; usb2_start_hardware(xfer); @@ -814,7 +827,7 @@ tr_setup: if (xfer->error != USB_ERR_CANCELLED) { /* start clear stall */ sc->sc_flags |= UFOMA_FLAG_INTR_STALL; - usb2_transfer_start(sc->sc_ctrl_xfer[1]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]); } return; @@ -831,7 +844,7 @@ ufoma_bulk_write_callback(struct usb2_xf case USB_ST_SETUP: case USB_ST_TRANSFERRED: if (sc->sc_flags & UFOMA_FLAG_BULK_WRITE_STALL) { - usb2_transfer_start(sc->sc_bulk_xfer[2]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]); return; } if (usb2_com_get_data(&sc->sc_ucom, xfer->frbuffers, 0, @@ -844,7 +857,7 @@ ufoma_bulk_write_callback(struct usb2_xf default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { sc->sc_flags |= UFOMA_FLAG_BULK_WRITE_STALL; - usb2_transfer_start(sc->sc_bulk_xfer[2]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]); } return; @@ -855,7 +868,7 @@ static void ufoma_bulk_write_clear_stall_callback(struct usb2_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[0]; + struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -876,7 +889,7 @@ ufoma_bulk_read_callback(struct usb2_xfe case USB_ST_SETUP: if (sc->sc_flags & UFOMA_FLAG_BULK_READ_STALL) { - usb2_transfer_start(sc->sc_bulk_xfer[3]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]); } else { xfer->frlengths[0] = xfer->max_data_length; usb2_start_hardware(xfer); @@ -886,7 +899,7 @@ ufoma_bulk_read_callback(struct usb2_xfe default: /* Error */ if (xfer->error != USB_ERR_CANCELLED) { sc->sc_flags |= UFOMA_FLAG_BULK_READ_STALL; - usb2_transfer_start(sc->sc_bulk_xfer[3]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]); } return; @@ -897,7 +910,7 @@ static void ufoma_bulk_read_clear_stall_callback(struct usb2_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[1]; + struct usb2_xfer *xfer_other = sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -1159,13 +1172,13 @@ ufoma_start_read(struct usb2_com_softc * struct ufoma_softc *sc = ucom->sc_parent; /* start interrupt transfer */ - usb2_transfer_start(sc->sc_ctrl_xfer[0]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]); /* start data transfer */ if (sc->sc_is_pseudo) { - usb2_transfer_start(sc->sc_ctrl_xfer[2]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); } else { - usb2_transfer_start(sc->sc_bulk_xfer[1]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); } } @@ -1175,15 +1188,15 @@ ufoma_stop_read(struct usb2_com_softc *u struct ufoma_softc *sc = ucom->sc_parent; /* stop interrupt transfer */ - usb2_transfer_stop(sc->sc_ctrl_xfer[1]); - usb2_transfer_stop(sc->sc_ctrl_xfer[0]); + usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]); + usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]); /* stop data transfer */ if (sc->sc_is_pseudo) { - usb2_transfer_stop(sc->sc_ctrl_xfer[2]); + usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); } else { - usb2_transfer_stop(sc->sc_bulk_xfer[3]); - usb2_transfer_stop(sc->sc_bulk_xfer[1]); + usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]); + usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); } } @@ -1193,9 +1206,9 @@ ufoma_start_write(struct usb2_com_softc struct ufoma_softc *sc = ucom->sc_parent; if (sc->sc_is_pseudo) { - usb2_transfer_start(sc->sc_ctrl_xfer[3]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]); } else { - usb2_transfer_start(sc->sc_bulk_xfer[0]); + usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); } } @@ -1205,10 +1218,10 @@ ufoma_stop_write(struct usb2_com_softc * struct ufoma_softc *sc = ucom->sc_parent; if (sc->sc_is_pseudo) { - usb2_transfer_stop(sc->sc_ctrl_xfer[3]); + usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]); } else { - usb2_transfer_stop(sc->sc_bulk_xfer[2]); - usb2_transfer_stop(sc->sc_bulk_xfer[0]); + usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]); + usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); } }