@@ -486,6 +486,26 @@ static bool __of_device_is_fail(const struct device_node *device)
return !strcmp(status, "fail") || !strncmp(status, "fail-", 5);
}
+/**
+ * of_device_is_fail - check if a device has status "fail" or "fail-..."
+ *
+ * @device: Node to check status for
+ *
+ * Return: True if the status property is set to "fail" or "fail-..." (for any
+ * error code suffix), false otherwise
+ */
+bool of_device_is_fail(const struct device_node *device)
+{
+ unsigned long flags;
+ bool res;
+
+ raw_spin_lock_irqsave(&devtree_lock, flags);
+ res = __of_device_is_fail(device);
+ raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ return res;
+}
+EXPORT_SYMBOL(of_device_is_fail);
+
/**
* of_device_is_big_endian - check if a device has BE registers
*
@@ -350,6 +350,7 @@ extern int of_device_is_compatible(const struct device_node *device,
extern int of_device_compatible_match(const struct device_node *device,
const char *const *compat);
extern bool of_device_is_available(const struct device_node *device);
+extern bool of_device_is_fail(const struct device_node *device);
extern bool of_device_is_big_endian(const struct device_node *device);
extern const void *of_get_property(const struct device_node *node,
const char *name,
@@ -584,6 +585,11 @@ static inline bool of_device_is_available(const struct device_node *device)
return false;
}
+static inline bool of_device_is_fail(const struct device_node *device)
+{
+ return false;
+}
+
static inline bool of_device_is_big_endian(const struct device_node *device)
{
return false;
In some cases we want to check that a device is not only unavailable, but specifically marked as "fail". This will be used in a following change in the hardware prober driver. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> --- drivers/of/base.c | 20 ++++++++++++++++++++ include/linux/of.h | 6 ++++++ 2 files changed, 26 insertions(+)