From owner-svn-src-all@FreeBSD.ORG Sun Aug 5 08:56:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64595106566B; Sun, 5 Aug 2012 08:56:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD868FC12; Sun, 5 Aug 2012 08:56:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q758uUO0059945; Sun, 5 Aug 2012 08:56:30 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q758uUiT059943; Sun, 5 Aug 2012 08:56:30 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201208050856.q758uUiT059943@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 5 Aug 2012 08:56:30 +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: r239050 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 08:56:30 -0000 Author: hselasky Date: Sun Aug 5 08:56:29 2012 New Revision: 239050 URL: http://svn.freebsd.org/changeset/base/239050 Log: Minor style nit: Use the interface number from the USB interface descriptor like in the other USB serial drivers. These numbers are not supposed to be different, though in theory they can. Make sure that the driver then uses the interface number given by the USB descriptor, and not the logical index of the USB stack. For the future: Whenever the term "index" is used in the USB code, it refers to a number computed by the USB stack. Whenever the term "number" is used in the USB code, it refers to a number in a USB descriptor. MFC after: 2 weeks Modified: head/sys/dev/usb/serial/uslcom.c Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Sun Aug 5 08:19:52 2012 (r239049) +++ head/sys/dev/usb/serial/uslcom.c Sun Aug 5 08:56:29 2012 (r239050) @@ -135,7 +135,7 @@ struct uslcom_softc { uint8_t sc_msr; uint8_t sc_lsr; - uint8_t sc_IfIdx; + uint8_t sc_iface_no; }; static device_probe_t uslcom_probe; @@ -382,7 +382,8 @@ uslcom_attach(device_t dev) usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); sc->sc_udev = uaa->device; - sc->sc_IfIdx = uaa->info.bIfaceIndex; + /* use the interface number from the USB interface descriptor */ + sc->sc_iface_no = uaa->info.bIfaceNum; error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, @@ -437,7 +438,7 @@ uslcom_open(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_ENABLE); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -461,7 +462,7 @@ uslcom_close(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_DISABLE); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -485,7 +486,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -509,7 +510,7 @@ uslcom_set_rts(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -540,7 +541,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_BAUD_RATE; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(baudrate)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -577,7 +578,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_DATA; USETW(req.wValue, data); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -599,7 +600,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_FLOWCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(flowctrl)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -629,7 +630,7 @@ uslcom_set_break(struct ucom_softc *ucom req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_BREAK; USETW(req.wValue, brk); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -783,7 +784,7 @@ uslcom_control_callback(struct usb_xfer req.bmRequestType = USLCOM_READ; req.bRequest = USLCOM_RCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, sc->sc_IfIdx); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(buf)); usbd_xfer_set_frames(xfer, 2);