Deleted Added
full compact
gpiobus.c (227849) gpiobus.c (243464)
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 227849 2011-11-22 21:56:55Z hselasky $");
28__FBSDID("$FreeBSD: head/sys/dev/gpio/gpiobus.c 243464 2012-11-23 19:20:38Z gonzo $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/malloc.h>
33#include <sys/module.h>
34#include <sys/kernel.h>
35#include <sys/queue.h>
36#include <sys/sysctl.h>

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

266
267 return (retval);
268}
269
270static int
271gpiobus_child_location_str(device_t bus, device_t child, char *buf,
272 size_t buflen)
273{
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/malloc.h>
33#include <sys/module.h>
34#include <sys/kernel.h>
35#include <sys/queue.h>
36#include <sys/sysctl.h>

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

266
267 return (retval);
268}
269
270static int
271gpiobus_child_location_str(device_t bus, device_t child, char *buf,
272 size_t buflen)
273{
274 // struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
275
276 snprintf(buf, buflen, "pins=?");
277 return (0);
278}
279
280static int
281gpiobus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
282 size_t buflen)

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

344gpiobus_acquire_bus(device_t busdev, device_t child)
345{
346 struct gpiobus_softc *sc;
347
348 sc = device_get_softc(busdev);
349 GPIOBUS_ASSERT_LOCKED(sc);
350
351 if (sc->sc_owner)
274
275 snprintf(buf, buflen, "pins=?");
276 return (0);
277}
278
279static int
280gpiobus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
281 size_t buflen)

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

343gpiobus_acquire_bus(device_t busdev, device_t child)
344{
345 struct gpiobus_softc *sc;
346
347 sc = device_get_softc(busdev);
348 GPIOBUS_ASSERT_LOCKED(sc);
349
350 if (sc->sc_owner)
352 panic("rb_cpldbus: cannot serialize the access to device.");
351 panic("gpiobus: cannot serialize the access to device.");
353 sc->sc_owner = child;
354}
355
356static void
357gpiobus_release_bus(device_t busdev, device_t child)
358{
359 struct gpiobus_softc *sc;
360
361 sc = device_get_softc(busdev);
362 GPIOBUS_ASSERT_LOCKED(sc);
363
364 if (!sc->sc_owner)
352 sc->sc_owner = child;
353}
354
355static void
356gpiobus_release_bus(device_t busdev, device_t child)
357{
358 struct gpiobus_softc *sc;
359
360 sc = device_get_softc(busdev);
361 GPIOBUS_ASSERT_LOCKED(sc);
362
363 if (!sc->sc_owner)
365 panic("rb_cpldbus: releasing unowned bus.");
364 panic("gpiobus: releasing unowned bus.");
366 if (sc->sc_owner != child)
365 if (sc->sc_owner != child)
367 panic("rb_cpldbus: you don't own the bus. game over.");
366 panic("gpiobus: you don't own the bus. game over.");
368
369 sc->sc_owner = NULL;
370}
371
372static int
373gpiobus_pin_setflags(device_t dev, device_t child, uint32_t pin,
374 uint32_t flags)
375{

--- 114 unchanged lines hidden ---
367
368 sc->sc_owner = NULL;
369}
370
371static int
372gpiobus_pin_setflags(device_t dev, device_t child, uint32_t pin,
373 uint32_t flags)
374{

--- 114 unchanged lines hidden ---