Mon Apr 26 21:54:56 2021 UTC ()
midi_attach_mi(): Be explicit about using the "midibus" interface attribute,
as the caller may be a device that carries more than one.


(thorpej)
diff -r1.92 -r1.93 src/sys/dev/midi.c

cvs diff -r1.92 -r1.93 src/sys/dev/midi.c (expand / switch to unified diff)

--- src/sys/dev/midi.c 2021/04/24 23:36:52 1.92
+++ src/sys/dev/midi.c 2021/04/26 21:54:56 1.93
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: midi.c,v 1.92 2021/04/24 23:36:52 thorpej Exp $ */ 1/* $NetBSD: midi.c,v 1.93 2021/04/26 21:54:56 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (augustss@NetBSD.org), (MIDI FST and Active 8 * by Lennart Augustsson (augustss@NetBSD.org), (MIDI FST and Active
9 * Sense handling) Chapman Flack (chap@NetBSD.org), and Andrew Doran. 9 * Sense handling) Chapman Flack (chap@NetBSD.org), and Andrew Doran.
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: midi.c,v 1.92 2021/04/24 23:36:52 thorpej Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.93 2021/04/26 21:54:56 thorpej Exp $");
35 35
36#ifdef _KERNEL_OPT 36#ifdef _KERNEL_OPT
37#include "midi.h" 37#include "midi.h"
38#include "sequencer.h" 38#include "sequencer.h"
39#endif 39#endif
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/ioctl.h> 42#include <sys/ioctl.h>
43#include <sys/fcntl.h> 43#include <sys/fcntl.h>
44#include <sys/vnode.h> 44#include <sys/vnode.h>
45#include <sys/select.h> 45#include <sys/select.h>
46#include <sys/poll.h> 46#include <sys/poll.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
@@ -1885,27 +1885,29 @@ midi_register_hw_if_ext(struct midi_hw_i @@ -1885,27 +1885,29 @@ midi_register_hw_if_ext(struct midi_hw_i
1885device_t 1885device_t
1886midi_attach_mi(const struct midi_hw_if *mhwp, void *hdlp, device_t dev) 1886midi_attach_mi(const struct midi_hw_if *mhwp, void *hdlp, device_t dev)
1887{ 1887{
1888 struct audio_attach_args arg; 1888 struct audio_attach_args arg;
1889 1889
1890 if (mhwp == NULL) { 1890 if (mhwp == NULL) {
1891 panic("midi_attach_mi: NULL\n"); 1891 panic("midi_attach_mi: NULL\n");
1892 return (0); 1892 return (0);
1893 } 1893 }
1894 1894
1895 arg.type = AUDIODEV_TYPE_MIDI; 1895 arg.type = AUDIODEV_TYPE_MIDI;
1896 arg.hwif = mhwp; 1896 arg.hwif = mhwp;
1897 arg.hdl = hdlp; 1897 arg.hdl = hdlp;
1898 return (config_found(dev, &arg, audioprint, CFARG_EOL)); 1898 return (config_found(dev, &arg, audioprint,
 1899 CFARG_IATTR, "midibus",
 1900 CFARG_EOL));
1899} 1901}
1900 1902
1901#endif /* NMIDI > 0 || NMIDIBUS > 0 */ 1903#endif /* NMIDI > 0 || NMIDIBUS > 0 */
1902 1904
1903#ifdef _MODULE 1905#ifdef _MODULE
1904#include "ioconf.c" 1906#include "ioconf.c"
1905 1907
1906devmajor_t midi_bmajor = -1, midi_cmajor = -1; 1908devmajor_t midi_bmajor = -1, midi_cmajor = -1;
1907#endif 1909#endif
1908 1910
1909MODULE(MODULE_CLASS_DRIVER, midi, "audio"); 1911MODULE(MODULE_CLASS_DRIVER, midi, "audio");
1910 1912
1911static int 1913static int