Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jul 2015 04:56:46 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285833 - head/sys/dev/gpio
Message-ID:  <201507240456.t6O4ultr075735@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Jul 24 04:56:46 2015
New Revision: 285833
URL: https://svnweb.freebsd.org/changeset/base/285833

Log:
  Panic when a device is trying to recursively acquire rather than hang
  indefinitely. Improve error messages from other panics.

Modified:
  head/sys/dev/gpio/gpiobus.c

Modified: head/sys/dev/gpio/gpiobus.c
==============================================================================
--- head/sys/dev/gpio/gpiobus.c	Thu Jul 23 23:37:03 2015	(r285832)
+++ head/sys/dev/gpio/gpiobus.c	Fri Jul 24 04:56:46 2015	(r285833)
@@ -564,6 +564,10 @@ gpiobus_acquire_bus(device_t busdev, dev
 	GPIOBUS_ASSERT_UNLOCKED(sc);
 	GPIOBUS_LOCK(sc);
 	if (sc->sc_owner != NULL) {
+		if (sc->sc_owner == child)
+			panic("%s: %s still owns the bus.",
+			    device_get_nameunit(busdev),
+			    device_get_nameunit(child));
 		if (how == GPIOBUS_DONTWAIT) {
 			GPIOBUS_UNLOCK(sc);
 			return (EWOULDBLOCK);
@@ -586,9 +590,14 @@ gpiobus_release_bus(device_t busdev, dev
 	GPIOBUS_ASSERT_UNLOCKED(sc);
 	GPIOBUS_LOCK(sc);
 	if (sc->sc_owner == NULL)
-		panic("gpiobus: releasing unowned bus.");
+		panic("%s: %s releasing unowned bus.",
+		    device_get_nameunit(busdev),
+		    device_get_nameunit(child));
 	if (sc->sc_owner != child)
-		panic("gpiobus: you don't own the bus. game over.");
+		panic("%s: %s trying to release bus owned by %s",
+		    device_get_nameunit(busdev),
+		    device_get_nameunit(child),
+		    device_get_nameunit(sc->sc_owner));
 	sc->sc_owner = NULL;
 	wakeup(sc);
 	GPIOBUS_UNLOCK(sc);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507240456.t6O4ultr075735>