Deleted Added
full compact
gpiobus.c (274670) gpiobus.c (277996)
1/*-
2 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/gpio/gpiobus.c 274670 2014-11-18 17:22:08Z loos $");
28__FBSDID("$FreeBSD: head/sys/dev/gpio/gpiobus.c 277996 2015-01-31 19:32:14Z loos $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/gpio.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>

--- 89 unchanged lines hidden (view full) ---

126 snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
127 range_start, range_stop);
128 else
129 snprintf(tmp, sizeof(tmp) - 1, "%d",
130 range_start);
131 strlcat(buf, tmp, buflen);
132}
133
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/gpio.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>

--- 89 unchanged lines hidden (view full) ---

126 snprintf(tmp, sizeof(tmp) - 1, "%d-%d",
127 range_start, range_stop);
128 else
129 snprintf(tmp, sizeof(tmp) - 1, "%d",
130 range_start);
131 strlcat(buf, tmp, buflen);
132}
133
134device_t
135gpiobus_attach_bus(device_t dev)
136{
137 device_t busdev;
138
139 busdev = device_add_child(dev, "gpiobus", -1);
140 if (busdev == NULL)
141 return (NULL);
142 if (device_add_child(dev, "gpioc", -1) == NULL) {
143 device_delete_child(dev, busdev);
144 return (NULL);
145 }
146 bus_generic_attach(dev);
147
148 return (busdev);
149}
150
134int
151int
152gpiobus_detach_bus(device_t dev)
153{
154
155 return (bus_generic_detach(dev));
156}
157
158int
135gpiobus_init_softc(device_t dev)
136{
137 struct gpiobus_softc *sc;
138
139 sc = GPIOBUS_SOFTC(dev);
140 sc->sc_busdev = dev;
141 sc->sc_dev = device_get_parent(dev);
142 sc->sc_intr_rman.rm_type = RMAN_ARRAY;

--- 492 unchanged lines hidden ---
159gpiobus_init_softc(device_t dev)
160{
161 struct gpiobus_softc *sc;
162
163 sc = GPIOBUS_SOFTC(dev);
164 sc->sc_busdev = dev;
165 sc->sc_dev = device_get_parent(dev);
166 sc->sc_intr_rman.rm_type = RMAN_ARRAY;

--- 492 unchanged lines hidden ---