From: Zev Weiss <zev@bewilderbeest.net>
To: Frank Rowand <frowand.list@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Saravana Kannan <saravanak@google.com>,
Zev Weiss <zev@bewilderbeest.net>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Andrew Jeffery <andrew@aj.id.au>,
openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Daniel Scally <djrscally@gmail.com>,
linux-acpi@vger.kernel.org, Jeremy Kerr <jk@codeconstruct.com.au>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Len Brown <lenb@kernel.org>
Subject: [PATCH 2/5] device property: add fwnode_device_is_reserved()
Date: Thu, 21 Oct 2021 19:00:29 -0700 [thread overview]
Message-ID: <20211022020032.26980-3-zev@bewilderbeest.net> (raw)
In-Reply-To: <20211022020032.26980-1-zev@bewilderbeest.net>
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(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 453918eb7390..7b70cb04531c 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -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
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 9f4ad719bfe3..1a9aefbe12f1 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -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,
diff --git a/include/linux/property.h b/include/linux/property.h
index 357513a977e5..455b022fa612 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -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,
--
2.33.1
next prev parent reply other threads:[~2021-10-22 2:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 2:00 [PATCH 0/5] driver core, of: support for reserved devices Zev Weiss
2021-10-22 2:00 ` [PATCH 1/5] of: base: add function to check for status = "reserved" Zev Weiss
2021-10-22 6:43 ` Greg Kroah-Hartman
2021-10-22 7:38 ` Zev Weiss
2021-10-22 7:45 ` Greg Kroah-Hartman
2021-10-22 2:00 ` Zev Weiss [this message]
2021-10-22 2:00 ` [PATCH 3/5] of: property: add support for fwnode_device_is_reserved() Zev Weiss
2021-10-22 2:00 ` [PATCH 4/5] driver core: inhibit automatic driver binding on reserved devices Zev Weiss
2021-10-22 6:46 ` Greg Kroah-Hartman
2021-10-22 8:32 ` Zev Weiss
2021-10-22 8:57 ` Greg Kroah-Hartman
2021-10-22 15:18 ` Patrick Williams
2021-10-23 8:56 ` Greg Kroah-Hartman
2021-10-25 5:38 ` Frank Rowand
2021-10-25 6:15 ` Greg Kroah-Hartman
2021-10-25 11:44 ` Patrick Williams
2021-10-25 12:58 ` Andy Shevchenko
2021-10-25 13:20 ` Patrick Williams
2021-10-25 13:34 ` Greg Kroah-Hartman
2021-10-25 14:02 ` Patrick Williams
2021-10-25 14:09 ` Greg Kroah-Hartman
2021-10-25 15:54 ` Patrick Williams
2021-10-25 18:36 ` Greg Kroah-Hartman
2021-10-22 16:27 ` Zev Weiss
2021-10-23 8:55 ` Greg Kroah-Hartman
2021-10-22 2:00 ` [PATCH 5/5] of: platform: instantiate " Zev Weiss
2021-10-22 2:58 ` [PATCH 0/5] driver core, of: support for " Rob Herring
2021-10-22 3:13 ` Zev Weiss
2021-10-22 6:50 ` Greg Kroah-Hartman
2021-10-22 6:50 ` Greg Kroah-Hartman
2021-10-22 9:00 ` Zev Weiss
2021-10-22 9:22 ` Greg Kroah-Hartman
2021-10-25 5:53 ` Frank Rowand
2021-10-25 13:57 ` Frank Rowand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211022020032.26980-3-zev@bewilderbeest.net \
--to=zev@bewilderbeest.net \
--cc=andrew@aj.id.au \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=djrscally@gmail.com \
--cc=frowand.list@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jk@codeconstruct.com.au \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=saravanak@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).