From owner-svn-src-all@FreeBSD.ORG Tue Jun 2 17:31:59 2009 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 9E92310656C4; Tue, 2 Jun 2009 17:31:59 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8028FC24; Tue, 2 Jun 2009 17:31:59 +0000 (UTC) (envelope-from thompsa@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 n52HVxjc022335; Tue, 2 Jun 2009 17:31:59 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n52HVx9K022334; Tue, 2 Jun 2009 17:31:59 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906021731.n52HVx9K022334@svn.freebsd.org> From: Andrew Thompson Date: Tue, 2 Jun 2009 17:31:59 +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: r193318 - head/sys/dev/usb 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: Tue, 02 Jun 2009 17:32:00 -0000 Author: thompsa Date: Tue Jun 2 17:31:59 2009 New Revision: 193318 URL: http://svn.freebsd.org/changeset/base/193318 Log: Reorgansise the logic for tranversing the pipe list. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Tue Jun 2 17:31:16 2009 (r193317) +++ head/sys/dev/usb/usb_request.c Tue Jun 2 17:31:59 2009 (r193318) @@ -109,11 +109,11 @@ usb2_do_clear_stall_callback(struct usb_ pipe_end = udev->pipes + udev->pipes_max; pipe_first = udev->pipes; to = udev->pipes_max; - if (pipe == NULL) { - pipe = pipe_first; - } + switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: + if (pipe == NULL) + goto tr_setup; /* device was unconfigured */ if (pipe->edesc && pipe->is_stalled) { pipe->toggle_next = 0; @@ -126,9 +126,10 @@ usb2_do_clear_stall_callback(struct usb_ case USB_ST_SETUP: tr_setup: - if (pipe == pipe_end) { - pipe = pipe_first; - } + if (to == 0) + break; /* no pipes - nothing to do */ + if ((pipe < pipe_first) || (pipe >= pipe_end)) + pipe = pipe_first; /* pipe wrapped around */ if (pipe->edesc && pipe->is_stalled) { @@ -156,9 +157,8 @@ tr_setup: break; } pipe++; - if (--to) - goto tr_setup; - break; + to--; + goto tr_setup; default: if (xfer->error == USB_ERR_CANCELLED) {