hw/net/can: sja1000 ignore CAN FD frames
[qemu.git] / chardev / chardev-sysemu.c
1 /*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 #include "qemu/osdep.h"
26 #include "sysemu/sysemu.h"
27 #include "chardev/char.h"
28 #include "qemu/error-report.h"
29 #include "chardev-internal.h"
30
31 static int chardev_machine_done_notify_one(Object *child, void *opaque)
32 {
33 Chardev *chr = (Chardev *)child;
34 ChardevClass *class = CHARDEV_GET_CLASS(chr);
35
36 if (class->chr_machine_done) {
37 return class->chr_machine_done(chr);
38 }
39
40 return 0;
41 }
42
43 static void chardev_machine_done_hook(Notifier *notifier, void *unused)
44 {
45 int ret = object_child_foreach(get_chardevs_root(),
46 chardev_machine_done_notify_one, NULL);
47
48 if (ret) {
49 error_report("Failed to call chardev machine_done hooks");
50 exit(1);
51 }
52 }
53
54
55 static Notifier chardev_machine_done_notify = {
56 .notify = chardev_machine_done_hook,
57 };
58
59 static void register_types(void)
60 {
61 /*
62 * This must be done after machine init, since we register FEs with muxes
63 * as part of realize functions like serial_isa_realizefn when -nographic
64 * is specified.
65 */
66 qemu_add_machine_init_done_notifier(&chardev_machine_done_notify);
67 }
68
69 type_init(register_types);