From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>, Michael Walle <michael@walle.cc>
Subject: [PATCH v5 4/4] device property: Constify fwnode APIs that uses fwnode_get_next_parent()
Date: Wed, 6 Apr 2022 16:05:52 +0300 [thread overview]
Message-ID: <20220406130552.30930-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20220406130552.30930-1-andriy.shevchenko@linux.intel.com>
Due to fwnode_get_next_parent() used to be called against the parameters
of some of fwnode APIs those parameters have no const qualifier. However,
after switching to fwnode_for_each_parent_node() API now it's possible to
constify the parameters. Do it for good.
The affected functions are:
fwnode_get_next_parent_dev()
fwnode_get_nth_parent()
fwnode_is_ancestor_of()
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v5: new patch
drivers/base/property.c | 7 +++----
include/linux/property.h | 9 ++++-----
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 839ee7f3ee12..79e0adfa1e24 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -594,7 +594,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_parent);
* The caller of this function is expected to call put_device() on the returned
* device when they are done.
*/
-struct device *fwnode_get_next_parent_dev(struct fwnode_handle *fwnode)
+struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnode)
{
struct fwnode_handle *parent;
struct device *dev;
@@ -639,8 +639,7 @@ EXPORT_SYMBOL_GPL(fwnode_count_parents);
* The caller is responsible for calling fwnode_handle_put() for the returned
* node.
*/
-struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,
- unsigned int depth)
+struct fwnode_handle *fwnode_get_nth_parent(const struct fwnode_handle *fwnode, unsigned int depth)
{
struct fwnode_handle *parent;
@@ -664,7 +663,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_nth_parent);
*
* Returns true if @ancestor is an ancestor of @child. Otherwise, returns false.
*/
-bool fwnode_is_ancestor_of(struct fwnode_handle *ancestor, struct fwnode_handle *child)
+bool fwnode_is_ancestor_of(const struct fwnode_handle *ancestor, const struct fwnode_handle *child)
{
struct fwnode_handle *parent;
diff --git a/include/linux/property.h b/include/linux/property.h
index fc24d45632eb..119bf7d6a02f 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -91,11 +91,10 @@ struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode);
for (parent = fwnode_get_parent(fwnode); parent; \
parent = fwnode_get_next_parent(parent))
-struct device *fwnode_get_next_parent_dev(struct fwnode_handle *fwnode);
-unsigned int fwnode_count_parents(const struct fwnode_handle *fwn);
-struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwn,
- unsigned int depth);
-bool fwnode_is_ancestor_of(struct fwnode_handle *ancestor, struct fwnode_handle *child);
+struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnode);
+unsigned int fwnode_count_parents(const struct fwnode_handle *fwnode);
+struct fwnode_handle *fwnode_get_nth_parent(const struct fwnode_handle *fwnode, unsigned int depth);
+bool fwnode_is_ancestor_of(const struct fwnode_handle *ancestor, const struct fwnode_handle *child);
struct fwnode_handle *fwnode_get_next_child_node(
const struct fwnode_handle *fwnode, struct fwnode_handle *child);
struct fwnode_handle *fwnode_get_next_available_child_node(
--
2.35.1
next prev parent reply other threads:[~2022-04-06 15:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-06 13:05 [PATCH v5 1/4] device property: Allow error pointer to be passed to fwnode APIs Andy Shevchenko
2022-04-06 13:05 ` [PATCH v5 2/4] device property: Introduce fwnode_for_each_parent_node() Andy Shevchenko
2022-04-06 13:26 ` Sakari Ailus
2022-04-06 13:05 ` [PATCH v5 3/4] device property: Drop 'test' prefix in parameters of fwnode_is_ancestor_of() Andy Shevchenko
2022-04-06 13:05 ` Andy Shevchenko [this message]
2022-04-06 17:51 ` [PATCH v5 4/4] device property: Constify fwnode APIs that uses fwnode_get_next_parent() kernel test robot
2022-04-06 19:24 ` kernel test robot
2022-04-07 6:41 ` kernel test robot
2022-04-06 18:05 ` [PATCH v5 1/4] device property: Allow error pointer to be passed to fwnode APIs Michael Walle
2022-04-07 10:19 ` Andy Shevchenko
2022-04-08 12:44 ` Andy Shevchenko
2022-04-08 13:27 ` Sakari Ailus
2022-04-08 14:53 ` Andy Shevchenko
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=20220406130552.30930-4-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@walle.cc \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.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).