lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v6 4/5] device property: Constify fwnode_handle_get()
Date
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.

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
\
 
 \ /
  Last update: 2022-04-08 20:51    [W:0.155 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site