Check pmf_device_register return value. NFC Appeases static analyzers.diff -r1.2 -r1.3 src/sys/dev/drm/vbox_drv.c
(maya)
--- src/sys/dev/drm/vbox_drv.c 2011/08/28 17:18:31 1.2
+++ src/sys/dev/drm/vbox_drv.c 2017/01/20 12:25:07 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $ */ | 1 | /* $NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. The name of the author may not be used to endorse or promote products | 12 | * 2. The name of the author may not be used to endorse or promote products | |
13 | * derived from this software without specific prior written permission. | 13 | * derived from this software without specific prior written permission. | |
14 | * | 14 | * | |
@@ -16,27 +16,27 @@ | @@ -16,27 +16,27 @@ | |||
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
20 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 20 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
22 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 22 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
23 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 23 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
25 | * SUCH DAMAGE. | 25 | * SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | __KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $"); | 29 | __KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $"); | |
30 | 30 | |||
31 | #include "drmP.h" | 31 | #include "drmP.h" | |
32 | #include "drm.h" | 32 | #include "drm.h" | |
33 | 33 | |||
34 | static drm_pci_id_list_t vboxdrm_pciidlist[] = { | 34 | static drm_pci_id_list_t vboxdrm_pciidlist[] = { | |
35 | { 0x80ee, 0xbeef, 0, "VirtualBox Video" }, | 35 | { 0x80ee, 0xbeef, 0, "VirtualBox Video" }, | |
36 | { 0, 0, 0, NULL }, | 36 | { 0, 0, 0, NULL }, | |
37 | }; | 37 | }; | |
38 | 38 | |||
39 | static int | 39 | static int | |
40 | vboxdrm_driver_load(struct drm_device *dev, unsigned long flags) | 40 | vboxdrm_driver_load(struct drm_device *dev, unsigned long flags) | |
41 | { | 41 | { | |
42 | return drm_vblank_init(dev, 1); | 42 | return drm_vblank_init(dev, 1); | |
@@ -59,27 +59,28 @@ static int | @@ -59,27 +59,28 @@ static int | |||
59 | vboxdrm_match(device_t parent, cfdata_t match, void *opaque) | 59 | vboxdrm_match(device_t parent, cfdata_t match, void *opaque) | |
60 | { | 60 | { | |
61 | struct pci_attach_args *pa = opaque; | 61 | struct pci_attach_args *pa = opaque; | |
62 | 62 | |||
63 | return drm_probe(pa, vboxdrm_pciidlist); | 63 | return drm_probe(pa, vboxdrm_pciidlist); | |
64 | } | 64 | } | |
65 | 65 | |||
66 | static void | 66 | static void | |
67 | vboxdrm_attach(device_t parent, device_t self, void *opaque) | 67 | vboxdrm_attach(device_t parent, device_t self, void *opaque) | |
68 | { | 68 | { | |
69 | struct pci_attach_args *pa = opaque; | 69 | struct pci_attach_args *pa = opaque; | |
70 | struct drm_device *dev = device_private(self); | 70 | struct drm_device *dev = device_private(self); | |
71 | 71 | |||
72 | pmf_device_register(self, NULL, NULL); | 72 | if (!pmf_device_register(self, NULL, NULL)) | |
73 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
73 | 74 | |||
74 | dev->driver = kmem_zalloc(sizeof(struct drm_driver_info), KM_SLEEP); | 75 | dev->driver = kmem_zalloc(sizeof(struct drm_driver_info), KM_SLEEP); | |
75 | if (dev->driver == NULL) { | 76 | if (dev->driver == NULL) { | |
76 | aprint_error_dev(self, "couldn't allocate memory\n"); | 77 | aprint_error_dev(self, "couldn't allocate memory\n"); | |
77 | return; | 78 | return; | |
78 | } | 79 | } | |
79 | 80 | |||
80 | vboxdrm_configure(dev); | 81 | vboxdrm_configure(dev); | |
81 | drm_attach(self, pa, vboxdrm_pciidlist); | 82 | drm_attach(self, pa, vboxdrm_pciidlist); | |
82 | } | 83 | } | |
83 | 84 | |||
84 | static int | 85 | static int | |
85 | vboxdrm_detach(device_t self, int flags) | 86 | vboxdrm_detach(device_t self, int flags) |
--- src/sys/dev/gpio/gpiolock.c 2009/12/06 22:33:44 1.3
+++ src/sys/dev/gpio/gpiolock.c 2017/01/20 12:25:07 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gpiolock.c,v 1.3 2009/12/06 22:33:44 dyoung Exp $ */ | 1 | /* $NetBSD: gpiolock.c,v 1.4 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2009 Marc Balmer <marc@msys.ch> | 4 | * Copyright (c) 2009 Marc Balmer <marc@msys.ch> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -113,27 +113,28 @@ gpiolock_attach(device_t parent, device_ | @@ -113,27 +113,28 @@ gpiolock_attach(device_t parent, device_ | |||
113 | } | 113 | } | |
114 | aprint_normal(" [%d]", sc->sc_map.pm_map[pin]); | 114 | aprint_normal(" [%d]", sc->sc_map.pm_map[pin]); | |
115 | sc->sc_data = GPIO_PIN_INPUT; | 115 | sc->sc_data = GPIO_PIN_INPUT; | |
116 | gpio_pin_ctl(sc->sc_gpio, &sc->sc_map, pin, sc->sc_data); | 116 | gpio_pin_ctl(sc->sc_gpio, &sc->sc_map, pin, sc->sc_data); | |
117 | } | 117 | } | |
118 | 118 | |||
119 | #ifdef KEYLOCK | 119 | #ifdef KEYLOCK | |
120 | /* Register keylock */ | 120 | /* Register keylock */ | |
121 | if (keylock_register(self, sc->sc_npins, gpiolock_position)) { | 121 | if (keylock_register(self, sc->sc_npins, gpiolock_position)) { | |
122 | aprint_error(": can't register keylock\n"); | 122 | aprint_error(": can't register keylock\n"); | |
123 | goto fail; | 123 | goto fail; | |
124 | } | 124 | } | |
125 | #endif | 125 | #endif | |
126 | pmf_device_register(self, NULL, NULL); | 126 | if (!pmf_device_register(self, NULL, NULL)) | |
127 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
127 | 128 | |||
128 | aprint_normal("\n"); | 129 | aprint_normal("\n"); | |
129 | return; | 130 | return; | |
130 | 131 | |||
131 | fail: | 132 | fail: | |
132 | gpio_pin_unmap(sc->sc_gpio, &sc->sc_map); | 133 | gpio_pin_unmap(sc->sc_gpio, &sc->sc_map); | |
133 | } | 134 | } | |
134 | 135 | |||
135 | int | 136 | int | |
136 | gpiolock_detach(device_t self, int flags) | 137 | gpiolock_detach(device_t self, int flags) | |
137 | { | 138 | { | |
138 | struct gpiolock_softc *sc = device_private(self); | 139 | struct gpiolock_softc *sc = device_private(self); | |
139 | 140 |
--- src/sys/dev/gpio/gpiopwm.c 2016/07/14 04:00:45 1.5
+++ src/sys/dev/gpio/gpiopwm.c 2017/01/20 12:25:07 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gpiopwm.c,v 1.5 2016/07/14 04:00:45 msaitoh Exp $ */ | 1 | /* $NetBSD: gpiopwm.c,v 1.6 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2011 Marc Balmer <marc@msys.ch> | 4 | * Copyright (c) 2011 Marc Balmer <marc@msys.ch> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -94,27 +94,28 @@ gpiopwm_attach(device_t parent, device_t | @@ -94,27 +94,28 @@ gpiopwm_attach(device_t parent, device_t | |||
94 | const struct sysctlnode *node; | 94 | const struct sysctlnode *node; | |
95 | 95 | |||
96 | sc->sc_dev = self; | 96 | sc->sc_dev = self; | |
97 | 97 | |||
98 | /* Map pin */ | 98 | /* Map pin */ | |
99 | sc->sc_gpio = ga->ga_gpio; | 99 | sc->sc_gpio = ga->ga_gpio; | |
100 | sc->sc_map.pm_map = sc->_map; | 100 | sc->sc_map.pm_map = sc->_map; | |
101 | if (gpio_pin_map(sc->sc_gpio, ga->ga_offset, ga->ga_mask, | 101 | if (gpio_pin_map(sc->sc_gpio, ga->ga_offset, ga->ga_mask, | |
102 | &sc->sc_map)) { | 102 | &sc->sc_map)) { | |
103 | aprint_error(": can't map pin\n"); | 103 | aprint_error(": can't map pin\n"); | |
104 | return; | 104 | return; | |
105 | } | 105 | } | |
106 | aprint_normal(" [%d]", sc->sc_map.pm_map[0]); | 106 | aprint_normal(" [%d]", sc->sc_map.pm_map[0]); | |
107 | pmf_device_register(self, NULL, NULL); | 107 | if (!pmf_device_register(self, NULL, NULL)) | |
108 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
108 | 109 | |||
109 | callout_init(&sc->sc_pulse, CALLOUT_MPSAFE); | 110 | callout_init(&sc->sc_pulse, CALLOUT_MPSAFE); | |
110 | callout_setfunc(&sc->sc_pulse, gpiopwm_pulse, sc); | 111 | callout_setfunc(&sc->sc_pulse, gpiopwm_pulse, sc); | |
111 | 112 | |||
112 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | 113 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | |
113 | 0, | 114 | 0, | |
114 | CTLTYPE_NODE, device_xname(sc->sc_dev), | 115 | CTLTYPE_NODE, device_xname(sc->sc_dev), | |
115 | SYSCTL_DESCR("GPIO software PWM"), | 116 | SYSCTL_DESCR("GPIO software PWM"), | |
116 | NULL, 0, NULL, 0, | 117 | NULL, 0, NULL, 0, | |
117 | CTL_HW, CTL_CREATE, CTL_EOL); | 118 | CTL_HW, CTL_CREATE, CTL_EOL); | |
118 | 119 | |||
119 | if (node == NULL) { | 120 | if (node == NULL) { | |
120 | aprint_error(": can't create sysctl node\n"); | 121 | aprint_error(": can't create sysctl node\n"); |
--- src/sys/dev/gpio/gpiosim.c 2016/07/14 04:00:45 1.19
+++ src/sys/dev/gpio/gpiosim.c 2017/01/20 12:25:07 1.20
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gpiosim.c,v 1.19 2016/07/14 04:00:45 msaitoh Exp $ */ | 1 | /* $NetBSD: gpiosim.c,v 1.20 2017/01/20 12:25:07 maya Exp $ */ | |
2 | /* $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $ */ | 2 | /* $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2007 - 2011, 2013 Marc Balmer <marc@msys.ch> | 5 | * Copyright (c) 2007 - 2011, 2013 Marc Balmer <marc@msys.ch> | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
@@ -111,27 +111,28 @@ gpiosim_attach(device_t parent, device_t | @@ -111,27 +111,28 @@ gpiosim_attach(device_t parent, device_t | |||
111 | sc->sc_state = 0; | 111 | sc->sc_state = 0; | |
112 | 112 | |||
113 | /* create controller tag */ | 113 | /* create controller tag */ | |
114 | sc->sc_gpio_gc.gp_cookie = sc; | 114 | sc->sc_gpio_gc.gp_cookie = sc; | |
115 | sc->sc_gpio_gc.gp_pin_read = gpiosim_pin_read; | 115 | sc->sc_gpio_gc.gp_pin_read = gpiosim_pin_read; | |
116 | sc->sc_gpio_gc.gp_pin_write = gpiosim_pin_write; | 116 | sc->sc_gpio_gc.gp_pin_write = gpiosim_pin_write; | |
117 | sc->sc_gpio_gc.gp_pin_ctl = gpiosim_pin_ctl; | 117 | sc->sc_gpio_gc.gp_pin_ctl = gpiosim_pin_ctl; | |
118 | 118 | |||
119 | /* gba.gba_name = "gpio"; */ | 119 | /* gba.gba_name = "gpio"; */ | |
120 | gba.gba_gc = &sc->sc_gpio_gc; | 120 | gba.gba_gc = &sc->sc_gpio_gc; | |
121 | gba.gba_pins = sc->sc_gpio_pins; | 121 | gba.gba_pins = sc->sc_gpio_pins; | |
122 | gba.gba_npins = GPIOSIM_NPINS; | 122 | gba.gba_npins = GPIOSIM_NPINS; | |
123 | 123 | |||
124 | pmf_device_register(self, NULL, NULL); | 124 | if (!pmf_device_register(self, NULL, NULL)) | |
125 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
125 | 126 | |||
126 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | 127 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | |
127 | 0, | 128 | 0, | |
128 | CTLTYPE_NODE, device_xname(sc->sc_dev), | 129 | CTLTYPE_NODE, device_xname(sc->sc_dev), | |
129 | SYSCTL_DESCR("GPIO simulator"), | 130 | SYSCTL_DESCR("GPIO simulator"), | |
130 | NULL, 0, NULL, 0, | 131 | NULL, 0, NULL, 0, | |
131 | CTL_HW, CTL_CREATE, CTL_EOL); | 132 | CTL_HW, CTL_CREATE, CTL_EOL); | |
132 | 133 | |||
133 | if (node == NULL) { | 134 | if (node == NULL) { | |
134 | aprint_error(": can't create sysctl node\n"); | 135 | aprint_error(": can't create sysctl node\n"); | |
135 | return; | 136 | return; | |
136 | } | 137 | } | |
137 | 138 |
--- src/sys/dev/pci/gffb.c 2016/07/11 11:31:51 1.11
+++ src/sys/dev/pci/gffb.c 2017/01/20 12:25:07 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gffb.c,v 1.11 2016/07/11 11:31:51 msaitoh Exp $ */ | 1 | /* $NetBSD: gffb.c,v 1.12 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2013 Michael Lorenz | 4 | * Copyright (c) 2013 Michael Lorenz | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | /* | 28 | /* | |
29 | * A console driver for nvidia geforce graphics controllers | 29 | * A console driver for nvidia geforce graphics controllers | |
30 | * tested on macppc only so far, should work on other hardware as long as | 30 | * tested on macppc only so far, should work on other hardware as long as | |
31 | * something sets up a usable graphics mode and sets the right device properties | 31 | * something sets up a usable graphics mode and sets the right device properties | |
32 | * This driver should work with all NV1x hardware but so far it's been tested | 32 | * This driver should work with all NV1x hardware but so far it's been tested | |
33 | * only on NV11 / GeForce2 MX. Needs testing with more hardware and if | 33 | * only on NV11 / GeForce2 MX. Needs testing with more hardware and if | |
34 | * successful, PCI IDs need to be added to gffb_match() | 34 | * successful, PCI IDs need to be added to gffb_match() | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.11 2016/07/11 11:31:51 msaitoh Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.12 2017/01/20 12:25:07 maya Exp $"); | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/device.h> | 43 | #include <sys/device.h> | |
44 | #include <sys/malloc.h> | 44 | #include <sys/malloc.h> | |
45 | #include <sys/lwp.h> | 45 | #include <sys/lwp.h> | |
46 | #include <sys/kauth.h> | 46 | #include <sys/kauth.h> | |
47 | #include <sys/atomic.h> | 47 | #include <sys/atomic.h> | |
48 | 48 | |||
49 | #include <dev/videomode/videomode.h> | 49 | #include <dev/videomode/videomode.h> | |
50 | 50 | |||
51 | #include <dev/pci/pcivar.h> | 51 | #include <dev/pci/pcivar.h> | |
@@ -332,27 +332,29 @@ gffb_attach(device_t parent, device_t se | @@ -332,27 +332,29 @@ gffb_attach(device_t parent, device_t se | |||
332 | } | 332 | } | |
333 | 333 | |||
334 | j = 0; | 334 | j = 0; | |
335 | rasops_get_cmap(ri, cmap, sizeof(cmap)); | 335 | rasops_get_cmap(ri, cmap, sizeof(cmap)); | |
336 | for (i = 0; i < 256; i++) { | 336 | for (i = 0; i < 256; i++) { | |
337 | sc->sc_cmap_red[i] = cmap[j]; | 337 | sc->sc_cmap_red[i] = cmap[j]; | |
338 | sc->sc_cmap_green[i] = cmap[j + 1]; | 338 | sc->sc_cmap_green[i] = cmap[j + 1]; | |
339 | sc->sc_cmap_blue[i] = cmap[j + 2]; | 339 | sc->sc_cmap_blue[i] = cmap[j + 2]; | |
340 | gffb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]); | 340 | gffb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]); | |
341 | j += 3; | 341 | j += 3; | |
342 | } | 342 | } | |
343 | 343 | |||
344 | /* no suspend/resume support yet */ | 344 | /* no suspend/resume support yet */ | |
345 | pmf_device_register(sc->sc_dev, NULL, NULL); | 345 | if (!pmf_device_register(sc->sc_dev, NULL, NULL)) | |
346 | aprint_error_dev(sc->sc_dev, | |||
347 | "couldn't establish power handler\n"); | |||
346 | 348 | |||
347 | aa.console = is_console; | 349 | aa.console = is_console; | |
348 | aa.scrdata = &sc->sc_screenlist; | 350 | aa.scrdata = &sc->sc_screenlist; | |
349 | aa.accessops = &gffb_accessops; | 351 | aa.accessops = &gffb_accessops; | |
350 | aa.accesscookie = &sc->vd; | 352 | aa.accesscookie = &sc->vd; | |
351 | 353 | |||
352 | config_found(sc->sc_dev, &aa, wsemuldisplaydevprint); | 354 | config_found(sc->sc_dev, &aa, wsemuldisplaydevprint); | |
353 | 355 | |||
354 | #ifdef GFFB_DEBUG | 356 | #ifdef GFFB_DEBUG | |
355 | for (i = 0; i < 40; i++) { | 357 | for (i = 0; i < 40; i++) { | |
356 | for (j = 0; j < 40; j++) { | 358 | for (j = 0; j < 40; j++) { | |
357 | gffb_rectfill(sc, i * 20, j * 20, 20, 20, | 359 | gffb_rectfill(sc, i * 20, j * 20, 20, 20, | |
358 | (i + j ) & 1 ? 0xe0e0e0e0 : 0x03030303); | 360 | (i + j ) & 1 ? 0xe0e0e0e0 : 0x03030303); |
--- src/sys/dev/pci/ibmcd.c 2016/07/14 10:19:06 1.2
+++ src/sys/dev/pci/ibmcd.c 2017/01/20 12:25:07 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ibmcd.c,v 1.2 2016/07/14 10:19:06 msaitoh Exp $ */ | 1 | /* $NetBSD: ibmcd.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2012 Marc Balmer <marc@msys.ch> | 4 | * Copyright (c) 2012 Marc Balmer <marc@msys.ch> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -104,27 +104,28 @@ ibmcd_attach(device_t parent, device_t s | @@ -104,27 +104,28 @@ ibmcd_attach(device_t parent, device_t s | |||
104 | 104 | |||
105 | aprint_naive("\n"); | 105 | aprint_naive("\n"); | |
106 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | 106 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | |
107 | if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &sc->sc_iot, | 107 | if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &sc->sc_iot, | |
108 | &sc->sc_ioh, NULL, &sc->sc_iosize)) { | 108 | &sc->sc_ioh, NULL, &sc->sc_iosize)) { | |
109 | aprint_error("\n"); | 109 | aprint_error("\n"); | |
110 | aprint_error_dev(self, "PCI %s region not found\n", | 110 | aprint_error_dev(self, "PCI %s region not found\n", | |
111 | memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory"); | 111 | memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory"); | |
112 | return; | 112 | return; | |
113 | } | 113 | } | |
114 | aprint_normal(": IBM 4810 BSP cash drawer\n"); | 114 | aprint_normal(": IBM 4810 BSP cash drawer\n"); | |
115 | 115 | |||
116 | #if (__NetBSD_Version__ >= 600000000) | 116 | #if (__NetBSD_Version__ >= 600000000) | |
117 | pmf_device_register(self, ibmcd_suspend, ibmcd_resume); | 117 | if (!pmf_device_register(self, ibmcd_suspend, ibmcd_resume)) | |
118 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
118 | #endif | 119 | #endif | |
119 | /* Initialize pins array */ | 120 | /* Initialize pins array */ | |
120 | sc->sc_gpio_pins[PIN_OPEN].pin_num = 0; | 121 | sc->sc_gpio_pins[PIN_OPEN].pin_num = 0; | |
121 | sc->sc_gpio_pins[PIN_OPEN].pin_caps = GPIO_PIN_OUTPUT; | 122 | sc->sc_gpio_pins[PIN_OPEN].pin_caps = GPIO_PIN_OUTPUT; | |
122 | sc->sc_gpio_pins[PIN_STATUS].pin_num = 1; | 123 | sc->sc_gpio_pins[PIN_STATUS].pin_num = 1; | |
123 | sc->sc_gpio_pins[PIN_STATUS].pin_caps = GPIO_PIN_INPUT; | 124 | sc->sc_gpio_pins[PIN_STATUS].pin_caps = GPIO_PIN_INPUT; | |
124 | sc->sc_gpio_pins[PIN_CONNECTED].pin_num = 2; | 125 | sc->sc_gpio_pins[PIN_CONNECTED].pin_num = 2; | |
125 | sc->sc_gpio_pins[PIN_CONNECTED].pin_caps = GPIO_PIN_INPUT; | 126 | sc->sc_gpio_pins[PIN_CONNECTED].pin_caps = GPIO_PIN_INPUT; | |
126 | 127 | |||
127 | /* Create controller tag */ | 128 | /* Create controller tag */ | |
128 | sc->sc_gpio_gc.gp_cookie = sc; | 129 | sc->sc_gpio_gc.gp_cookie = sc; | |
129 | sc->sc_gpio_gc.gp_pin_read = ibmcd_gpio_pin_read; | 130 | sc->sc_gpio_gc.gp_pin_read = ibmcd_gpio_pin_read; | |
130 | sc->sc_gpio_gc.gp_pin_write = ibmcd_gpio_pin_write; | 131 | sc->sc_gpio_gc.gp_pin_write = ibmcd_gpio_pin_write; |
--- src/sys/dev/pci/pwdog.c 2016/07/14 10:19:06 1.9
+++ src/sys/dev/pci/pwdog.c 2017/01/20 12:25:07 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $$NetBSD: pwdog.c,v 1.9 2016/07/14 10:19:06 msaitoh Exp $ */ | 1 | /* $$NetBSD: pwdog.c,v 1.10 2017/01/20 12:25:07 maya Exp $ */ | |
2 | /* $OpenBSD: pwdog.c,v 1.7 2010/04/08 00:23:53 tedu Exp $ */ | 2 | /* $OpenBSD: pwdog.c,v 1.7 2010/04/08 00:23:53 tedu Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2006, 2011 Marc Balmer <mbalmer@NetBSD.org> | 5 | * Copyright (c) 2006, 2011 Marc Balmer <mbalmer@NetBSD.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -86,27 +86,28 @@ pwdog_attach(device_t parent, device_t s | @@ -86,27 +86,28 @@ pwdog_attach(device_t parent, device_t s | |||
86 | aprint_naive("\n"); | 86 | aprint_naive("\n"); | |
87 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | 87 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | |
88 | if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &sc->sc_iot, | 88 | if (pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, &sc->sc_iot, | |
89 | &sc->sc_ioh, NULL, &sc->sc_iosize)) { | 89 | &sc->sc_ioh, NULL, &sc->sc_iosize)) { | |
90 | aprint_error("\n"); | 90 | aprint_error("\n"); | |
91 | aprint_error_dev(self, "PCI %s region not found\n", | 91 | aprint_error_dev(self, "PCI %s region not found\n", | |
92 | memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory"); | 92 | memtype == PCI_MAPREG_TYPE_IO ? "I/O" : "memory"); | |
93 | return; | 93 | return; | |
94 | } | 94 | } | |
95 | aprint_normal("\n"); | 95 | aprint_normal("\n"); | |
96 | 96 | |||
97 | sc->sc_dev = self; | 97 | sc->sc_dev = self; | |
98 | 98 | |||
99 | pmf_device_register(self, pwdog_suspend, pwdog_resume); | 99 | if (!pmf_device_register(self, pwdog_suspend, pwdog_resume)) | |
100 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
100 | bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0); | 101 | bus_space_write_1(sc->sc_iot, sc->sc_ioh, PWDOG_DISABLE, 0); | |
101 | 102 | |||
102 | sc->sc_smw.smw_name = device_xname(self); | 103 | sc->sc_smw.smw_name = device_xname(self); | |
103 | sc->sc_smw.smw_cookie = sc; | 104 | sc->sc_smw.smw_cookie = sc; | |
104 | sc->sc_smw.smw_setmode = pwdog_setmode; | 105 | sc->sc_smw.smw_setmode = pwdog_setmode; | |
105 | sc->sc_smw.smw_tickle = pwdog_tickle; | 106 | sc->sc_smw.smw_tickle = pwdog_tickle; | |
106 | sc->sc_smw.smw_period = PWDOG_MAX_PERIOD; | 107 | sc->sc_smw.smw_period = PWDOG_MAX_PERIOD; | |
107 | 108 | |||
108 | if (sysmon_wdog_register(&sc->sc_smw)) | 109 | if (sysmon_wdog_register(&sc->sc_smw)) | |
109 | aprint_error_dev(self, "couldn't register with sysmon\n"); | 110 | aprint_error_dev(self, "couldn't register with sysmon\n"); | |
110 | else | 111 | else | |
111 | sc->sc_smw_valid = true; | 112 | sc->sc_smw_valid = true; | |
112 | } | 113 | } |
--- src/sys/dev/pci/r128fb.c 2015/09/16 16:52:54 1.39
+++ src/sys/dev/pci/r128fb.c 2017/01/20 12:25:07 1.40
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: r128fb.c,v 1.39 2015/09/16 16:52:54 macallan Exp $ */ | 1 | /* $NetBSD: r128fb.c,v 1.40 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007, 2012 Michael Lorenz | 4 | * Copyright (c) 2007, 2012 Michael Lorenz | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | /* | 28 | /* | |
29 | * A console driver for ATI Rage 128 graphics controllers | 29 | * A console driver for ATI Rage 128 graphics controllers | |
30 | * tested on macppc only so far | 30 | * tested on macppc only so far | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.39 2015/09/16 16:52:54 macallan Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.40 2017/01/20 12:25:07 maya Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/kernel.h> | 38 | #include <sys/kernel.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/malloc.h> | 40 | #include <sys/malloc.h> | |
41 | #include <sys/lwp.h> | 41 | #include <sys/lwp.h> | |
42 | #include <sys/kauth.h> | 42 | #include <sys/kauth.h> | |
43 | 43 | |||
44 | #include <dev/videomode/videomode.h> | 44 | #include <dev/videomode/videomode.h> | |
45 | 45 | |||
46 | #include <dev/pci/pcivar.h> | 46 | #include <dev/pci/pcivar.h> | |
47 | #include <dev/pci/pcireg.h> | 47 | #include <dev/pci/pcireg.h> | |
@@ -322,27 +322,29 @@ r128fb_attach(device_t parent, device_t | @@ -322,27 +322,29 @@ r128fb_attach(device_t parent, device_t | |||
322 | } | 322 | } | |
323 | 323 | |||
324 | j = 0; | 324 | j = 0; | |
325 | rasops_get_cmap(ri, cmap, sizeof(cmap)); | 325 | rasops_get_cmap(ri, cmap, sizeof(cmap)); | |
326 | for (i = 0; i < 256; i++) { | 326 | for (i = 0; i < 256; i++) { | |
327 | sc->sc_cmap_red[i] = cmap[j]; | 327 | sc->sc_cmap_red[i] = cmap[j]; | |
328 | sc->sc_cmap_green[i] = cmap[j + 1]; | 328 | sc->sc_cmap_green[i] = cmap[j + 1]; | |
329 | sc->sc_cmap_blue[i] = cmap[j + 2]; | 329 | sc->sc_cmap_blue[i] = cmap[j + 2]; | |
330 | r128fb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]); | 330 | r128fb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]); | |
331 | j += 3; | 331 | j += 3; | |
332 | } | 332 | } | |
333 | 333 | |||
334 | /* no suspend/resume support yet */ | 334 | /* no suspend/resume support yet */ | |
335 | pmf_device_register(sc->sc_dev, NULL, NULL); | 335 | if (!pmf_device_register(sc->sc_dev, NULL, NULL)) | |
336 | aprint_error_dev(sc->sc_dev, | |||
337 | "couldn't establish power handler\n"); | |||
336 | 338 | |||
337 | reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL); | 339 | reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL); | |
338 | DPRINTF("R128_LVDS_GEN_CNTL: %08x\n", reg); | 340 | DPRINTF("R128_LVDS_GEN_CNTL: %08x\n", reg); | |
339 | if (reg & R128_LVDS_ON) { | 341 | if (reg & R128_LVDS_ON) { | |
340 | sc->sc_have_backlight = 1; | 342 | sc->sc_have_backlight = 1; | |
341 | sc->sc_bl_on = 1; | 343 | sc->sc_bl_on = 1; | |
342 | sc->sc_bl_level = 255 - | 344 | sc->sc_bl_level = 255 - | |
343 | ((reg & R128_LEVEL_MASK) >> R128_LEVEL_SHIFT); | 345 | ((reg & R128_LEVEL_MASK) >> R128_LEVEL_SHIFT); | |
344 | pmf_event_register(sc->sc_dev, PMFE_DISPLAY_BRIGHTNESS_UP, | 346 | pmf_event_register(sc->sc_dev, PMFE_DISPLAY_BRIGHTNESS_UP, | |
345 | r128fb_brightness_up, TRUE); | 347 | r128fb_brightness_up, TRUE); | |
346 | pmf_event_register(sc->sc_dev, PMFE_DISPLAY_BRIGHTNESS_DOWN, | 348 | pmf_event_register(sc->sc_dev, PMFE_DISPLAY_BRIGHTNESS_DOWN, | |
347 | r128fb_brightness_down, TRUE); | 349 | r128fb_brightness_down, TRUE); | |
348 | aprint_verbose("%s: LVDS output is active, enabling backlight" | 350 | aprint_verbose("%s: LVDS output is active, enabling backlight" |
--- src/sys/dev/podulebus/sec.c 2014/01/21 19:50:16 1.16
+++ src/sys/dev/podulebus/sec.c 2017/01/20 12:25:07 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sec.c,v 1.16 2014/01/21 19:50:16 christos Exp $ */ | 1 | /* $NetBSD: sec.c,v 1.17 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2001, 2006 Ben Harris | 4 | * Copyright (c) 2000, 2001, 2006 Ben Harris | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | */ | 28 | */ | |
29 | /* | 29 | /* | |
30 | * sec.c -- driver for Acorn SCSI expansion cards (AKA30, AKA31, AKA32) | 30 | * sec.c -- driver for Acorn SCSI expansion cards (AKA30, AKA31, AKA32) | |
31 | * | 31 | * | |
32 | * These cards are documented in: | 32 | * These cards are documented in: | |
33 | * Acorn Archimedes 500 series / Acorn R200 series Technical Reference Manual | 33 | * Acorn Archimedes 500 series / Acorn R200 series Technical Reference Manual | |
34 | * Published by Acorn Computers Limited | 34 | * Published by Acorn Computers Limited | |
35 | * ISBN 1 85250 086 7 | 35 | * ISBN 1 85250 086 7 | |
36 | * Part number 0486,052 | 36 | * Part number 0486,052 | |
37 | * Issue 1, November 1990 | 37 | * Issue 1, November 1990 | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | #include <sys/cdefs.h> | 40 | #include <sys/cdefs.h> | |
41 | __KERNEL_RCSID(0, "$NetBSD: sec.c,v 1.16 2014/01/21 19:50:16 christos Exp $"); | 41 | __KERNEL_RCSID(0, "$NetBSD: sec.c,v 1.17 2017/01/20 12:25:07 maya Exp $"); | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | 44 | |||
45 | #include <sys/buf.h> | 45 | #include <sys/buf.h> | |
46 | #include <sys/device.h> | 46 | #include <sys/device.h> | |
47 | #include <sys/malloc.h> | 47 | #include <sys/malloc.h> | |
48 | #include <sys/reboot.h> /* For bootverbose */ | 48 | #include <sys/reboot.h> /* For bootverbose */ | |
49 | #include <sys/syslog.h> | 49 | #include <sys/syslog.h> | |
50 | #include <sys/systm.h> | 50 | #include <sys/systm.h> | |
51 | 51 | |||
52 | #include <dev/scsipi/scsi_all.h> | 52 | #include <dev/scsipi/scsi_all.h> | |
53 | #include <dev/scsipi/scsipi_all.h> | 53 | #include <dev/scsipi/scsipi_all.h> | |
54 | #include <dev/scsipi/scsiconf.h> | 54 | #include <dev/scsipi/scsiconf.h> | |
@@ -204,27 +204,29 @@ sec_attach(device_t parent, device_t sel | @@ -204,27 +204,29 @@ sec_attach(device_t parent, device_t sel | |||
204 | bus_space_set_region_2(sc->sc_mod_t, sc->sc_mod_h, | 204 | bus_space_set_region_2(sc->sc_mod_t, sc->sc_mod_h, | |
205 | SEC_SRAM, 0, SEC_PAGESIZE / 2); | 205 | SEC_SRAM, 0, SEC_PAGESIZE / 2); | |
206 | } | 206 | } | |
207 | 207 | |||
208 | wd33c93_attach(&sc->sc_sbic); | 208 | wd33c93_attach(&sc->sc_sbic); | |
209 | 209 | |||
210 | evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, | 210 | evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, | |
211 | device_xname(self), "intr"); | 211 | device_xname(self), "intr"); | |
212 | sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, sec_intr, | 212 | sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, sec_intr, | |
213 | sc, &sc->sc_intrcnt); | 213 | sc, &sc->sc_intrcnt); | |
214 | sec_cli(sc); | 214 | sec_cli(sc); | |
215 | sc->sc_mpr |= SEC_MPR_IE; | 215 | sc->sc_mpr |= SEC_MPR_IE; | |
216 | bus_space_write_1(sc->sc_pod_t, sc->sc_pod_h, SEC_MPR, sc->sc_mpr); | 216 | bus_space_write_1(sc->sc_pod_t, sc->sc_pod_h, SEC_MPR, sc->sc_mpr); | |
217 | pmf_device_register1(sc->sc_sbic.sc_dev, NULL, NULL, sec_shutdown); | 217 | if (!pmf_device_register1(sc->sc_sbic.sc_dev, NULL, NULL, sec_shutdown)) | |
218 | aprint_error_dev(sc->sc_sbic.sc_dev, | |||
219 | "couldn't establish power handler\n"); | |||
218 | } | 220 | } | |
219 | 221 | |||
220 | /* | 222 | /* | |
221 | * Before reboot, reset the page register to 0 so that RISC OS can see | 223 | * Before reboot, reset the page register to 0 so that RISC OS can see | |
222 | * the podule ROM. | 224 | * the podule ROM. | |
223 | */ | 225 | */ | |
224 | static bool | 226 | static bool | |
225 | sec_shutdown(device_t dev, int howto) | 227 | sec_shutdown(device_t dev, int howto) | |
226 | { | 228 | { | |
227 | struct sec_softc *sc = device_private(dev); | 229 | struct sec_softc *sc = device_private(dev); | |
228 | 230 | |||
229 | sec_setpage(sc, 0); | 231 | sec_setpage(sc, 0); | |
230 | return true; | 232 | return true; |
--- src/sys/dev/usb/irmce.c 2016/04/23 10:15:32 1.2
+++ src/sys/dev/usb/irmce.c 2017/01/20 12:25:07 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: irmce.c,v 1.2 2016/04/23 10:15:32 skrll Exp $ */ | 1 | /* $NetBSD: irmce.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * IR receiver/transceiver for Windows Media Center | 30 | * IR receiver/transceiver for Windows Media Center | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: irmce.c,v 1.2 2016/04/23 10:15:32 skrll Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: irmce.c,v 1.3 2017/01/20 12:25:07 maya 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/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/conf.h> | 40 | #include <sys/conf.h> | |
41 | #include <sys/bus.h> | 41 | #include <sys/bus.h> | |
42 | #include <sys/select.h> | 42 | #include <sys/select.h> | |
43 | #include <sys/module.h> | 43 | #include <sys/module.h> | |
44 | 44 | |||
45 | #include <dev/usb/usb.h> | 45 | #include <dev/usb/usb.h> | |
46 | #include <dev/usb/usbdi.h> | 46 | #include <dev/usb/usbdi.h> | |
47 | #include <dev/usb/usbdi_util.h> | 47 | #include <dev/usb/usbdi_util.h> | |
@@ -140,27 +140,28 @@ irmce_match(device_t parent, cfdata_t ma | @@ -140,27 +140,28 @@ irmce_match(device_t parent, cfdata_t ma | |||
140 | return UMATCH_NONE; | 140 | return UMATCH_NONE; | |
141 | } | 141 | } | |
142 | 142 | |||
143 | static void | 143 | static void | |
144 | irmce_attach(device_t parent, device_t self, void *opaque) | 144 | irmce_attach(device_t parent, device_t self, void *opaque) | |
145 | { | 145 | { | |
146 | struct irmce_softc *sc = device_private(self); | 146 | struct irmce_softc *sc = device_private(self); | |
147 | struct usbif_attach_arg *uiaa = opaque; | 147 | struct usbif_attach_arg *uiaa = opaque; | |
148 | usb_endpoint_descriptor_t *ed; | 148 | usb_endpoint_descriptor_t *ed; | |
149 | char *devinfop; | 149 | char *devinfop; | |
150 | unsigned int i; | 150 | unsigned int i; | |
151 | uint8_t nep; | 151 | uint8_t nep; | |
152 | 152 | |||
153 | pmf_device_register(self, NULL, NULL); | 153 | if (!pmf_device_register(self, NULL, NULL)) | |
154 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
154 | 155 | |||
155 | aprint_naive("\n"); | 156 | aprint_naive("\n"); | |
156 | 157 | |||
157 | devinfop = usbd_devinfo_alloc(uiaa->uiaa_device, 0); | 158 | devinfop = usbd_devinfo_alloc(uiaa->uiaa_device, 0); | |
158 | aprint_normal(": %s\n", devinfop); | 159 | aprint_normal(": %s\n", devinfop); | |
159 | usbd_devinfo_free(devinfop); | 160 | usbd_devinfo_free(devinfop); | |
160 | 161 | |||
161 | sc->sc_dev = self; | 162 | sc->sc_dev = self; | |
162 | sc->sc_udev = uiaa->uiaa_device; | 163 | sc->sc_udev = uiaa->uiaa_device; | |
163 | sc->sc_iface = uiaa->uiaa_iface; | 164 | sc->sc_iface = uiaa->uiaa_iface; | |
164 | 165 | |||
165 | nep = 0; | 166 | nep = 0; | |
166 | usbd_endpoint_count(sc->sc_iface, &nep); | 167 | usbd_endpoint_count(sc->sc_iface, &nep); |
--- src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c 2011/08/28 20:22:42 1.10
+++ src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c 2017/01/20 12:25:07 1.11
@@ -188,27 +188,28 @@ i915drm_probe(device_t parent, cfdata_t | @@ -188,27 +188,28 @@ i915drm_probe(device_t parent, cfdata_t | |||
188 | } | 188 | } | |
189 | 189 | |||
190 | static void | 190 | static void | |
191 | i915drm_attach(device_t parent, device_t self, void *aux) | 191 | i915drm_attach(device_t parent, device_t self, void *aux) | |
192 | { | 192 | { | |
193 | struct pci_attach_args *pa = aux; | 193 | struct pci_attach_args *pa = aux; | |
194 | struct drm_device *dev = device_private(self); | 194 | struct drm_device *dev = device_private(self); | |
195 | 195 | |||
196 | dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, | 196 | dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, | |
197 | M_WAITOK | M_ZERO); | 197 | M_WAITOK | M_ZERO); | |
198 | 198 | |||
199 | i915_configure(dev); | 199 | i915_configure(dev); | |
200 | 200 | |||
201 | pmf_device_register(self, i915drm_suspend, i915drm_resume); | 201 | if (!pmf_device_register(self, i915drm_suspend, i915drm_resume)) | |
202 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
202 | 203 | |||
203 | drm_attach(self, pa, i915_pciidlist); | 204 | drm_attach(self, pa, i915_pciidlist); | |
204 | } | 205 | } | |
205 | 206 | |||
206 | static int | 207 | static int | |
207 | i915drm_detach(device_t self, int flags) | 208 | i915drm_detach(device_t self, int flags) | |
208 | { | 209 | { | |
209 | pmf_device_deregister(self); | 210 | pmf_device_deregister(self); | |
210 | 211 | |||
211 | return drm_detach(self, flags); | 212 | return drm_detach(self, flags); | |
212 | } | 213 | } | |
213 | 214 | |||
214 | CFATTACH_DECL_NEW(i915drm, sizeof(struct drm_device), i915drm_probe, | 215 | CFATTACH_DECL_NEW(i915drm, sizeof(struct drm_device), i915drm_probe, |
--- src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c 2015/11/05 20:52:46 1.6
+++ src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c 2017/01/20 12:25:07 1.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: radeondrmkmsfb.c,v 1.6 2015/11/05 20:52:46 mrg Exp $ */ | 1 | /* $NetBSD: radeondrmkmsfb.c,v 1.7 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2014 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2014 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 Taylor R. Campbell. | 8 | * by Taylor R. Campbell. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.6 2015/11/05 20:52:46 mrg Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.7 2017/01/20 12:25:07 maya Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "vga.h" | 37 | #include "vga.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include <sys/types.h> | 40 | #include <sys/types.h> | |
41 | #include <sys/device.h> | 41 | #include <sys/device.h> | |
42 | 42 | |||
43 | #include <dev/pci/pciio.h> | 43 | #include <dev/pci/pciio.h> | |
44 | #include <dev/pci/pcireg.h> | 44 | #include <dev/pci/pcireg.h> | |
45 | #include <dev/pci/pcivar.h> | 45 | #include <dev/pci/pcivar.h> | |
46 | 46 | |||
47 | #include <dev/pci/wsdisplay_pci.h> | 47 | #include <dev/pci/wsdisplay_pci.h> | |
@@ -201,28 +201,30 @@ radeonfb_setconfig_task(struct radeon_ta | @@ -201,28 +201,30 @@ radeonfb_setconfig_task(struct radeon_ta | |||
201 | genfb_ops.genfb_ioctl = radeonfb_genfb_ioctl; | 201 | genfb_ops.genfb_ioctl = radeonfb_genfb_ioctl; | |
202 | genfb_ops.genfb_mmap = radeonfb_genfb_mmap; | 202 | genfb_ops.genfb_mmap = radeonfb_genfb_mmap; | |
203 | genfb_ops.genfb_enable_polling = radeonfb_genfb_enable_polling; | 203 | genfb_ops.genfb_enable_polling = radeonfb_genfb_enable_polling; | |
204 | genfb_ops.genfb_disable_polling = radeonfb_genfb_disable_polling; | 204 | genfb_ops.genfb_disable_polling = radeonfb_genfb_disable_polling; | |
205 | 205 | |||
206 | error = genfb_attach(&sc->sc_genfb, &genfb_ops); | 206 | error = genfb_attach(&sc->sc_genfb, &genfb_ops); | |
207 | if (error) { | 207 | if (error) { | |
208 | aprint_error_dev(sc->sc_dev, "failed to attach genfb: %d\n", | 208 | aprint_error_dev(sc->sc_dev, "failed to attach genfb: %d\n", | |
209 | error); | 209 | error); | |
210 | goto fail0; | 210 | goto fail0; | |
211 | } | 211 | } | |
212 | sc->sc_attached = true; | 212 | sc->sc_attached = true; | |
213 | 213 | |||
214 | pmf_device_register1(sc->sc_dev, NULL, NULL, | 214 | if (!pmf_device_register1(sc->sc_dev, NULL, NULL, | |
215 | radeonfb_genfb_shutdown); | 215 | radeonfb_genfb_shutdown)) | |
216 | aprint_error_dev(sc->sc_dev, | |||
217 | "couldn't establish power handler\n"); | |||
216 | 218 | |||
217 | /* Success! */ | 219 | /* Success! */ | |
218 | sc->sc_scheduled = false; | 220 | sc->sc_scheduled = false; | |
219 | return; | 221 | return; | |
220 | 222 | |||
221 | fail0: /* XXX Restore console... */ | 223 | fail0: /* XXX Restore console... */ | |
222 | switch (what_was_cons) { | 224 | switch (what_was_cons) { | |
223 | case CONS_VGA: | 225 | case CONS_VGA: | |
224 | break; | 226 | break; | |
225 | case CONS_GENFB: | 227 | case CONS_GENFB: | |
226 | break; | 228 | break; | |
227 | case CONS_NONE: | 229 | case CONS_NONE: | |
228 | break; | 230 | break; |
--- src/sys/modules/lua/lua.c 2016/07/14 04:00:46 1.18
+++ src/sys/modules/lua/lua.c 2017/01/20 12:25:07 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lua.c,v 1.18 2016/07/14 04:00:46 msaitoh Exp $ */ | 1 | /* $NetBSD: lua.c,v 1.19 2017/01/20 12:25:07 maya Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>. | 4 | * Copyright (c) 2014 by Lourival Vieira Neto <lneto@NetBSD.org>. | |
5 | * Copyright (c) 2011 - 2014 by Marc Balmer <mbalmer@NetBSD.org>. | 5 | * Copyright (c) 2011 - 2014 by Marc Balmer <mbalmer@NetBSD.org>. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -131,27 +131,28 @@ lua_attach(device_t parent, device_t sel | @@ -131,27 +131,28 @@ lua_attach(device_t parent, device_t sel | |||
131 | if (sc_self) | 131 | if (sc_self) | |
132 | return; | 132 | return; | |
133 | 133 | |||
134 | sc = device_private(self); | 134 | sc = device_private(self); | |
135 | sc->sc_dev = self; | 135 | sc->sc_dev = self; | |
136 | sc_self = self; | 136 | sc_self = self; | |
137 | 137 | |||
138 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); | 138 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); | |
139 | cv_init(&sc->sc_inuse_cv, "luactl"); | 139 | cv_init(&sc->sc_inuse_cv, "luactl"); | |
140 | 140 | |||
141 | mutex_init(&sc->sc_state_lock, MUTEX_DEFAULT, IPL_VM); | 141 | mutex_init(&sc->sc_state_lock, MUTEX_DEFAULT, IPL_VM); | |
142 | cv_init(&sc->sc_state_cv, "luastate"); | 142 | cv_init(&sc->sc_state_cv, "luastate"); | |
143 | 143 | |||
144 | pmf_device_register(self, NULL, NULL); | 144 | if (!pmf_device_register(self, NULL, NULL)) | |
145 | aprint_error_dev(self, "couldn't establish power handler\n"); | |||
145 | 146 | |||
146 | /* Sysctl to provide some control over behaviour */ | 147 | /* Sysctl to provide some control over behaviour */ | |
147 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | 148 | sysctl_createv(&sc->sc_log, 0, NULL, &node, | |
148 | CTLFLAG_OWNDESC, | 149 | CTLFLAG_OWNDESC, | |
149 | CTLTYPE_NODE, "lua", | 150 | CTLTYPE_NODE, "lua", | |
150 | SYSCTL_DESCR("Lua options"), | 151 | SYSCTL_DESCR("Lua options"), | |
151 | NULL, 0, NULL, 0, | 152 | NULL, 0, NULL, 0, | |
152 | CTL_KERN, CTL_CREATE, CTL_EOL); | 153 | CTL_KERN, CTL_CREATE, CTL_EOL); | |
153 | 154 | |||
154 | if (node == NULL) { | 155 | if (node == NULL) { | |
155 | aprint_error(": can't create sysctl node\n"); | 156 | aprint_error(": can't create sysctl node\n"); | |
156 | return; | 157 | return; | |
157 | } | 158 | } |