[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Wed Feb 1 10:57:10 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/200490b02f30
changeset: 330:200490b02f30
user:      ray at terran.dlink.ua
date:      Wed Feb 01 12:53:42 2012 +0200
description:
Fix allocation/deallocation og GPIO pins

diffstat:

 head/sys/dev/gpio/gpiobus.c |  22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r 721f00303e2a -r 200490b02f30 head/sys/dev/gpio/gpiobus.c
--- a/head/sys/dev/gpio/gpiobus.c	Wed Feb 01 12:37:46 2012 +0200
+++ b/head/sys/dev/gpio/gpiobus.c	Wed Feb 01 12:53:42 2012 +0200
@@ -378,6 +378,26 @@
 }
 
 static void
+gpiobus_child_detached(device_t dev, device_t child)
+{
+	struct gpiobus_softc *sc;
+	struct gpiobus_ivar *devi;
+	int pin;
+
+	sc = GPIOBUS_SOFTC(dev);
+	devi = GPIOBUS_IVAR(child);
+
+	if (devi->npins == 0)
+		return;
+
+	for (pin = 0; pin < devi->npins; pin++) {
+		sc->sc_pins[devi->pins[pin]].mapped = 0;
+	}
+
+	free(devi->pins, M_DEVBUF);
+}
+
+static void
 gpiobus_lock_bus(device_t busdev)
 {
 	struct gpiobus_softc *sc;
@@ -713,6 +733,7 @@
 	DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str),
 	DEVMETHOD(bus_child_location_str, gpiobus_child_location_str),
 	DEVMETHOD(bus_hinted_child,	gpiobus_hinted_child),
+	DEVMETHOD(bus_child_detached,	gpiobus_child_detached),
 
 	DEVMETHOD(bus_alloc_resource,	gpiobus_alloc_resource),
 	DEVMETHOD(bus_activate_resource, gpiobus_activate_resource),
@@ -721,7 +742,6 @@
 	DEVMETHOD(bus_setup_intr,	gpiobus_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	gpiobus_teardown_intr),
 
-
 	/* GPIO protocol */
 	DEVMETHOD(gpiobus_lock_bus,	gpiobus_lock_bus),
 	DEVMETHOD(gpiobus_unlock_bus,	gpiobus_unlock_bus),


More information about the Zrouter-src-freebsd mailing list