Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/usb Fix usbd_status vs int in *_alloc_*_chain



details:   https://anonhg.NetBSD.org/src/rev/884a1a39bc83
branches:  nick-nhusb
changeset: 334500:884a1a39bc83
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Apr 16 16:02:42 2016 +0000

description:
Fix usbd_status vs int in *_alloc_*_chain

diffstat:

 sys/dev/usb/ehci.c |  12 ++++++------
 sys/dev/usb/ohci.c |  12 ++++++------
 sys/dev/usb/uhci.c |  16 ++++++++--------
 3 files changed, 20 insertions(+), 20 deletions(-)

diffs (175 lines):

diff -r eabba96905a5 -r 884a1a39bc83 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat Apr 16 15:39:36 2016 +0000
+++ b/sys/dev/usb/ehci.c        Sat Apr 16 16:02:42 2016 +0000
@@ -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 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 @@
        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 @@
        *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
diff -r eabba96905a5 -r 884a1a39bc83 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sat Apr 16 15:39:36 2016 +0000
+++ b/sys/dev/usb/ohci.c        Sat Apr 16 16:02:42 2016 +0000
@@ -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_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 @@
        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 @@
                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
diff -r eabba96905a5 -r 884a1a39bc83 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Sat Apr 16 15:39:36 2016 +0000
+++ b/sys/dev/usb/uhci.c        Sat Apr 16 16:02:42 2016 +0000
@@ -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_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 @@
 }
 #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 @@
        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 @@
        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_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



Home | Main Index | Thread Index | Old Index