diff options
author | Jeremy Evans <jeremy@cvs.openbsd.org> | 2013-11-02 01:41:18 +0000 |
---|---|---|
committer | Jeremy Evans <jeremy@cvs.openbsd.org> | 2013-11-02 01:41:18 +0000 |
commit | e90f2af2c15b6b2e7319031f08363bb1f78d6a14 (patch) | |
tree | 4b417cc43344d2826999e3aa55288519899e92fe | |
parent | 0ae079a34a6695d3f07bfa5d21804bc041e38410 (diff) |
Begin conversion of USB stack to return int instead of usbd_status,
starting with usbd_endpoint_count and usbd_interface_count. usbd_status
should only be used to indicate the status of a USB transfer, it should
not be used for generic error codes.
Idea from and much hand-holding by mpi@
OK mpi@
-rw-r--r-- | sys/dev/usb/uftdi.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.c | 14 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.h | 6 |
4 files changed, 19 insertions, 19 deletions
diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index 5e52060f803..bb3e29fca34 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uftdi.c,v 1.64 2013/04/15 09:23:02 mglocker Exp $ */ +/* $OpenBSD: uftdi.c,v 1.65 2013/11/02 01:41:17 jeremy Exp $ */ /* $NetBSD: uftdi.c,v 1.14 2003/02/23 04:20:07 simonb Exp $ */ /* @@ -748,7 +748,7 @@ int uftdi_match(struct device *parent, void *match, void *aux) { struct usb_attach_arg *uaa = aux; - usbd_status err; + int err; u_int8_t nifaces; if (usb_lookup(uftdi_devs, uaa->vendor, uaa->product) == NULL) diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 2adf5768d86..943fb793640 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.73 2013/09/20 15:34:50 mpi Exp $ */ +/* $OpenBSD: ugen.c,v 1.74 2013/11/02 01:41:17 jeremy Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -112,7 +112,7 @@ int ugen_do_write(struct ugen_softc *, int, struct uio *, int); int ugen_do_ioctl(struct ugen_softc *, int, u_long, caddr_t, int, struct proc *); int ugen_set_config(struct ugen_softc *sc, int configno); -usbd_status ugen_set_interface(struct ugen_softc *, int, int); +int ugen_set_interface(struct ugen_softc *, int, int); int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx); #define UGENUNIT(n) ((minor(n) >> 4) & 0xf) @@ -197,7 +197,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) struct ugen_endpoint *sce; u_int8_t niface, nendpt; int ifaceno, endptno, endpt; - usbd_status err; + int err; int dir; DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n", @@ -260,7 +260,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) sce->iface = iface; } } - return (USBD_NORMAL_COMPLETION); + return (0); } int @@ -894,12 +894,12 @@ ugen_isoc_rintr(struct usbd_xfer *xfer, void *addr, usbd_status status) selwakeup(&sce->rsel); } -usbd_status +int ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) { struct usbd_interface *iface; usb_endpoint_descriptor_t *ed; - usbd_status err; + int err; struct ugen_endpoint *sce; u_int8_t niface, nendpt, endptno, endpt; int dir; @@ -968,7 +968,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, caddr_t addr, int flag, struct proc *p) { struct ugen_endpoint *sce; - usbd_status err; + int err; struct usbd_interface *iface; struct usb_config_desc *cd; usb_config_descriptor_t *cdesc; diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 5bdf826dd73..ce3e964cbc8 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.63 2013/10/31 20:06:59 mpi Exp $ */ +/* $OpenBSD: usbdi.c,v 1.64 2013/11/02 01:41:17 jeremy Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -611,26 +611,26 @@ usbd_clear_endpoint_toggle(struct usbd_pipe *pipe) pipe->methods->cleartoggle(pipe); } -usbd_status +int usbd_endpoint_count(struct usbd_interface *iface, u_int8_t *count) { #ifdef DIAGNOSTIC if (iface == NULL || iface->idesc == NULL) { printf("usbd_endpoint_count: NULL pointer\n"); - return (USBD_INVAL); + return (1); } #endif *count = iface->idesc->bNumEndpoints; - return (USBD_NORMAL_COMPLETION); + return (0); } -usbd_status +int usbd_interface_count(struct usbd_device *dev, u_int8_t *count) { if (dev->cdesc == NULL) - return (USBD_NOT_CONFIGURED); + return (1); *count = dev->cdesc->bNumInterface; - return (USBD_NORMAL_COMPLETION); + return (0); } void diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 9c979b169e2..294fd1132de 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.h,v 1.55 2013/10/31 10:12:19 mpi Exp $ */ +/* $OpenBSD: usbdi.h,v 1.56 2013/11/02 01:41:17 jeremy Exp $ */ /* $NetBSD: usbdi.h,v 1.62 2002/07/11 21:14:35 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -106,8 +106,8 @@ usbd_status usbd_abort_pipe(struct usbd_pipe *pipe); usbd_status usbd_clear_endpoint_stall(struct usbd_pipe *pipe); usbd_status usbd_clear_endpoint_stall_async(struct usbd_pipe *pipe); void usbd_clear_endpoint_toggle(struct usbd_pipe *pipe); -usbd_status usbd_endpoint_count(struct usbd_interface *dev, u_int8_t *count); -usbd_status usbd_interface_count(struct usbd_device *dev, u_int8_t *count); +int usbd_endpoint_count(struct usbd_interface *dev, u_int8_t *count); +int usbd_interface_count(struct usbd_device *dev, u_int8_t *count); void usbd_interface2device_handle(struct usbd_interface *iface, struct usbd_device **dev); usbd_status usbd_device2interface_handle(struct usbd_device *dev, |