Author: ian
Date: Sun Apr  8 17:06:30 2018
New Revision: 332292
URL: https://svnweb.freebsd.org/changeset/base/332292

Log:
  Allow hinted attachment on FDT-based systems.  Instead of returning ENXIO
  when the FDT data doesn't enable the device instance, return
  BUS_PROBE_NOWILDCARD, the same as for non-FDT systems.

Modified:
  head/sys/dev/spibus/spigen.c

Modified: head/sys/dev/spibus/spigen.c
==============================================================================
--- head/sys/dev/spibus/spigen.c        Sun Apr  8 17:03:39 2018        
(r332291)
+++ head/sys/dev/spibus/spigen.c        Sun Apr  8 17:06:30 2018        
(r332292)
@@ -79,16 +79,19 @@ spigen_probe(device_t dev)
 {
        int rv;
 
-#ifdef FDT
-       if (!ofw_bus_status_okay(dev))
-               return (ENXIO);
-
-       if (!ofw_bus_is_compatible(dev, "freebsd,spigen"))
-               return (ENXIO);
-       rv = BUS_PROBE_DEFAULT;
-#else
+       /*
+        * By default we only bid to attach if specifically added by our parent
+        * (usually via hint.spigen.#.at=busname).  On FDT systems we bid as the
+        * default driver based on being configured in the FDT data.
+        */
        rv = BUS_PROBE_NOWILDCARD;
+
+#ifdef FDT
+       if (ofw_bus_status_okay(dev) &&
+           ofw_bus_is_compatible(dev, "freebsd,spigen"))
+                rv = BUS_PROBE_DEFAULT;
 #endif
+
        device_set_desc(dev, "SPI Generic IO");
 
        return (rv);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to