Module Name:    src
Committed By:   skrll
Date:           Mon Mar 10 13:10:41 UTC 2014

Modified Files:
        src/sys/dev/pci: xhci_pci.c
        src/sys/dev/usb: xhci.c xhcivar.h

Log Message:
Don't abuse usbd_status in xhci_init


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/xhci_pci.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/xhcivar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.1 src/sys/dev/pci/xhci_pci.c:1.2
--- src/sys/dev/pci/xhci_pci.c:1.1	Sat Sep 14 00:40:31 2013
+++ src/sys/dev/pci/xhci_pci.c	Mon Mar 10 13:10:41 2014
@@ -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 @@ xhci_pci_attach(device_t parent, device_
 	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 @@ xhci_pci_attach(device_t parent, device_
 		    "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;
 	}
 

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.14 src/sys/dev/usb/xhci.c:1.15
--- src/sys/dev/usb/xhci.c:1.14	Mon Mar 10 13:01:28 2014
+++ src/sys/dev/usb/xhci.c	Mon Mar 10 13:10:41 2014
@@ -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 @@ hexdump(const char *msg, const void *bas
 }
 
 
-usbd_status
+int
 xhci_init(struct xhci_softc *sc)
 {
 	bus_size_t bsz;
@@ -598,7 +598,7 @@ xhci_init(struct xhci_softc *sc)
 	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 @@ xhci_init(struct xhci_softc *sc)
 	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 @@ xhci_init(struct xhci_softc *sc)
 		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 @@ xhci_init(struct xhci_softc *sc)
 		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 @@ xhci_init(struct xhci_softc *sc)
 		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",

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.2 src/sys/dev/usb/xhcivar.h:1.3
--- src/sys/dev/usb/xhcivar.h:1.2	Mon Oct 28 17:49:33 2013
+++ src/sys/dev/usb/xhcivar.h	Mon Mar 10 13:10:41 2014
@@ -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 @@ struct xhci_softc {
 	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);

Reply via email to