Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Don't abuse usbd_status in xhci_init



details:   https://anonhg.NetBSD.org/src/rev/6babc8e078a8
branches:  trunk
changeset: 327542:6babc8e078a8
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Mar 10 13:10:41 2014 +0000

description:
Don't abuse usbd_status in xhci_init

diffstat:

 sys/dev/pci/xhci_pci.c |  12 ++++++------
 sys/dev/usb/xhci.c     |  22 +++++++++++-----------
 sys/dev/usb/xhcivar.h  |   4 ++--
 3 files changed, 19 insertions(+), 19 deletions(-)

diffs (153 lines):

diff -r 051d5def683d -r 6babc8e078a8 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c    Mon Mar 10 13:01:28 2014 +0000
+++ b/sys/dev/pci/xhci_pci.c    Mon Mar 10 13:10:41 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci_pci.c,v 1.1 2013/09/14 00:40:31 jakllsch Exp $    */
+/*     $NetBSD: xhci_pci.c,v 1.2 2014/03/10 13:10:41 skrll Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.1 2013/09/14 00:40:31 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.2 2014/03/10 13:10:41 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -82,7 +82,7 @@
        char const *intrstr;
        pci_intr_handle_t ih;
        pcireg_t csr, memtype;
-       usbd_status r;
+       int err;
        //const char *vendor;
        uint32_t hccparams;
 
@@ -164,9 +164,9 @@
                    "vendor 0x%04x", PCI_VENDOR(pa->pa_id));
 #endif
 
-       r = xhci_init(sc);
-       if (r != USBD_NORMAL_COMPLETION) {
-               aprint_error_dev(self, "init failed, error=%d\n", r);
+       err = xhci_init(sc);
+       if (err) {
+               aprint_error_dev(self, "init failed, error=%d\n", err);
                goto fail;
        }
 
diff -r 051d5def683d -r 6babc8e078a8 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Mon Mar 10 13:01:28 2014 +0000
+++ b/sys/dev/usb/xhci.c        Mon Mar 10 13:10:41 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.14 2014/03/10 13:01:28 skrll Exp $  */
+/*     $NetBSD: xhci.c,v 1.15 2014/03/10 13:10:41 skrll Exp $  */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.14 2014/03/10 13:01:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.15 2014/03/10 13:10:41 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -566,7 +566,7 @@
 }
 
 
-usbd_status
+int
 xhci_init(struct xhci_softc *sc)
 {
        bus_size_t bsz;
@@ -598,7 +598,7 @@
        if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, 0, caplength,
            &sc->sc_cbh) != 0) {
                aprint_error_dev(sc->sc_dev, "capability subregion failure\n");
-               return USBD_NOMEM;
+               return ENOMEM;
        }
 
        hcs1 = xhci_cap_read_4(sc, XHCI_HCSPARAMS1);
@@ -654,21 +654,21 @@
        if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, caplength, bsz,
            &sc->sc_obh) != 0) {
                aprint_error_dev(sc->sc_dev, "operational subregion failure\n");
-               return USBD_NOMEM;
+               return ENOMEM;
        }
 
        dboff = xhci_cap_read_4(sc, XHCI_DBOFF);
        if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, dboff,
            sc->sc_maxslots * 4, &sc->sc_dbh) != 0) {
                aprint_error_dev(sc->sc_dev, "doorbell subregion failure\n");
-               return USBD_NOMEM;
+               return ENOMEM;
        }
 
        rtsoff = xhci_cap_read_4(sc, XHCI_RTSOFF);
        if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, rtsoff,
            sc->sc_maxintrs * 0x20, &sc->sc_rbh) != 0) {
                aprint_error_dev(sc->sc_dev, "runtime subregion failure\n");
-               return USBD_NOMEM;
+               return ENOMEM;
        }
 
        for (i = 0; i < 100; i++) {
@@ -678,7 +678,7 @@
                usb_delay_ms(&sc->sc_bus, 1);
        }
        if (i >= 100)
-               return USBD_IOERROR;
+               return EIO;
 
        usbcmd = 0;
        xhci_op_write_4(sc, XHCI_USBCMD, usbcmd);
@@ -693,7 +693,7 @@
                usb_delay_ms(&sc->sc_bus, 1);
        }
        if (i >= 100)
-               return USBD_IOERROR;
+               return EIO;
 
        for (i = 0; i < 100; i++) {
                usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
@@ -702,13 +702,13 @@
                usb_delay_ms(&sc->sc_bus, 1);
        }
        if (i >= 100)
-               return USBD_IOERROR;
+               return EIO;
 
        pagesize = xhci_op_read_4(sc, XHCI_PAGESIZE);
        aprint_debug_dev(sc->sc_dev, "PAGESIZE 0x%08x\n", pagesize);
        pagesize = ffs(pagesize);
        if (pagesize == 0)
-               return USBD_IOERROR;
+               return EIO;
        sc->sc_pgsz = 1 << (12 + (pagesize - 1));
        aprint_debug_dev(sc->sc_dev, "sc_pgsz 0x%08x\n", (uint32_t)sc->sc_pgsz);
        aprint_debug_dev(sc->sc_dev, "sc_maxslots 0x%08x\n",
diff -r 051d5def683d -r 6babc8e078a8 sys/dev/usb/xhcivar.h
--- a/sys/dev/usb/xhcivar.h     Mon Mar 10 13:01:28 2014 +0000
+++ b/sys/dev/usb/xhcivar.h     Mon Mar 10 13:10:41 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhcivar.h,v 1.2 2013/10/28 17:49:33 matt Exp $ */
+/*     $NetBSD: xhcivar.h,v 1.3 2014/03/10 13:10:41 skrll Exp $        */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -116,7 +116,7 @@
        uint8_t sc_conf;
 };
 
-usbd_status     xhci_init(struct xhci_softc *);
+int             xhci_init(struct xhci_softc *);
 int             xhci_intr(void *);
 int             xhci_detach(struct xhci_softc *, int);
 int             xhci_activate(device_t, enum devact);



Home | Main Index | Thread Index | Old Index