]> git.baikalelectronics.ru Git - kernel.git/commitdiff
driver core: fw_devlink: Allow firmware to mark devices as best effort
authorSaravana Kannan <saravanak@google.com>
Thu, 23 Jun 2022 08:03:42 +0000 (01:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 14:52:25 +0000 (16:52 +0200)
When firmware sets the FWNODE_FLAG_BEST_EFFORT flag for a fwnode,
fw_devlink will do a best effort ordering for that device where it'll
only enforce the probe/suspend/resume ordering of that device with
suppliers that have drivers. The driver of that device can then decide
if it wants to defer probe or probe without the suppliers.

This will be useful for avoid probe delays of the console device that
were caused by commit 6a649ad15f44 ("driver core: Set
fw_devlink.strict=1 by default").

Fixes: 6a649ad15f44 ("driver core: Set fw_devlink.strict=1 by default")
Reported-by: Sascha Hauer <sha@pengutronix.de>
Reported-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20220623080344.783549-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
include/linux/fwnode.h

index 839f64485a5553f8737829825018f97b6ee18fa8..ccdd5b4295dee6cd51958c3c649c5e854cdee83a 100644 (file)
@@ -968,7 +968,8 @@ static void device_links_missing_supplier(struct device *dev)
 
 static bool dev_is_best_effort(struct device *dev)
 {
-       return fw_devlink_best_effort && dev->can_match;
+       return (fw_devlink_best_effort && dev->can_match) ||
+               (dev->fwnode && (dev->fwnode->flags & FWNODE_FLAG_BEST_EFFORT));
 }
 
 /**
index 9a81c4410b9f9b416719c0482e4b5a3cafdbf98b..89b9bdfca925c5a099c91a2534174e0fe7afd0e9 100644 (file)
@@ -27,11 +27,15 @@ struct device;
  *                          driver needs its child devices to be bound with
  *                          their respective drivers as soon as they are
  *                          added.
+ * BEST_EFFORT: The fwnode/device needs to probe early and might be missing some
+ *             suppliers. Only enforce ordering with suppliers that have
+ *             drivers.
  */
 #define FWNODE_FLAG_LINKS_ADDED                        BIT(0)
 #define FWNODE_FLAG_NOT_DEVICE                 BIT(1)
 #define FWNODE_FLAG_INITIALIZED                        BIT(2)
 #define FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD   BIT(3)
+#define FWNODE_FLAG_BEST_EFFORT                        BIT(4)
 
 struct fwnode_handle {
        struct fwnode_handle *secondary;