| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: umidi.c,v 1.63 2012/06/10 06:15:54 mrg Exp $ */ | | 1 | /* $NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $ */ |
2 | /* | | 2 | /* |
3 | * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc. | | 3 | * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc. |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * This code is derived from software contributed to The NetBSD Foundation | | 6 | * This code is derived from software contributed to The NetBSD Foundation |
7 | * by Takuya SHIOZAKI (tshiozak@NetBSD.org), (full-size transfers, extended | | 7 | * by Takuya SHIOZAKI (tshiozak@NetBSD.org), (full-size transfers, extended |
8 | * hw_if) Chapman Flack (chap@NetBSD.org), and Matthew R. Green | | 8 | * hw_if) Chapman Flack (chap@NetBSD.org), and Matthew R. Green |
9 | * (mrg@eterna.com.au). | | 9 | * (mrg@eterna.com.au). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.63 2012/06/10 06:15:54 mrg Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $"); |
35 | | | 35 | |
36 | #include <sys/types.h> | | 36 | #include <sys/types.h> |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/systm.h> | | 38 | #include <sys/systm.h> |
39 | #include <sys/kernel.h> | | 39 | #include <sys/kernel.h> |
40 | #include <sys/kmem.h> | | 40 | #include <sys/kmem.h> |
41 | #include <sys/device.h> | | 41 | #include <sys/device.h> |
42 | #include <sys/ioctl.h> | | 42 | #include <sys/ioctl.h> |
43 | #include <sys/conf.h> | | 43 | #include <sys/conf.h> |
44 | #include <sys/file.h> | | 44 | #include <sys/file.h> |
45 | #include <sys/select.h> | | 45 | #include <sys/select.h> |
46 | #include <sys/proc.h> | | 46 | #include <sys/proc.h> |
47 | #include <sys/vnode.h> | | 47 | #include <sys/vnode.h> |
| @@ -503,27 +503,27 @@ alloc_pipe(struct umidi_endpoint *ep) | | | @@ -503,27 +503,27 @@ alloc_pipe(struct umidi_endpoint *ep) |
503 | ep->armed = 0; | | 503 | ep->armed = 0; |
504 | ep->xfer = usbd_alloc_xfer(sc->sc_udev); | | 504 | ep->xfer = usbd_alloc_xfer(sc->sc_udev); |
505 | if (ep->xfer == NULL) { | | 505 | if (ep->xfer == NULL) { |
506 | err = USBD_NOMEM; | | 506 | err = USBD_NOMEM; |
507 | goto quit; | | 507 | goto quit; |
508 | } | | 508 | } |
509 | ep->buffer = usbd_alloc_buffer(ep->xfer, ep->buffer_size); | | 509 | ep->buffer = usbd_alloc_buffer(ep->xfer, ep->buffer_size); |
510 | if (ep->buffer == NULL) { | | 510 | if (ep->buffer == NULL) { |
511 | usbd_free_xfer(ep->xfer); | | 511 | usbd_free_xfer(ep->xfer); |
512 | err = USBD_NOMEM; | | 512 | err = USBD_NOMEM; |
513 | goto quit; | | 513 | goto quit; |
514 | } | | 514 | } |
515 | ep->next_slot = ep->buffer; | | 515 | ep->next_slot = ep->buffer; |
516 | err = usbd_open_pipe(sc->sc_iface, ep->addr, 0, &ep->pipe); | | 516 | err = usbd_open_pipe(sc->sc_iface, ep->addr, USBD_MPSAFE, &ep->pipe); |
517 | if (err) | | 517 | if (err) |
518 | usbd_free_xfer(ep->xfer); | | 518 | usbd_free_xfer(ep->xfer); |
519 | ep->solicit_cookie = softint_establish(SOFTINT_CLOCK, out_solicit, ep); | | 519 | ep->solicit_cookie = softint_establish(SOFTINT_CLOCK, out_solicit, ep); |
520 | quit: | | 520 | quit: |
521 | return err; | | 521 | return err; |
522 | } | | 522 | } |
523 | | | 523 | |
524 | static void | | 524 | static void |
525 | free_pipe(struct umidi_endpoint *ep) | | 525 | free_pipe(struct umidi_endpoint *ep) |
526 | { | | 526 | { |
527 | DPRINTF(("%s: free_pipe %p\n", device_xname(ep->sc->sc_dev), ep)); | | 527 | DPRINTF(("%s: free_pipe %p\n", device_xname(ep->sc->sc_dev), ep)); |
528 | usbd_abort_pipe(ep->pipe); | | 528 | usbd_abort_pipe(ep->pipe); |
529 | usbd_close_pipe(ep->pipe); | | 529 | usbd_close_pipe(ep->pipe); |