driver core: Add fw_devlink.strict kernel param
authorSaravana Kannan <saravanak@google.com>
Fri, 5 Feb 2021 22:26:39 +0000 (14:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Feb 2021 13:31:06 +0000 (14:31 +0100)
This param allows forcing all dependencies to be treated as mandatory.
This will be useful for boards in which all optional dependencies like
IOMMUs and DMAs need to be treated as mandatory dependencies.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20210205222644.2357303-4-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/admin-guide/kernel-parameters.txt
drivers/base/core.c
include/linux/fwnode.h

index a10b545c2070a54455c3e7181cc43135dc68f611..692b6364413394c21c0fff37aade4a5fe6782901 100644 (file)
                                to enforce probe and suspend/resume ordering.
                        rpm --  Like "on", but also use to order runtime PM.
 
+       fw_devlink.strict=<bool>
+                       [KNL] Treat all inferred dependencies as mandatory
+                       dependencies. This only applies for fw_devlink=on|rpm.
+                       Format: <bool>
+
        gamecon.map[2|3]=
                        [HW,JOY] Multisystem joystick and NES/SNES/PSX pad
                        support via parallel port (up to 5 devices per port)
index c95b1daabac71b1d275b18967fee5099f7131a1a..f466ab4f1c350f0c7c405c6a3f30d2439dde79d2 100644 (file)
@@ -1521,6 +1521,13 @@ static int __init fw_devlink_setup(char *arg)
 }
 early_param("fw_devlink", fw_devlink_setup);
 
+static bool fw_devlink_strict;
+static int __init fw_devlink_strict_setup(char *arg)
+{
+       return strtobool(arg, &fw_devlink_strict);
+}
+early_param("fw_devlink.strict", fw_devlink_strict_setup);
+
 u32 fw_devlink_get_flags(void)
 {
        return fw_devlink_flags;
@@ -1531,6 +1538,11 @@ static bool fw_devlink_is_permissive(void)
        return fw_devlink_flags == FW_DEVLINK_FLAGS_PERMISSIVE;
 }
 
+bool fw_devlink_is_strict(void)
+{
+       return fw_devlink_strict && !fw_devlink_is_permissive();
+}
+
 static void fw_devlink_parse_fwnode(struct fwnode_handle *fwnode)
 {
        if (fwnode->flags & FWNODE_FLAG_LINKS_ADDED)
index 21082f11473f33c3dff905738748572889f5eea0..d5caefe39d93056a969b458ef3e00e12dfaba732 100644 (file)
@@ -162,6 +162,7 @@ static inline void fwnode_init(struct fwnode_handle *fwnode,
 }
 
 extern u32 fw_devlink_get_flags(void);
+extern bool fw_devlink_is_strict(void);
 int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup);
 void fwnode_links_purge(struct fwnode_handle *fwnode);