Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2016 17:49:42 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298712 - in head/sys: dev/cardbus kern mips/nlm powerpc/ofw sparc64/pci sys
Message-ID:  <201604271749.u3RHngl6051451@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed Apr 27 17:49:42 2016
New Revision: 298712
URL: https://svnweb.freebsd.org/changeset/base/298712

Log:
  Add a bus_null_rescan() method that always fails with an error.
  
  Use this in place of kobj_error_method to disable BUS_RESCAN() on
  PCI drivers that do not use the "standard" scanning algorithm.

Modified:
  head/sys/dev/cardbus/cardbus.c
  head/sys/kern/subr_bus.c
  head/sys/mips/nlm/xlp_pci.c
  head/sys/powerpc/ofw/ofw_pcibus.c
  head/sys/sparc64/pci/ofw_pcibus.c
  head/sys/sys/bus.h

Modified: head/sys/dev/cardbus/cardbus.c
==============================================================================
--- head/sys/dev/cardbus/cardbus.c	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/dev/cardbus/cardbus.c	Wed Apr 27 17:49:42 2016	(r298712)
@@ -346,7 +346,7 @@ static device_method_t cardbus_methods[]
 	DEVMETHOD(bus_get_dma_tag,	bus_generic_get_dma_tag),
 	DEVMETHOD(bus_read_ivar,	cardbus_read_ivar),
 	DEVMETHOD(bus_driver_added,	cardbus_driver_added),
-	DEVMETHOD(bus_rescan,		kobj_error_method),
+	DEVMETHOD(bus_rescan,		bus_null_rescan),
 
 	/* Card Interface */
 	DEVMETHOD(card_attach_card,	cardbus_attach_card),

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/kern/subr_bus.c	Wed Apr 27 17:49:42 2016	(r298712)
@@ -4289,6 +4289,19 @@ bus_generic_get_domain(device_t dev, dev
 	return (ENOENT);
 }
 
+/**
+ * @brief Helper function for implementing BUS_RESCAN().
+ *
+ * This null implementation of BUS_RESCAN() always fails to indicate
+ * the bus does not support rescanning.
+ */
+int
+bus_null_rescan(device_t dev)
+{
+
+	return (ENXIO);
+}
+
 /*
  * Some convenience functions to make it easier for drivers to use the
  * resource-management functions.  All these really do is hide the

Modified: head/sys/mips/nlm/xlp_pci.c
==============================================================================
--- head/sys/mips/nlm/xlp_pci.c	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/mips/nlm/xlp_pci.c	Wed Apr 27 17:49:42 2016	(r298712)
@@ -154,7 +154,7 @@ static device_method_t xlp_pci_methods[]
 	/* Device interface */
 	DEVMETHOD(device_probe,		xlp_pci_probe),
 	DEVMETHOD(device_attach,	xlp_pci_attach),
-	DEVMETHOD(bus_rescan,		kobj_error_method),
+	DEVMETHOD(bus_rescan,		bus_null_rescan),
 	DEVMETHOD_END
 };
 

Modified: head/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcibus.c	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/powerpc/ofw/ofw_pcibus.c	Wed Apr 27 17:49:42 2016	(r298712)
@@ -77,7 +77,7 @@ static device_method_t ofw_pcibus_method
 	/* Bus interface */
 	DEVMETHOD(bus_child_deleted,	ofw_pcibus_child_deleted),
 	DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_child_pnpinfo_str_method),
-	DEVMETHOD(bus_rescan,		kobj_error_method),
+	DEVMETHOD(bus_rescan,		bus_null_rescan),
 
 	/* PCI interface */
 	DEVMETHOD(pci_alloc_devinfo,	ofw_pcibus_alloc_devinfo),

Modified: head/sys/sparc64/pci/ofw_pcibus.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcibus.c	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/sparc64/pci/ofw_pcibus.c	Wed Apr 27 17:49:42 2016	(r298712)
@@ -81,7 +81,7 @@ static device_method_t ofw_pcibus_method
 	/* Bus interface */
 	DEVMETHOD(bus_child_deleted,	ofw_pcibus_child_deleted),
 	DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_pnpinfo_str),
-	DEVMETHOD(bus_rescan,		kobj_error_method),
+	DEVMETHOD(bus_rescan,		bus_null_rescan),
 
 	/* PCI interface */
 	DEVMETHOD(pci_alloc_devinfo,	ofw_pcibus_alloc_devinfo),

Modified: head/sys/sys/bus.h
==============================================================================
--- head/sys/sys/bus.h	Wed Apr 27 16:39:05 2016	(r298711)
+++ head/sys/sys/bus.h	Wed Apr 27 17:49:42 2016	(r298712)
@@ -430,6 +430,7 @@ int	bus_generic_teardown_intr(device_t d
 				  struct resource *irq, void *cookie);
 int	bus_generic_write_ivar(device_t dev, device_t child, int which,
 			       uintptr_t value);
+int	bus_null_rescan(device_t dev);
 
 /*
  * Wrapper functions for the BUS_*_RESOURCE methods to make client code



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