Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Revert changes for PR kern/44907



details:   https://anonhg.NetBSD.org/src/rev/6694a6e4b31f
branches:  trunk
changeset: 765497:6694a6e4b31f
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat May 28 15:47:17 2011 +0000

description:
Revert changes for PR kern/44907
http://mail-index.NetBSD.org/source-changes/2011/05/27/msg022584.html
for now.  It might cause a panic in ehci_freex() on device detach
as reported by Paul Goyette on current-users@.

diffstat:

 sys/dev/usb/ehci.c    |  18 +++++++-----------
 sys/dev/usb/ohci.c    |  14 +++++---------
 sys/dev/usb/ohcivar.h |   3 +--
 sys/dev/usb/uhci.c    |  20 ++++++++------------
 4 files changed, 21 insertions(+), 34 deletions(-)

diffs (230 lines):

diff -r 16b96c9d9db3 -r 6694a6e4b31f sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat May 28 15:37:11 2011 +0000
+++ b/sys/dev/usb/ehci.c        Sat May 28 15:47:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.176 2011/05/27 19:04:24 tsutsui Exp $ */
+/*     $NetBSD: ehci.c,v 1.177 2011/05/28 15:47:17 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.176 2011/05/27 19:04:24 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.177 2011/05/28 15:47:17 tsutsui Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1284,7 +1284,6 @@
 {
        struct ehci_softc *sc = bus->hci_private;
        usbd_xfer_handle xfer;
-       struct ehci_xfer *exfer;
 
        xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
        if (xfer != NULL) {
@@ -1296,14 +1295,12 @@
                }
 #endif
        } else {
-               xfer = malloc(sizeof(*exfer), M_USB, M_NOWAIT);
+               xfer = malloc(sizeof(struct ehci_xfer), M_USB, M_NOWAIT);
        }
        if (xfer != NULL) {
-               exfer = EXFER(xfer);
-               memset(exfer, 0, sizeof(*exfer));
-               usb_init_task(&exfer->abort_task, ehci_timeout_task, exfer);
+               memset(xfer, 0, sizeof(struct ehci_xfer));
 #ifdef DIAGNOSTIC
-               exfer->isdone = 1;
+               EXFER(xfer)->isdone = 1;
                xfer->busy_free = XFER_BUSY;
 #endif
        }
@@ -1314,7 +1311,6 @@
 ehci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
 {
        struct ehci_softc *sc = bus->hci_private;
-       struct ehci_xfer *exfer = EXFER(xfer);
 
 #ifdef DIAGNOSTIC
        if (xfer->busy_free != XFER_BUSY) {
@@ -1322,11 +1318,10 @@
                       xfer->busy_free);
        }
        xfer->busy_free = XFER_FREE;
-       if (!exfer->isdone) {
+       if (!EXFER(xfer)->isdone) {
                printf("ehci_freex: !isdone\n");
        }
 #endif
-       usb_rem_task(xfer->pipe->device, &exfer->abort_task);
        SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
 }
 
@@ -3155,6 +3150,7 @@
        }
 
        /* Execute the abort in a process context. */
+       usb_init_task(&exfer->abort_task, ehci_timeout_task, addr);
        usb_add_task(exfer->xfer.pipe->device, &exfer->abort_task,
            USB_TASKQ_HC);
 }
diff -r 16b96c9d9db3 -r 6694a6e4b31f sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sat May 28 15:37:11 2011 +0000
+++ b/sys/dev/usb/ohci.c        Sat May 28 15:47:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.214 2011/05/27 20:37:13 jakllsch Exp $      */
+/*     $NetBSD: ohci.c,v 1.215 2011/05/28 15:47:17 tsutsui Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.214 2011/05/27 20:37:13 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.215 2011/05/28 15:47:17 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -945,7 +945,6 @@
 {
        struct ohci_softc *sc = bus->hci_private;
        usbd_xfer_handle xfer;
-       struct ohci_xfer *oxfer;
 
        xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
        if (xfer != NULL) {
@@ -957,12 +956,10 @@
                }
 #endif
        } else {
-               xfer = malloc(sizeof(*oxfer), M_USB, M_NOWAIT);
+               xfer = malloc(sizeof(struct ohci_xfer), M_USB, M_NOWAIT);
        }
        if (xfer != NULL) {
-               oxfer = OXFER(xfer);
-               memset(oxfer, 0, sizeof(*oxfer));
-               usb_init_task(&oxfer->abort_task, ohci_timeout_task, oxfer);
+               memset(xfer, 0, sizeof (struct ohci_xfer));
 #ifdef DIAGNOSTIC
                xfer->busy_free = XFER_BUSY;
 #endif
@@ -974,7 +971,6 @@
 ohci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
 {
        struct ohci_softc *sc = bus->hci_private;
-       struct ohci_xfer *oxfer = OXFER(xfer);
 
 #ifdef DIAGNOSTIC
        if (xfer->busy_free != XFER_BUSY) {
@@ -983,7 +979,6 @@
        }
        xfer->busy_free = XFER_FREE;
 #endif
-       usb_rem_task(xfer->pipe->device, &oxfer->abort_task);
        SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
 }
 
@@ -1953,6 +1948,7 @@
        }
 
        /* Execute the abort in a process context. */
