@@ -845,6 +845,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
}
EXPORT_SYMBOL_GPL(fwnode_device_is_available);
+/**
+ * fwnode_device_is_reserved - check if a device is reserved for use
+ * @fwnode: Pointer to the fwnode of the device.
+ *
+ * For fwnode node types that don't implement the .device_is_reserved()
+ * operation, this function returns false.
+ */
+bool fwnode_device_is_reserved(const struct fwnode_handle *fwnode)
+{
+ if (!fwnode_has_op(fwnode, device_is_reserved))
+ return false;
+
+ return fwnode_call_bool_op(fwnode, device_is_reserved);
+}
+EXPORT_SYMBOL_GPL(fwnode_device_is_reserved);
+
/**
* device_get_child_node_count - return the number of child nodes for device
* @dev: Device to cound the child nodes for
@@ -86,6 +86,7 @@ struct fwnode_reference_args {
* @get: Get a reference to an fwnode.
* @put: Put a reference to an fwnode.
* @device_is_available: Return true if the device is available.
+ * @device_is_reserved: Return true if the device is reserved.
* @device_get_match_data: Return the device driver match data.
* @property_present: Return true if a property is present.
* @property_read_int_array: Read an array of integer properties. Return zero on
@@ -110,6 +111,7 @@ struct fwnode_operations {
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
void (*put)(struct fwnode_handle *fwnode);
bool (*device_is_available)(const struct fwnode_handle *fwnode);
+ bool (*device_is_reserved)(const struct fwnode_handle *fwnode);
const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
const struct device *dev);
bool (*property_present)(const struct fwnode_handle *fwnode,
@@ -50,6 +50,7 @@ int device_property_match_string(struct device *dev,
const char *propname, const char *string);
bool fwnode_device_is_available(const struct fwnode_handle *fwnode);
+bool fwnode_device_is_reserved(const struct fwnode_handle *fwnode);
bool fwnode_property_present(const struct fwnode_handle *fwnode,
const char *propname);
int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode,
This is the fwnode API corresponding to of_device_is_reserved(), which indicates that a device exists but may not be immediately accessible. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> --- drivers/base/property.c | 16 ++++++++++++++++ include/linux/fwnode.h | 2 ++ include/linux/property.h | 1 + 3 files changed, 19 insertions(+)