Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Mar 2015 01:49:58 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279620 - head/sys/dev/gpio
Message-ID:  <201503050149.t251nwGQ020097@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Thu Mar  5 01:49:58 2015
New Revision: 279620
URL: https://svnweb.freebsd.org/changeset/base/279620

Log:
  Add a bus_probe_nomatch() method for gpiobus/ofw_gpiobus.
  
  This prints a warning when your system have a hinted child or a FDT child
  node for which you don't have a matching driver:
  
  gpiobus0: <unknown device> at pin(s) 24 irq 24

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

Modified: head/sys/dev/gpio/gpiobus.c
==============================================================================
--- head/sys/dev/gpio/gpiobus.c	Thu Mar  5 00:44:50 2015	(r279619)
+++ head/sys/dev/gpio/gpiobus.c	Thu Mar  5 01:49:58 2015	(r279620)
@@ -53,6 +53,7 @@ static int gpiobus_attach(device_t);
 static int gpiobus_detach(device_t);
 static int gpiobus_suspend(device_t);
 static int gpiobus_resume(device_t);
+static void gpiobus_probe_nomatch(device_t, device_t);
 static int gpiobus_print_child(device_t, device_t);
 static int gpiobus_child_location_str(device_t, device_t, char *, size_t);
 static int gpiobus_child_pnpinfo_str(device_t, device_t, char *, size_t);
@@ -363,6 +364,20 @@ gpiobus_resume(device_t dev)
 	return (bus_generic_resume(dev));
 }
 
+static void
+gpiobus_probe_nomatch(device_t dev, device_t child)
+{
+	char pins[128];
+	struct gpiobus_ivar *devi;
+
+	devi = GPIOBUS_IVAR(child);
+	memset(pins, 0, sizeof(pins));
+	gpiobus_print_pins(devi, pins, sizeof(pins));
+	device_printf(dev, "<unknown device> at pin(s) %s", pins);
+	resource_list_print_type(&devi->rl, "irq", SYS_RES_IRQ, "%ld");
+	printf("\n");
+}
+
 static int
 gpiobus_print_child(device_t dev, device_t child)
 {
@@ -670,6 +685,7 @@ static device_method_t gpiobus_methods[]
 	DEVMETHOD(bus_deactivate_resource,	bus_generic_deactivate_resource),
 	DEVMETHOD(bus_get_resource_list,	gpiobus_get_resource_list),
 	DEVMETHOD(bus_add_child,	gpiobus_add_child),
+	DEVMETHOD(bus_probe_nomatch,	gpiobus_probe_nomatch),
 	DEVMETHOD(bus_print_child,	gpiobus_print_child),
 	DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str),
 	DEVMETHOD(bus_child_location_str, gpiobus_child_location_str),



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