From owner-svn-src-user@FreeBSD.ORG Thu Oct 7 17:35:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88105106566B; Thu, 7 Oct 2010 17:35:10 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AA8E8FC0A; Thu, 7 Oct 2010 17:35:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o97HZAV6048030; Thu, 7 Oct 2010 17:35:10 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o97HZAw0048027; Thu, 7 Oct 2010 17:35:10 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <201010071735.o97HZAw0048027@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 7 Oct 2010 17:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213524 - user/weongyo/usb/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2010 17:35:10 -0000 Author: weongyo Date: Thu Oct 7 17:35:10 2010 New Revision: 213524 URL: http://svn.freebsd.org/changeset/base/213524 Log: Removes recurse_1 and recurse_2 variables of `struct usb_xfer_queue' that it's replaced as `status'. Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c user/weongyo/usb/sys/dev/usb/usbdi.h Modified: user/weongyo/usb/sys/dev/usb/usb_transfer.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:26:22 2010 (r213523) +++ user/weongyo/usb/sys/dev/usb/usb_transfer.c Thu Oct 7 17:35:10 2010 (r213524) @@ -1964,18 +1964,15 @@ usbd_callback_ss_done_defer(struct usb_x if (pq->curr != xfer) usbd_transfer_enqueue(pq, xfer); - if (!pq->recurse_1) { + if ((pq->status & USB_XFER_QUEUE_HOLD) == 0) { /* * We have to postpone the callback due to the fact we * will have a Lock Order Reversal, LOR, if we try to * proceed ! */ taskqueue_enqueue(info->done_tq, &info->done_task); - } else { - /* clear second recurse flag */ - pq->recurse_2 = 0; - } - return; + } else + pq->status |= USB_XFER_QUEUE_CONTINUE; } /*------------------------------------------------------------------------* @@ -2653,11 +2650,10 @@ usb_command_wrapper(struct usb_xfer_queu pq->curr = NULL; } - if (!pq->recurse_1) { + if ((pq->status & USB_XFER_QUEUE_HOLD) == 0) { do { - /* set both recurse flags */ - pq->recurse_1 = 1; - pq->recurse_2 = 1; + pq->status |= USB_XFER_QUEUE_HOLD; + pq->status &= ~USB_XFER_QUEUE_CONTINUE; if (pq->curr == NULL) { xfer = TAILQ_FIRST(&pq->head); @@ -2672,14 +2668,11 @@ usb_command_wrapper(struct usb_xfer_queu DPRINTFN(6, "cb %p (enter)\n", pq->curr); (pq->command) (pq); DPRINTFN(6, "cb %p (leave)\n", pq->curr); - } while (!pq->recurse_2); + } while ((pq->status & USB_XFER_QUEUE_CONTINUE) != 0); - /* clear first recurse flag */ - pq->recurse_1 = 0; - } else { - /* clear second recurse flag */ - pq->recurse_2 = 0; - } + pq->status &= ~USB_XFER_QUEUE_HOLD; + } else + pq->status |= USB_XFER_QUEUE_CONTINUE; } /*------------------------------------------------------------------------* Modified: user/weongyo/usb/sys/dev/usb/usbdi.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usbdi.h Thu Oct 7 17:26:22 2010 (r213523) +++ user/weongyo/usb/sys/dev/usb/usbdi.h Thu Oct 7 17:35:10 2010 (r213524) @@ -122,8 +122,16 @@ struct usb_xfer_queue { TAILQ_HEAD(, usb_xfer) head; struct usb_xfer *curr; /* current USB transfer processed */ void (*command) (struct usb_xfer_queue *pq); - uint8_t recurse_1:1; - uint8_t recurse_2:1; + int status; +/* + * During this status is set any `info->done_task' wouldn't queued and + * `command' callback at above wouldn't called. It's to avoid recursive calls. + * + * XXX need another approach to make easy to understand? + */ +#define USB_XFER_QUEUE_HOLD (1 << 0) +/* If set, processing the xfer queue would be continue. */ +#define USB_XFER_QUEUE_CONTINUE (1 << 1) }; /*