Merge tag 'module-builtin_driver-v4.1-rc8' of git://git.kernel.org/pub/scm/linux...
[firefly-linux-kernel-4.4.55.git] / include / linux / device.h
index c2d6167cb4a35ed0e3c7402b8312590142ab7c65..5a31bf3a40243e1faff078fdc509361568143f01 100644 (file)
@@ -195,6 +195,34 @@ extern int bus_unregister_notifier(struct bus_type *bus,
 extern struct kset *bus_get_kset(struct bus_type *bus);
 extern struct klist *bus_get_device_klist(struct bus_type *bus);
 
+/**
+ * enum probe_type - device driver probe type to try
+ *     Device drivers may opt in for special handling of their
+ *     respective probe routines. This tells the core what to
+ *     expect and prefer.
+ *
+ * @PROBE_DEFAULT_STRATEGY: Used by drivers that work equally well
+ *     whether probed synchronously or asynchronously.
+ * @PROBE_PREFER_ASYNCHRONOUS: Drivers for "slow" devices which
+ *     probing order is not essential for booting the system may
+ *     opt into executing their probes asynchronously.
+ * @PROBE_FORCE_SYNCHRONOUS: Use this to annotate drivers that need
+ *     their probe routines to run synchronously with driver and
+ *     device registration (with the exception of -EPROBE_DEFER
+ *     handling - re-probing always ends up being done asynchronously).
+ *
+ * Note that the end goal is to switch the kernel to use asynchronous
+ * probing by default, so annotating drivers with
+ * %PROBE_PREFER_ASYNCHRONOUS is a temporary measure that allows us
+ * to speed up boot process while we are validating the rest of the
+ * drivers.
+ */
+enum probe_type {
+       PROBE_DEFAULT_STRATEGY,
+       PROBE_PREFER_ASYNCHRONOUS,
+       PROBE_FORCE_SYNCHRONOUS,
+};
+
 /**
  * struct device_driver - The basic device driver structure
  * @name:      Name of the device driver.
@@ -202,6 +230,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus);
  * @owner:     The module owner.
  * @mod_name:  Used for built-in modules.
  * @suppress_bind_attrs: Disables bind/unbind via sysfs.
+ * @probe_type:        Type of the probe (synchronous or asynchronous) to use.
  * @of_match_table: The open firmware table.
  * @acpi_match_table: The ACPI match table.
  * @probe:     Called to query the existence of a specific device,
@@ -235,6 +264,7 @@ struct device_driver {
        const char              *mod_name;      /* used for built-in modules */
 
        bool suppress_bind_attrs;       /* disables bind/unbind via sysfs */
+       enum probe_type probe_type;
 
        const struct of_device_id       *of_match_table;
        const struct acpi_device_id     *acpi_match_table;
@@ -975,6 +1005,7 @@ extern int __must_check device_bind_driver(struct device *dev);
 extern void device_release_driver(struct device *dev);
 extern int  __must_check device_attach(struct device *dev);
 extern int __must_check driver_attach(struct device_driver *drv);
+extern void device_initial_probe(struct device *dev);
 extern int __must_check device_reprobe(struct device *dev);
 
 /*