Module Name: src Committed By: skrll Date: Sat Apr 16 16:02:42 UTC 2016
Modified Files: src/sys/dev/usb [nick-nhusb]: ehci.c ohci.c uhci.c Log Message: Fix usbd_status vs int in *_alloc_*_chain To generate a diff of this commit: cvs rdiff -u -r1.234.2.99 -r1.234.2.100 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.254.2.71 -r1.254.2.72 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.264.4.73 -r1.264.4.74 src/sys/dev/usb/uhci.c 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/usb/ehci.c diff -u src/sys/dev/usb/ehci.c:1.234.2.99 src/sys/dev/usb/ehci.c:1.234.2.100 --- src/sys/dev/usb/ehci.c:1.234.2.99 Sat Apr 16 15:39:36 2016 +++ src/sys/dev/usb/ehci.c Sat Apr 16 16:02:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.234.2.99 2016/04/16 15:39:36 skrll Exp $ */ +/* $NetBSD: ehci.c,v 1.234.2.100 2016/04/16 16:02:42 skrll Exp $ */ /* * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.99 2016/04/16 15:39:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.100 2016/04/16 16:02:42 skrll Exp $"); #include "ohci.h" #include "uhci.h" @@ -235,7 +235,7 @@ Static void ehci_free_sqh(ehci_softc_t Static ehci_soft_qtd_t *ehci_alloc_sqtd(ehci_softc_t *); Static void ehci_free_sqtd(ehci_softc_t *, ehci_soft_qtd_t *); -Static usbd_status ehci_alloc_sqtd_chain(ehci_softc_t *, +Static int ehci_alloc_sqtd_chain(ehci_softc_t *, struct usbd_xfer *, int, int, ehci_soft_qtd_t **); Static void ehci_free_sqtds(ehci_softc_t *, struct ehci_xfer *); @@ -2822,7 +2822,7 @@ ehci_free_sqtd(ehci_softc_t *sc, ehci_so mutex_exit(&sc->sc_lock); } -Static usbd_status +Static int ehci_alloc_sqtd_chain(ehci_softc_t *sc, struct usbd_xfer *xfer, int alen, int rd, ehci_soft_qtd_t **sp) { @@ -2857,13 +2857,13 @@ ehci_alloc_sqtd_chain(ehci_softc_t *sc, *sp = exfer->ex_sqtds[0]; DPRINTF("return sqtd=%p", *sp, 0, 0, 0); - return USBD_NORMAL_COMPLETION; + return 0; nomem: ehci_free_sqtds(sc, exfer); kmem_free(exfer->ex_sqtds, sizeof(ehci_soft_qtd_t *) * nsqtd); DPRINTF("no memory", 0, 0, 0, 0); - return USBD_NOMEM; + return ENOMEM; } Static void Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.254.2.71 src/sys/dev/usb/ohci.c:1.254.2.72 --- src/sys/dev/usb/ohci.c:1.254.2.71 Sat Apr 16 15:39:36 2016 +++ src/sys/dev/usb/ohci.c Sat Apr 16 16:02:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.254.2.71 2016/04/16 15:39:36 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.254.2.72 2016/04/16 16:02:42 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.71 2016/04/16 15:39:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.72 2016/04/16 16:02:42 skrll Exp $"); #include "opt_usb.h" @@ -136,7 +136,7 @@ Static void ohci_free_sitd(ohci_softc_t Static void ohci_free_sitd_locked(ohci_softc_t *, ohci_soft_itd_t *); -Static usbd_status ohci_alloc_std_chain(ohci_softc_t *, struct usbd_xfer *, +Static int ohci_alloc_std_chain(ohci_softc_t *, struct usbd_xfer *, int, int); Static void ohci_free_stds(ohci_softc_t *, struct ohci_xfer *); @@ -516,7 +516,7 @@ ohci_free_std(ohci_softc_t *sc, ohci_sof mutex_exit(&sc->sc_lock); } -Static usbd_status +Static int ohci_alloc_std_chain(ohci_softc_t *sc, struct usbd_xfer *xfer, int length, int rd) { struct ohci_xfer *ox = OHCI_XFER2OXFER(xfer); @@ -550,13 +550,13 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s cur->flags = 0; } - return USBD_NORMAL_COMPLETION; + return 0; nomem: ohci_free_stds(sc, ox); kmem_free(ox->ox_stds, sizeof(ohci_soft_td_t *) * nstd); - return USBD_NOMEM; + return ENOMEM; } Static void Index: src/sys/dev/usb/uhci.c diff -u src/sys/dev/usb/uhci.c:1.264.4.73 src/sys/dev/usb/uhci.c:1.264.4.74 --- src/sys/dev/usb/uhci.c:1.264.4.73 Sat Apr 16 15:39:36 2016 +++ src/sys/dev/usb/uhci.c Sat Apr 16 16:02:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.264.4.73 2016/04/16 15:39:36 skrll Exp $ */ +/* $NetBSD: uhci.c,v 1.264.4.74 2016/04/16 16:02:42 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.73 2016/04/16 15:39:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.74 2016/04/16 16:02:42 skrll Exp $"); #include "opt_usb.h" @@ -180,7 +180,7 @@ Static void uhci_exit_ctl_q(uhci_softc_ Static void uhci_free_std_chain(uhci_softc_t *, uhci_soft_td_t *, uhci_soft_td_t *); #endif -Static usbd_status uhci_alloc_std_chain(uhci_softc_t *, struct usbd_xfer *, +Static int uhci_alloc_std_chain(uhci_softc_t *, struct usbd_xfer *, int, int, uhci_soft_td_t **); Static void uhci_free_stds(uhci_softc_t *, struct uhci_xfer *); @@ -2013,7 +2013,7 @@ uhci_free_std_chain(uhci_softc_t *sc, uh } #endif -usbd_status +int uhci_alloc_std_chain(uhci_softc_t *sc, struct usbd_xfer *xfer, int len, int rd, uhci_soft_td_t **sp) { @@ -2031,7 +2031,7 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s int maxp = UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize); if (maxp == 0) { printf("%s: maxp=0\n", __func__); - return USBD_INVAL; + return EINVAL; } size_t ntd = (len + maxp - 1) / maxp; if (!rd && (flags & USBD_FORCE_SHORT_XFER)) { @@ -2045,7 +2045,7 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s if (ntd == 0) { *sp = NULL; DPRINTF("ntd=0", 0, 0, 0, 0); - return USBD_NORMAL_COMPLETION; + return 0; } uxfer->ux_stds = kmem_alloc(sizeof(uhci_soft_td_t *) * ntd, KM_SLEEP); @@ -2057,14 +2057,14 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s uhci_free_stds(sc, uxfer); kmem_free(uxfer->ux_stds, sizeof(uhci_soft_td_t *) * ntd); - return USBD_NOMEM; + return ENOMEM; } uxfer->ux_stds[i] = p; } *sp = uxfer->ux_stds[0]; - return USBD_NORMAL_COMPLETION; + return 0; } Static void