From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rob Herring <robh@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH v6 4/5] device property: Constify fwnode_handle_get()
Date: Sat, 9 Apr 2022 00:36:47 +0300 [thread overview]
Message-ID: <YlCq79KveByePxe9@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20220408184844.22829-4-andriy.shevchenko@linux.intel.com>
Hi Andy,
On Fri, Apr 08, 2022 at 09:48:43PM +0300, Andy Shevchenko wrote:
> As to_of_node() suggests and the way the code in the OF and software node
> back ends actually uses the fwnode handle, it may be constified. Do this
> for good.
How?
If the fwnode is const, then the struct it contains must be presumed to be
const, too.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v6: new patch
> drivers/base/property.c | 2 +-
> drivers/base/swnode.c | 2 +-
> drivers/of/property.c | 2 +-
> include/linux/fwnode.h | 2 +-
> include/linux/property.h | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 36401cfe432c..1ad4b37cd312 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -776,7 +776,7 @@ EXPORT_SYMBOL_GPL(device_get_named_child_node);
> *
> * Returns the fwnode handle.
> */
> -struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode)
> +struct fwnode_handle *fwnode_handle_get(const struct fwnode_handle *fwnode)
> {
> if (!fwnode_has_op(fwnode, get))
> return fwnode;
> diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> index b0bbd1805970..84a11008ffb8 100644
> --- a/drivers/base/swnode.c
> +++ b/drivers/base/swnode.c
> @@ -363,7 +363,7 @@ EXPORT_SYMBOL_GPL(property_entries_free);
> /* -------------------------------------------------------------------------- */
> /* fwnode operations */
>
> -static struct fwnode_handle *software_node_get(struct fwnode_handle *fwnode)
> +static struct fwnode_handle *software_node_get(const struct fwnode_handle *fwnode)
> {
> struct swnode *swnode = to_swnode(fwnode);
>
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 9a50ad25906e..8d06282af8e4 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -858,7 +858,7 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node,
> }
> EXPORT_SYMBOL(of_graph_get_remote_node);
>
> -static struct fwnode_handle *of_fwnode_get(struct fwnode_handle *fwnode)
> +static struct fwnode_handle *of_fwnode_get(const struct fwnode_handle *fwnode)
> {
> return of_fwnode_handle(of_node_get(to_of_node(fwnode)));
> }
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index 9a81c4410b9f..a94bd47192a3 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -108,7 +108,7 @@ struct fwnode_reference_args {
> * zero on success, a negative error code otherwise.
> */
> struct fwnode_operations {
> - struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
> + struct fwnode_handle *(*get)(const struct fwnode_handle *fwnode);
> void (*put)(struct fwnode_handle *fwnode);
> bool (*device_is_available)(const struct fwnode_handle *fwnode);
> const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
> diff --git a/include/linux/property.h b/include/linux/property.h
> index fc24d45632eb..c631ee7fd161 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -121,7 +121,7 @@ struct fwnode_handle *fwnode_get_named_child_node(
> struct fwnode_handle *device_get_named_child_node(struct device *dev,
> const char *childname);
>
> -struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
> +struct fwnode_handle *fwnode_handle_get(const struct fwnode_handle *fwnode);
> void fwnode_handle_put(struct fwnode_handle *fwnode);
>
> int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
> --
> 2.35.1
>
--
Sakari Ailus
next prev parent reply other threads:[~2022-04-08 21:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 18:48 [PATCH v6 1/5] device property: Allow error pointer to be passed to fwnode APIs Andy Shevchenko
2022-04-08 18:48 ` [PATCH v6 2/5] device property: Introduce fwnode_for_each_parent_node() Andy Shevchenko
2022-04-29 23:45 ` Doug Anderson
2022-04-08 18:48 ` [PATCH v6 3/5] device property: Drop 'test' prefix in parameters of fwnode_is_ancestor_of() Andy Shevchenko
2022-04-08 18:48 ` [PATCH v6 4/5] device property: Constify fwnode_handle_get() Andy Shevchenko
2022-04-08 21:36 ` Sakari Ailus [this message]
2022-04-10 14:10 ` Andy Shevchenko
2022-04-13 14:35 ` Sakari Ailus
2022-04-13 16:54 ` Andy Shevchenko
2022-04-13 18:21 ` Rafael J. Wysocki
2022-04-09 2:38 ` kernel test robot
2022-04-09 3:39 ` kernel test robot
2022-04-13 18:10 ` Rafael J. Wysocki
2022-04-13 18:19 ` Andy Shevchenko
2022-04-13 18:23 ` Andy Shevchenko
2022-04-13 21:47 ` Sakari Ailus
2022-04-14 13:09 ` Andy Shevchenko
2022-04-15 15:40 ` Rafael J. Wysocki
2022-04-08 18:48 ` [PATCH v6 5/5] device property: Constify fwnode APIs that uses fwnode_get_next_parent() Andy Shevchenko
2022-04-11 13:50 ` [PATCH v6 1/5] device property: Allow error pointer to be passed to fwnode APIs Andy Shevchenko
2022-04-11 14:28 ` Greg Kroah-Hartman
2022-04-11 15:46 ` Andy Shevchenko
2022-04-13 18:06 ` Rafael J. Wysocki
2022-04-13 18:20 ` 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=YlCq79KveByePxe9@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--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=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®