svn commit: r208005 - in user/imp/masq/sys: kern sys

Warner Losh imp at FreeBSD.org
Wed May 12 21:50:04 UTC 2010


Author: imp
Date: Wed May 12 21:50:03 2010
New Revision: 208005
URL: http://svn.freebsd.org/changeset/base/208005

Log:
  Expand the protocol for reset_attr() so that when it returns EINVAL,
  we won't call the new bus_driver_added() with a NULL parameter for the
  driver.

Modified:
  user/imp/masq/sys/kern/bus_if.m
  user/imp/masq/sys/kern/subr_bus.c
  user/imp/masq/sys/sys/bus.h

Modified: user/imp/masq/sys/kern/bus_if.m
==============================================================================
--- user/imp/masq/sys/kern/bus_if.m	Wed May 12 21:25:05 2010	(r208004)
+++ user/imp/masq/sys/kern/bus_if.m	Wed May 12 21:50:03 2010	(r208005)
@@ -201,13 +201,20 @@ METHOD int write_attr {
  * only be enumerated once).  Buses should make no assumptions about which
  * devices have this called on them, nor the order of the calls.
  *
+ * When this routine returns EINVAL, the bus cannot cope with the new mapping
+ * API.  When the driver returns EINVAL, then bus_add_driver() isn't called
+ * when new mapping data is loaded into the kernel.
+ *
  * @param _dev		the bus which the device to reset
  * @param _child	the child device to reset attributes for
+ *
+ * @retval 0		success
+ * @retval EINVAL	Default return value -- disable mapping
  */
-METHOD void reset_attr {
+METHOD int reset_attr {
 	device_t _dev;
 	device_t _child;
-};
+} DEFAULT bus_generic_reset_attr;
 
 /**
  * @brief Notify a bus that a child was detached

Modified: user/imp/masq/sys/kern/subr_bus.c
==============================================================================
--- user/imp/masq/sys/kern/subr_bus.c	Wed May 12 21:25:05 2010	(r208004)
+++ user/imp/masq/sys/kern/subr_bus.c	Wed May 12 21:50:03 2010	(r208005)
@@ -3385,6 +3385,13 @@ bus_generic_add_child(device_t dev, int 
 	return (device_add_child_ordered(dev, order, name, unit));
 }
 
+int
+bus_generic_reset_attr(device_t dev, device_t child)
+{
+
+	return (EINVAL);
+}
+
 /**
  * @brief Helper function for implementing DEVICE_PROBE()
  *

Modified: user/imp/masq/sys/sys/bus.h
==============================================================================
--- user/imp/masq/sys/sys/bus.h	Wed May 12 21:25:05 2010	(r208004)
+++ user/imp/masq/sys/sys/bus.h	Wed May 12 21:50:03 2010	(r208005)
@@ -319,6 +319,7 @@ bus_dma_tag_t
 struct resource_list *
 	bus_generic_get_resource_list (device_t, device_t);
 void	bus_generic_new_pass(device_t dev);
+int	bus_generic_reset_attr(device_t dev, device_t child);
 int	bus_print_child_header(device_t dev, device_t child);
 int	bus_print_child_footer(device_t dev, device_t child);
 int	bus_generic_print_child(device_t dev, device_t child);


More information about the svn-src-user mailing list