+       usb_init_task(&oxfer->abort_task, ohci_timeout_task, addr);
        usb_add_task(oxfer->xfer.pipe->device, &oxfer->abort_task,
            USB_TASKQ_HC);
 }
diff -r 16b96c9d9db3 -r 6694a6e4b31f sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h     Sat May 28 15:37:11 2011 +0000
+++ b/sys/dev/usb/ohcivar.h     Sat May 28 15:47:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcivar.h,v 1.50 2011/05/27 19:04:24 tsutsui Exp $     */
+/*     $NetBSD: ohcivar.h,v 1.51 2011/05/28 15:47:17 tsutsui Exp $     */
 /*     $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $    */
 
 /*
@@ -140,7 +140,6 @@
        struct usbd_xfer xfer;
        struct usb_task abort_task;
 };
-#define OXFER(xfer) ((struct ohci_xfer *)(xfer))
 
 usbd_status    ohci_init(ohci_softc_t *);
 int            ohci_intr(void *);
diff -r 16b96c9d9db3 -r 6694a6e4b31f sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Sat May 28 15:37:11 2011 +0000
+++ b/sys/dev/usb/uhci.c        Sat May 28 15:47:17 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.237 2011/05/27 19:04:24 tsutsui Exp $       */
+/*     $NetBSD: uhci.c,v 1.238 2011/05/28 15:47:17 tsutsui Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.237 2011/05/27 19:04:24 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.238 2011/05/28 15:47:17 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -640,7 +640,6 @@
 {
        struct uhci_softc *sc = bus->hci_private;
        usbd_xfer_handle xfer;
-       struct uhci_xfer *uxfer;
 
        xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
        if (xfer != NULL) {
@@ -652,15 +651,13 @@
                }
 #endif
        } else {
-               xfer = malloc(sizeof(*uxfer), M_USB, M_NOWAIT);
+               xfer = malloc(sizeof(struct uhci_xfer), M_USB, M_NOWAIT);
        }
        if (xfer != NULL) {
-               uxfer = UXFER(xfer);
-               memset(uxfer, 0, sizeof(*uxfer));
-               uxfer->iinfo.sc = sc;
-               usb_init_task(&uxfer->abort_task, uhci_timeout_task, uxfer);
+               memset(xfer, 0, sizeof (struct uhci_xfer));
+               UXFER(xfer)->iinfo.sc = sc;
 #ifdef DIAGNOSTIC
-               uxfer->iinfo.isdone = 1;
+               UXFER(xfer)->iinfo.isdone = 1;
                xfer->busy_free = XFER_BUSY;
 #endif
        }
@@ -671,7 +668,6 @@
 uhci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
 {
        struct uhci_softc *sc = bus->hci_private;
-       struct uhci_xfer *uxfer = UXFER(xfer);
 
 #ifdef DIAGNOSTIC
        if (xfer->busy_free != XFER_BUSY) {
@@ -679,11 +675,10 @@
                       xfer->busy_free);
        }
        xfer->busy_free = XFER_FREE;
-       if (!uxfer->iinfo.isdone) {
+       if (!UXFER(xfer)->iinfo.isdone) {
                printf("uhci_freex: !isdone\n");
        }
 #endif
-       usb_rem_task(xfer->pipe->device, &uxfer->abort_task);
        SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
 }
 
@@ -1624,6 +1619,7 @@
        }
 
        /* Execute the abort in a process context. */
+       usb_init_task(&uxfer->abort_task, uhci_timeout_task, ii->xfer);
        usb_add_task(uxfer->xfer.pipe->device, &uxfer->abort_task,
            USB_TASKQ_HC);
 }



Home | Main Index | Thread Index | Old Index