* [PATCH 0/7] Constify property fwnode arguments
@ 2017-05-22 9:07 Sakari Ailus
2017-05-22 9:07 ` [PATCH 1/7] ACPI: Constify acpi_get_next_subnode() fwnode argument Sakari Ailus
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Hello everyone,
This set constifies the fwnode arguments in the fwnode property API more
or less the way they are const in OF property API.
Comments are welcome.
The set depends on these patchsets:
<URL:http://www.spinics.net/lists/devicetree/msg177549.html>
<URL:http://www.spinics.net/lists/linux-media/msg114283.html>
<URL:http://marc.info/?l=linux-acpi&m=149544328528001&w=2>
The patches and their dependencies may be also found here:
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=fwnode-const>
(It's uploading right now, so you may need to wait a bit until it's all
up to date.)
Sakari Ailus (7):
ACPI: Constify acpi_get_next_subnode() fwnode argument
ACPI: Constify acpi_bus helper functions, switch to macros
ACPI: Constify internal fwnode arguments
device property: Constify argument to pset fwnode backend
device property: Constify fwnode property API
v4l: fwnode: Constify fwnode endpoints
v4l2-async: Make fwnode const
drivers/acpi/property.c | 90 +++++++++++++++++++---------------
drivers/base/property.c | 91 +++++++++++++++++++----------------
drivers/media/v4l2-core/v4l2-fwnode.c | 12 ++---
drivers/of/property.c | 29 +++++------
include/acpi/acpi_bus.h | 39 +++++++++------
include/linux/acpi.h | 60 ++++++++++++-----------
include/linux/fwnode.h | 25 +++++-----
include/linux/property.h | 58 +++++++++++-----------
include/media/v4l2-async.h | 2 +-
include/media/v4l2-fwnode.h | 6 +--
10 files changed, 226 insertions(+), 186 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/7] ACPI: Constify acpi_get_next_subnode() fwnode argument
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
2017-05-22 9:07 ` [PATCH 2/7] ACPI: Constify acpi_bus helper functions, switch to macros Sakari Ailus
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
This is preparation for making fwnode arguments const for fwnode ops.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/property.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index e90f674..bfa726c 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -900,12 +900,14 @@ int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
struct fwnode_handle *child)
{
- struct acpi_device *adev = to_acpi_device_node(fwnode);
- struct list_head *head, *next;
+ const struct acpi_device *adevc = to_acpi_device_node(fwnode);
+ struct acpi_device *adev = NULL;
+ const struct list_head *head;
+ struct list_head *next;
if (!child || child->type == FWNODE_ACPI) {
- if (adev)
- head = &adev->children;
+ if (adevc)
+ head = &adevc->children;
else
goto nondev;
@@ -928,11 +930,13 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
nondev:
if (!child || child->type == FWNODE_ACPI_DATA) {
- struct acpi_data_node *data = to_acpi_data_node(fwnode);
+ const struct acpi_data_node *data = to_acpi_data_node(fwnode);
struct acpi_data_node *dn;
if (adev)
head = &adev->data.subnodes;
+ else if (adevc)
+ head = &adevc->data.subnodes;
else if (data)
head = &data->data.subnodes;
else
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7] ACPI: Constify acpi_bus helper functions, switch to macros
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
2017-05-22 9:07 ` [PATCH 1/7] ACPI: Constify acpi_get_next_subnode() fwnode argument Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
2017-05-22 9:07 ` [PATCH 3/7] ACPI: Constify internal fwnode arguments Sakari Ailus
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Constify arguments to
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
include/acpi/acpi_bus.h | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 197f3ff..b2e6214 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -394,35 +394,44 @@ struct acpi_data_node {
struct completion kobj_done;
};
-static inline bool is_acpi_node(struct fwnode_handle *fwnode)
+static inline bool is_acpi_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && (fwnode->type == FWNODE_ACPI
|| fwnode->type == FWNODE_ACPI_DATA);
}
-static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
+static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_ACPI;
}
-static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
-{
- return is_acpi_device_node(fwnode) ?
- container_of(fwnode, struct acpi_device, fwnode) : NULL;
-}
-static inline bool is_acpi_data_node(struct fwnode_handle *fwnode)
-{
- return fwnode && fwnode->type == FWNODE_ACPI_DATA;
-}
+#define to_acpi_device_node(__fwnode) \
+ ({ \
+ typeof(__fwnode) __to_acpi_device_node_fwnode = __fwnode; \
+ \
+ is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
+ container_of(__to_acpi_device_node_fwnode, \
+ struct acpi_device, fwnode) : \
+ NULL; \
+ })
-static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode)
+static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode)
{
- return is_acpi_data_node(fwnode) ?
- container_of(fwnode, struct acpi_data_node, fwnode) : NULL;
+ return fwnode && fwnode->type == FWNODE_ACPI_DATA;
}
-static inline bool acpi_data_node_match(struct fwnode_handle *fwnode,
+#define to_acpi_data_node(__fwnode) \
+ ({ \
+ typeof(__fwnode) __to_acpi_data_node_fwnode = __fwnode; \
+ \
+ is_acpi_data_node(__to_acpi_data_node_fwnode) ? \
+ container_of(__to_acpi_data_node_fwnode, \
+ struct acpi_data_node, fwnode) : \
+ NULL; \
+ })
+
+static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode,
const char *name)
{
return is_acpi_data_node(fwnode) ?
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/7] ACPI: Constify internal fwnode arguments
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
2017-05-22 9:07 ` [PATCH 1/7] ACPI: Constify acpi_get_next_subnode() fwnode argument Sakari Ailus
2017-05-22 9:07 ` [PATCH 2/7] ACPI: Constify acpi_bus helper functions, switch to macros Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
2017-05-22 9:07 ` [PATCH 4/7] device property: Constify argument to pset fwnode backend Sakari Ailus
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Constify internal ACPI fwnode arguments in preparation for the same in
fwnode API.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/property.c | 37 ++++++++++++++++++++-----------------
include/linux/acpi.h | 40 ++++++++++++++++++++++------------------
2 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index bfa726c..7ae4ba3b 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -19,7 +19,7 @@
#include "internal.h"
-static int acpi_data_get_property_array(struct acpi_device_data *data,
+static int acpi_data_get_property_array(const struct acpi_device_data *data,
const char *name,
acpi_object_type type,
const union acpi_object **obj);
@@ -418,7 +418,7 @@ void acpi_free_properties(struct acpi_device *adev)
* %-EINVAL if the property doesn't exist,
* %-EPROTO if the property value type doesn't match @type.
*/
-static int acpi_data_get_property(struct acpi_device_data *data,
+static int acpi_data_get_property(const struct acpi_device_data *data,
const char *name, acpi_object_type type,
const union acpi_object **obj)
{
@@ -460,20 +460,21 @@ static int acpi_data_get_property(struct acpi_device_data *data,
* @type: Expected property type.
* @obj: Location to store the property value (if not %NULL).
*/
-int acpi_dev_get_property(struct acpi_device *adev, const char *name,
+int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
acpi_object_type type, const union acpi_object **obj)
{
return adev ? acpi_data_get_property(&adev->data, name, type, obj) : -EINVAL;
}
EXPORT_SYMBOL_GPL(acpi_dev_get_property);
-static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *fwnode)
+static const struct acpi_device_data *
+acpi_device_data_of_node(const struct fwnode_handle *fwnode)
{
if (fwnode->type == FWNODE_ACPI) {
- struct acpi_device *adev = to_acpi_device_node(fwnode);
+ const struct acpi_device *adev = to_acpi_device_node(fwnode);
return &adev->data;
} else if (fwnode->type == FWNODE_ACPI_DATA) {
- struct acpi_data_node *dn = to_acpi_data_node(fwnode);
+ const struct acpi_data_node *dn = to_acpi_data_node(fwnode);
return &dn->data;
}
return NULL;
@@ -485,8 +486,8 @@ static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *f
* @propname: Name of the property.
* @valptr: Location to store a pointer to the property value (if not %NULL).
*/
-int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
- void **valptr)
+int acpi_node_prop_get(const struct fwnode_handle *fwnode,
+ const char *propname, void **valptr)
{
return acpi_data_get_property(acpi_device_data_of_node(fwnode),
propname, ACPI_TYPE_ANY,
@@ -512,7 +513,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
* %-EPROTO if the property is not a package or the type of its elements
* doesn't match @type.
*/
-static int acpi_data_get_property_array(struct acpi_device_data *data,
+static int acpi_data_get_property_array(const struct acpi_device_data *data,
const char *name,
acpi_object_type type,
const union acpi_object **obj)
@@ -572,13 +573,13 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,
*
* Return: %0 on success, negative error code on failure.
*/
-int __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
+int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *propname, size_t index, size_t num_args,
struct acpi_reference_args *args)
{
const union acpi_object *element, *end;
const union acpi_object *obj;
- struct acpi_device_data *data;
+ const struct acpi_device_data *data;
struct acpi_device *device;
int ret, idx = 0;
@@ -674,7 +675,7 @@ int __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
}
EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference);
-static int acpi_data_prop_read_single(struct acpi_device_data *data,
+static int acpi_data_prop_read_single(const struct acpi_device_data *data,
const char *propname,
enum dev_prop_type proptype, void *val)
{
@@ -813,7 +814,7 @@ static int acpi_copy_property_array_string(const union acpi_object *items,
return nval;
}
-static int acpi_data_prop_read(struct acpi_device_data *data,
+static int acpi_data_prop_read(const struct acpi_device_data *data,
const char *propname,
enum dev_prop_type proptype,
void *val, size_t nval)
@@ -867,7 +868,7 @@ static int acpi_data_prop_read(struct acpi_device_data *data,
return ret;
}
-int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
+int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval)
{
return adev ? acpi_data_prop_read(&adev->data, propname, proptype, val, nval) : -EINVAL;
@@ -885,8 +886,9 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
* of the property. Otherwise, read at most @nval values to the array at the
* location pointed to by @val.
*/
-int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
- enum dev_prop_type proptype, void *val, size_t nval)
+int acpi_node_prop_read(const struct fwnode_handle *fwnode,
+ const char *propname, enum dev_prop_type proptype,
+ void *val, size_t nval)
{
return acpi_data_prop_read(acpi_device_data_of_node(fwnode),
propname, proptype, val, nval);
@@ -1044,7 +1046,8 @@ struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
* the child node on success, NULL otherwise.
*/
static struct fwnode_handle *acpi_graph_get_child_prop_value(
- struct fwnode_handle *fwnode, const char *prop_name, unsigned int val)
+ struct fwnode_handle *fwnode, const char *prop_name,
+ unsigned int val)
{
struct fwnode_handle *child;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b8f23c5..b06f31d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1000,13 +1000,14 @@ struct acpi_reference_args {
};
#ifdef CONFIG_ACPI
-int acpi_dev_get_property(struct acpi_device *adev, const char *name,
+int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
acpi_object_type type, const union acpi_object **obj);
-int __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
+int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *name, size_t index, size_t num_args,
struct acpi_reference_args *args);
-static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
+static inline int acpi_node_get_property_reference(
+ const struct fwnode_handle *fwnode,
const char *name, size_t index,
struct acpi_reference_args *args)
{
@@ -1014,13 +1015,15 @@ static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
MAX_ACPI_REFERENCE_ARGS, args);
}
-int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
+int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
void **valptr);
-int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
- enum dev_prop_type proptype, void *val);
-int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname,
- enum dev_prop_type proptype, void *val, size_t nval);
-int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
+int acpi_dev_prop_read_single(struct acpi_device *adev,
+ const char *propname, enum dev_prop_type proptype,
+ void *val);
+int acpi_node_prop_read(const struct fwnode_handle *fwnode,
+ const char *propname, enum dev_prop_type proptype,
+ void *val, size_t nval);
+int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval);
struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
@@ -1097,35 +1100,36 @@ static inline int acpi_dev_get_property(struct acpi_device *adev,
}
static inline int
-__acpi_node_get_property_reference(struct fwnode_handle *fwnode,
+__acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *name, size_t index, size_t num_args,
struct acpi_reference_args *args)
{
return -ENXIO;
}
-static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
- const char *name, size_t index,
- struct acpi_reference_args *args)
+static inline int
+acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
+ const char *name, size_t index,
+ struct acpi_reference_args *args)
{
return -ENXIO;
}
-static inline int acpi_node_prop_get(struct fwnode_handle *fwnode,
+static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,
const char *propname,
void **valptr)
{
return -ENXIO;
}
-static inline int acpi_dev_prop_get(struct acpi_device *adev,
+static inline int acpi_dev_prop_get(const struct acpi_device *adev,
const char *propname,
void **valptr)
{
return -ENXIO;
}
-static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
+static inline int acpi_dev_prop_read_single(const struct acpi_device *adev,
const char *propname,
enum dev_prop_type proptype,
void *val)
@@ -1133,7 +1137,7 @@ static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
return -ENXIO;
}
-static inline int acpi_node_prop_read(struct fwnode_handle *fwnode,
+static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode,
const char *propname,
enum dev_prop_type proptype,
void *val, size_t nval)
@@ -1141,7 +1145,7 @@ static inline int acpi_node_prop_read(struct fwnode_handle *fwnode,
return -ENXIO;
}
-static inline int acpi_dev_prop_read(struct acpi_device *adev,
+static inline int acpi_dev_prop_read(const struct acpi_device *adev,
const char *propname,
enum dev_prop_type proptype,
void *val, size_t nval)
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/7] device property: Constify argument to pset fwnode backend
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
` (2 preceding siblings ...)
2017-05-22 9:07 ` [PATCH 3/7] ACPI: Constify internal fwnode arguments Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
2017-05-22 9:07 ` [PATCH 5/7] device property: Constify fwnode property API Sakari Ailus
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Internally constify pset fwnode backend. Do not touch the pset fwnode
operations yet.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/base/property.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index b311a6f..e0c9489 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -25,19 +25,22 @@ struct property_set {
const struct property_entry *properties;
};
-static inline bool is_pset_node(struct fwnode_handle *fwnode)
+static inline bool is_pset_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA;
}
-static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode)
-{
- return is_pset_node(fwnode) ?
- container_of(fwnode, struct property_set, fwnode) : NULL;
-}
-
-static const struct property_entry *pset_prop_get(struct property_set *pset,
- const char *name)
+#define to_pset_node(__fwnode) \
+ ({ \
+ typeof(__fwnode) fwnode = __fwnode; \
+ \
+ is_pset_node(fwnode) ? \
+ container_of(fwnode, struct property_set, fwnode) : \
+ NULL; \
+ })
+
+static const struct property_entry *
+pset_prop_get(const struct property_set *pset, const char *name)
{
const struct property_entry *prop;
@@ -51,7 +54,7 @@ static const struct property_entry *pset_prop_get(struct property_set *pset,
return NULL;
}
-static const void *pset_prop_find(struct property_set *pset,
+static const void *pset_prop_find(const struct property_set *pset,
const char *propname, size_t length)
{
const struct property_entry *prop;
@@ -71,7 +74,7 @@ static const void *pset_prop_find(struct property_set *pset,
return pointer;
}
-static int pset_prop_read_u8_array(struct property_set *pset,
+static int pset_prop_read_u8_array(const struct property_set *pset,
const char *propname,
u8 *values, size_t nval)
{
@@ -86,7 +89,7 @@ static int pset_prop_read_u8_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u16_array(struct property_set *pset,
+static int pset_prop_read_u16_array(const struct property_set *pset,
const char *propname,
u16 *values, size_t nval)
{
@@ -101,7 +104,7 @@ static int pset_prop_read_u16_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u32_array(struct property_set *pset,
+static int pset_prop_read_u32_array(const struct property_set *pset,
const char *propname,
u32 *values, size_t nval)
{
@@ -116,7 +119,7 @@ static int pset_prop_read_u32_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u64_array(struct property_set *pset,
+static int pset_prop_read_u64_array(const struct property_set *pset,
const char *propname,
u64 *values, size_t nval)
{
@@ -131,7 +134,7 @@ static int pset_prop_read_u64_array(struct property_set *pset,
return 0;
}
-static int pset_prop_count_elems_of_size(struct property_set *pset,
+static int pset_prop_count_elems_of_size(const struct property_set *pset,
const char *propname, size_t length)
{
const struct property_entry *prop;
@@ -143,7 +146,7 @@ static int pset_prop_count_elems_of_size(struct property_set *pset,
return prop->length / length;
}
-static int pset_prop_read_string_array(struct property_set *pset,
+static int pset_prop_read_string_array(const struct property_set *pset,
const char *propname,
const char **strings, size_t nval)
{
@@ -217,8 +220,8 @@ static int pset_fwnode_read_int_array(
}
static int pset_fwnode_property_read_string_array(
- struct fwnode_handle *fwnode, const char *propname, const char **val,
- size_t nval)
+ struct fwnode_handle *fwnode, const char *propname,
+ const char **val, size_t nval)
{
return pset_prop_read_string_array(to_pset_node(fwnode), propname,
val, nval);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7] device property: Constify fwnode property API
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
` (3 preceding siblings ...)
2017-05-22 9:07 ` [PATCH 4/7] device property: Constify argument to pset fwnode backend Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
2017-05-22 9:07 ` [PATCH 6/7] v4l: fwnode: Constify fwnode endpoints Sakari Ailus
[not found] ` <1495444062-23867-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Make fwnode arguments to the fwnode property API const.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/acpi/property.c | 39 +++++++++++++++++++-------------
drivers/base/property.c | 54 +++++++++++++++++++++++---------------------
drivers/of/property.c | 29 ++++++++++++------------
include/linux/acpi.h | 20 +++++++++--------
include/linux/fwnode.h | 25 +++++++++++----------
include/linux/property.h | 58 +++++++++++++++++++++++++-----------------------
6 files changed, 121 insertions(+), 104 deletions(-)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 7ae4ba3b..a518f4c 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -899,7 +899,7 @@ int acpi_node_prop_read(const struct fwnode_handle *fwnode,
* @fwnode: Firmware node to find the next child node for.
* @child: Handle to one of the device's child nodes or a null handle.
*/
-struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
+struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
struct fwnode_handle *child)
{
const struct acpi_device *adevc = to_acpi_device_node(fwnode);
@@ -969,7 +969,7 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
* Returns parent node of an ACPI device or data firmware node or %NULL if
* not available.
*/
-struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode)
+struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode)
{
if (is_acpi_data_node(fwnode)) {
/* All data nodes have parent pointer so just return that */
@@ -998,8 +998,8 @@ struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode)
* %NULL if there is no next endpoint, ERR_PTR() in case of error. In case
* of success the next endpoint is returned.
*/
-struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
- struct fwnode_handle *prev)
+struct fwnode_handle *acpi_graph_get_next_endpoint(
+ const struct fwnode_handle *fwnode, struct fwnode_handle *prev)
{
struct fwnode_handle *port = NULL;
struct fwnode_handle *endpoint;
@@ -1076,17 +1076,18 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value(
* fields requested by the caller. Returns %0 in case of success and
* negative errno otherwise.
*/
-int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
+int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode,
struct fwnode_handle **parent,
struct fwnode_handle **port,
struct fwnode_handle **endpoint)
{
+ struct fwnode_handle *fwnode;
unsigned int port_nr, endpoint_nr;
struct acpi_reference_args args;
int ret;
memset(&args, 0, sizeof(args));
- ret = acpi_node_get_property_reference(fwnode, "remote-endpoint", 0,
+ ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0,
&args);
if (ret)
return ret;
@@ -1128,7 +1129,7 @@ int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
return 0;
}
-static bool acpi_fwnode_device_is_available(struct fwnode_handle *fwnode)
+static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
{
if (!is_acpi_device_node(fwnode))
return false;
@@ -1136,14 +1137,14 @@ static bool acpi_fwnode_device_is_available(struct fwnode_handle *fwnode)
return acpi_device_is_present(to_acpi_device_node(fwnode));
}
-static bool acpi_fwnode_property_present(struct fwnode_handle *fwnode,
+static bool acpi_fwnode_property_present(const struct fwnode_handle *fwnode,
const char *propname)
{
return !acpi_node_prop_get(fwnode, propname, NULL);
}
static int acpi_fwnode_property_read_int_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
unsigned int elem_size, void *val, size_t nval)
{
enum dev_prop_type type;
@@ -1169,15 +1170,21 @@ static int acpi_fwnode_property_read_int_array(
}
static int acpi_fwnode_property_read_string_array(
- struct fwnode_handle *fwnode, const char *propname, const char **val,
- size_t nval)
+ const struct fwnode_handle *fwnode, const char *propname,
+ const char **val, size_t nval)
{
return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING,
val, nval);
}
+static struct fwnode_handle *
+acpi_fwnode_get_parent(struct fwnode_handle *fwnode)
+{
+ return acpi_node_get_parent(fwnode);
+}
+
static struct fwnode_handle *acpi_fwnode_get_named_child_node(
- struct fwnode_handle *fwnode, const char *childname)
+ const struct fwnode_handle *fwnode, const char *childname)
{
struct fwnode_handle *child;
@@ -1193,7 +1200,7 @@ static struct fwnode_handle *acpi_fwnode_get_named_child_node(
}
static struct fwnode_handle *acpi_fwnode_graph_get_next_endpoint(
- struct fwnode_handle *fwnode, struct fwnode_handle *prev)
+ const struct fwnode_handle *fwnode, struct fwnode_handle *prev)
{
struct fwnode_handle *endpoint;
@@ -1205,7 +1212,7 @@ static struct fwnode_handle *acpi_fwnode_graph_get_next_endpoint(
}
static struct fwnode_handle *acpi_fwnode_graph_get_remote_endpoint(
- struct fwnode_handle *fwnode)
+ const struct fwnode_handle *fwnode)
{
struct fwnode_handle *endpoint = NULL;
@@ -1214,7 +1221,7 @@ static struct fwnode_handle *acpi_fwnode_graph_get_remote_endpoint(
return endpoint;
}
-static int acpi_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
+static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint)
{
struct fwnode_handle *port_fwnode = fwnode_get_parent(fwnode);
@@ -1237,6 +1244,6 @@ const struct fwnode_operations acpi_fwnode_ops = {
.get_named_child_node = acpi_fwnode_get_named_child_node,
.graph_get_next_endpoint = acpi_fwnode_graph_get_next_endpoint,
.graph_get_remote_endpoint = acpi_fwnode_graph_get_remote_endpoint,
- .graph_get_port_parent = acpi_node_get_parent,
+ .graph_get_port_parent = acpi_fwnode_get_parent,
.graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint,
};
diff --git a/drivers/base/property.c b/drivers/base/property.c
index e0c9489..c00192e 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -190,17 +190,17 @@ struct fwnode_handle *dev_fwnode(struct device *dev)
}
EXPORT_SYMBOL_GPL(dev_fwnode);
-static bool pset_fwnode_property_present(struct fwnode_handle *fwnode,
+static bool pset_fwnode_property_present(const struct fwnode_handle *fwnode,
const char *propname)
{
return !!pset_prop_get(to_pset_node(fwnode), propname);
}
static int pset_fwnode_read_int_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
unsigned int elem_size, void *val, size_t nval)
{
- struct property_set *node = to_pset_node(fwnode);
+ const struct property_set *node = to_pset_node(fwnode);
if (!val)
return pset_prop_count_elems_of_size(node, propname, elem_size);
@@ -220,7 +220,7 @@ static int pset_fwnode_read_int_array(
}
static int pset_fwnode_property_read_string_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
const char **val, size_t nval)
{
return pset_prop_read_string_array(to_pset_node(fwnode), propname,
@@ -251,7 +251,8 @@ EXPORT_SYMBOL_GPL(device_property_present);
* @fwnode: Firmware node whose property to check
* @propname: Name of the property
*/
-bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
+bool fwnode_property_present(const struct fwnode_handle *fwnode,
+ const char *propname)
{
bool ret;
@@ -434,7 +435,7 @@ int device_property_match_string(struct device *dev, const char *propname,
EXPORT_SYMBOL_GPL(device_property_match_string);
static int fwnode_property_read_int_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
unsigned int elem_size, void *val, size_t nval)
{
int ret;
@@ -468,7 +469,7 @@ static int fwnode_property_read_int_array(
* %-EOVERFLOW if the size of the property is not as expected,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode,
const char *propname, u8 *val, size_t nval)
{
return fwnode_property_read_int_array(fwnode, propname, sizeof(u8),
@@ -494,7 +495,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u8_array);
* %-EOVERFLOW if the size of the property is not as expected,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_u16_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode,
const char *propname, u16 *val, size_t nval)
{
return fwnode_property_read_int_array(fwnode, propname, sizeof(u16),
@@ -520,7 +521,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u16_array);
* %-EOVERFLOW if the size of the property is not as expected,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_u32_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode,
const char *propname, u32 *val, size_t nval)
{
return fwnode_property_read_int_array(fwnode, propname, sizeof(u32),
@@ -546,7 +547,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u32_array);
* %-EOVERFLOW if the size of the property is not as expected,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_u64_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode,
const char *propname, u64 *val, size_t nval)
{
return fwnode_property_read_int_array(fwnode, propname, sizeof(u64),
@@ -572,7 +573,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u64_array);
* %-EOVERFLOW if the size of the property is not as expected,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
const char *propname, const char **val,
size_t nval)
{
@@ -604,7 +605,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_string_array);
* %-EPROTO or %-EILSEQ if the property is not a string,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_read_string(struct fwnode_handle *fwnode,
+int fwnode_property_read_string(const struct fwnode_handle *fwnode,
const char *propname, const char **val)
{
int ret = fwnode_property_read_string_array(fwnode, propname, val, 1);
@@ -628,7 +629,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_string);
* %-EPROTO if the property is not an array of strings,
* %-ENXIO if no suitable firmware interface is present.
*/
-int fwnode_property_match_string(struct fwnode_handle *fwnode,
+int fwnode_property_match_string(const struct fwnode_handle *fwnode,
const char *propname, const char *string)
{
const char **values;
@@ -936,7 +937,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_parent);
* Return parent firmware node of the given node if possible or %NULL if no
* parent was available.
*/
-struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode)
+struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode)
{
return fwnode_call_ptr_op(fwnode, get_parent);
}
@@ -947,8 +948,9 @@ EXPORT_SYMBOL_GPL(fwnode_get_parent);
* @fwnode: Firmware node to find the next child node for.
* @child: Handle to one of the node's child nodes or a %NULL handle.
*/
-struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode,
- struct fwnode_handle *child)
+struct fwnode_handle *
+fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
+ struct fwnode_handle *child)
{
return fwnode_call_ptr_op(fwnode, get_next_child_node, child);
}
@@ -979,8 +981,9 @@ EXPORT_SYMBOL_GPL(device_get_next_child_node);
* @fwnode: Firmware node to find the named child node for.
* @childname: String to match child node name against.
*/
-struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode,
- const char *childname)
+struct fwnode_handle *
+fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
+ const char *childname)
{
return fwnode_call_ptr_op(fwnode, get_named_child_node, childname);
}
@@ -1026,7 +1029,7 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);
* fwnode_device_is_available - check if a device is available for use
* @fwnode: Pointer to the fwnode of the device.
*/
-bool fwnode_device_is_available(struct fwnode_handle *fwnode)
+bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
{
return fwnode_call_int_op(fwnode, device_is_available);
}
@@ -1164,7 +1167,7 @@ EXPORT_SYMBOL(device_get_mac_address);
* are available.
*/
struct fwnode_handle *
-fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
+fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle *prev)
{
return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev);
@@ -1178,7 +1181,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
* Extracts firmware node of a remote device the @fwnode points to.
*/
struct fwnode_handle *
-fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode)
+fwnode_graph_get_remote_port_parent(const struct fwnode_handle *fwnode)
{
struct fwnode_handle *port, *parent;
@@ -1197,7 +1200,8 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port_parent);
*
* Extracts firmware node of a remote port the @fwnode points to.
*/
-struct fwnode_handle *fwnode_graph_get_remote_port(struct fwnode_handle *fwnode)
+struct fwnode_handle *
+fwnode_graph_get_remote_port(const struct fwnode_handle *fwnode)
{
return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode));
}
@@ -1210,7 +1214,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port);
* Extracts firmware node of a remote endpoint the @fwnode points to.
*/
struct fwnode_handle *
-fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode)
+fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
{
return fwnode_call_ptr_op(fwnode, graph_get_remote_endpoint);
}
@@ -1226,7 +1230,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_endpoint);
* to @node. Use fwnode_node_put() on it when done.
*/
struct fwnode_handle *fwnode_graph_get_remote_node(
- struct fwnode_handle *fwnode, u32 port_id, u32 endpoint_id)
+ const struct fwnode_handle *fwnode, u32 port_id, u32 endpoint_id)
{
struct fwnode_handle *endpoint = NULL;
@@ -1262,7 +1266,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_node);
* information in @endpoint. The caller must hold a reference to
* @fwnode.
*/
-int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
+int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint)
{
memset(endpoint, 0, sizeof(*endpoint));
diff --git a/drivers/of/property.c b/drivers/of/property.c
index d3ca942..8a15c70 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -772,22 +772,22 @@ static void of_fwnode_put(struct fwnode_handle *fwnode)
of_node_put(to_of_node(fwnode));
}
-static bool of_fwnode_device_is_available(struct fwnode_handle *fwnode)
+static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode)
{
return of_device_is_available(to_of_node(fwnode));
}
-static bool of_fwnode_property_present(struct fwnode_handle *fwnode,
+static bool of_fwnode_property_present(const struct fwnode_handle *fwnode,
const char *propname)
{
return of_property_read_bool(to_of_node(fwnode), propname);
}
static int of_fwnode_property_read_int_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
unsigned int elem_size, void *val, size_t nval)
{
- struct device_node *node = to_of_node(fwnode);
+ const struct device_node *node = to_of_node(fwnode);
if (!val)
return of_property_count_elems_of_size(node, propname,
@@ -808,32 +808,33 @@ static int of_fwnode_property_read_int_array(
}
static int of_fwnode_property_read_string_array(
- struct fwnode_handle *fwnode, const char *propname,
+ const struct fwnode_handle *fwnode, const char *propname,
const char **val, size_t nval)
{
- struct device_node *node = to_of_node(fwnode);
+ const struct device_node *node = to_of_node(fwnode);
return val ?
of_property_read_string_array(node, propname, val, nval) :
of_property_count_strings(node, propname);
}
-static struct fwnode_handle *of_fwnode_get_parent(struct fwnode_handle *fwnode)
+static struct fwnode_handle *of_fwnode_get_parent(
+ const struct fwnode_handle *fwnode)
{
return of_fwnode_handle(of_get_parent(to_of_node(fwnode)));
}
static struct fwnode_handle *of_fwnode_get_next_child_node(
- struct fwnode_handle *fwnode, struct fwnode_handle *child)
+ const struct fwnode_handle *fwnode, struct fwnode_handle *child)
{
return of_fwnode_handle(of_get_next_available_child(to_of_node(fwnode),
to_of_node(child)));
}
static struct fwnode_handle *of_fwnode_get_named_child_node(
- struct fwnode_handle *fwnode, const char *childname)
+ const struct fwnode_handle *fwnode, const char *childname)
{
- struct device_node *node = to_of_node(fwnode);
+ const struct device_node *node = to_of_node(fwnode);
struct device_node *child;
for_each_available_child_of_node(node, child)
@@ -844,14 +845,14 @@ static struct fwnode_handle *of_fwnode_get_named_child_node(
}
static struct fwnode_handle *of_fwnode_graph_get_next_endpoint(
- struct fwnode_handle *fwnode, struct fwnode_handle *prev)
+ const struct fwnode_handle *fwnode, struct fwnode_handle *prev)
{
return of_fwnode_handle(of_graph_get_next_endpoint(to_of_node(fwnode),
to_of_node(prev)));
}
static struct fwnode_handle *of_fwnode_graph_get_remote_endpoint(
- struct fwnode_handle *fwnode)
+ const struct fwnode_handle *fwnode)
{
return of_fwnode_handle(of_parse_phandle(to_of_node(fwnode),
"remote-endpoint", 0));
@@ -874,10 +875,10 @@ static struct fwnode_handle *of_fwnode_graph_get_port_parent(
return of_fwnode_handle(of_get_next_parent(np));
}
-static int of_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
+static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint)
{
- struct device_node *node = to_of_node(fwnode);
+ const struct device_node *node = to_of_node(fwnode);
struct device_node *port_node = of_get_parent(node);
endpoint->local_fwnode = fwnode;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b06f31d..65f67166 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1026,13 +1026,14 @@ int acpi_node_prop_read(const struct fwnode_handle *fwnode,
int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval);
-struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
+struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
struct fwnode_handle *child);
-struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode);
+struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode);
-struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
- struct fwnode_handle *prev);
-int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
+struct fwnode_handle *
+acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
+ struct fwnode_handle *prev);
+int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle **remote,
struct fwnode_handle **port,
struct fwnode_handle **endpoint);
@@ -1154,26 +1155,27 @@ static inline int acpi_dev_prop_read(const struct acpi_device *adev,
}
static inline struct fwnode_handle *
-acpi_get_next_subnode(struct fwnode_handle *fwnode, struct fwnode_handle *child)
+acpi_get_next_subnode(const struct fwnode_handle *fwnode,
+ struct fwnode_handle *child)
{
return NULL;
}
static inline struct fwnode_handle *
-acpi_node_get_parent(struct fwnode_handle *fwnode)
+acpi_node_get_parent(const struct fwnode_handle *fwnode)
{
return NULL;
}
static inline struct fwnode_handle *
-acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode,
+acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle *prev)
{
return ERR_PTR(-ENXIO);
}
static inline int
-acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
+acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle **remote,
struct fwnode_handle **port,
struct fwnode_handle **endpoint)
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 2100644..0229f8e 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -66,28 +66,29 @@ struct fwnode_endpoint {
struct fwnode_operations {
void (*get)(struct fwnode_handle *fwnode);
void (*put)(struct fwnode_handle *fwnode);
- bool (*device_is_available)(struct fwnode_handle *fwnode);
- bool (*property_present)(struct fwnode_handle *fwnode,
+ bool (*device_is_available)(const struct fwnode_handle *fwnode);
+ bool (*property_present)(const struct fwnode_handle *fwnode,
const char *propname);
- int (*property_read_int_array)(struct fwnode_handle *fwnode,
+ int (*property_read_int_array)(const struct fwnode_handle *fwnode,
const char *propname,
unsigned int elem_size, void *val,
size_t nval);
- int (*property_read_string_array)(struct fwnode_handle *fwnode_handle,
- const char *propname,
- const char **val, size_t nval);
- struct fwnode_handle *(*get_parent)(struct fwnode_handle *fwnode);
+ int (*property_read_string_array)(
+ const struct fwnode_handle *fwnode_handle,
+ const char *propname, const char **val, size_t nval);
+ struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode);
struct fwnode_handle *(*get_next_child_node)(
- struct fwnode_handle *fwnode, struct fwnode_handle *child);
+ const struct fwnode_handle *fwnode,
+ struct fwnode_handle *child);
struct fwnode_handle *(*get_named_child_node)(
- struct fwnode_handle *fwnode, const char *name);
+ const struct fwnode_handle *fwnode, const char *name);
struct fwnode_handle *(*graph_get_next_endpoint)(
- struct fwnode_handle *fwnode, struct fwnode_handle *prev);
+ const struct fwnode_handle *fwnode, struct fwnode_handle *prev);
struct fwnode_handle *(*graph_get_remote_endpoint)(
- struct fwnode_handle *fwnode);
+ const struct fwnode_handle *fwnode);
struct fwnode_handle *(*graph_get_port_parent)(
struct fwnode_handle *fwnode);
- int (*graph_parse_endpoint)(struct fwnode_handle *fwnode,
+ int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);
};
diff --git a/include/linux/property.h b/include/linux/property.h
index b9f4838..dd457cc 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -51,46 +51,48 @@ int device_property_read_string(struct device *dev, const char *propname,
int device_property_match_string(struct device *dev,
const char *propname, const char *string);
-bool fwnode_device_is_available(struct fwnode_handle *fwnode);
-bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname);
-int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
+bool fwnode_device_is_available(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,
const char *propname, u8 *val,
size_t nval);
-int fwnode_property_read_u16_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode,
const char *propname, u16 *val,
size_t nval);
-int fwnode_property_read_u32_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode,
const char *propname, u32 *val,
size_t nval);
-int fwnode_property_read_u64_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode,
const char *propname, u64 *val,
size_t nval);
-int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
+int fwnode_property_read_string_array(const struct fwnode_handle *fwnode,
const char *propname, const char **val,
size_t nval);
-int fwnode_property_read_string(struct fwnode_handle *fwnode,
+int fwnode_property_read_string(const struct fwnode_handle *fwnode,
const char *propname, const char **val);
-int fwnode_property_match_string(struct fwnode_handle *fwnode,
+int fwnode_property_match_string(const struct fwnode_handle *fwnode,
const char *propname, const char *string);
-struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode);
-struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode);
-struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode,
- struct fwnode_handle *child);
+struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode);
+struct fwnode_handle *fwnode_get_next_parent(
+ struct fwnode_handle *fwnode);
+struct fwnode_handle *fwnode_get_next_child_node(
+ const struct fwnode_handle *fwnode, struct fwnode_handle *child);
#define fwnode_for_each_child_node(fwnode, child) \
for (child = fwnode_get_next_child_node(fwnode, NULL); child; \
child = fwnode_get_next_child_node(fwnode, child))
-struct fwnode_handle *device_get_next_child_node(struct device *dev,
- struct fwnode_handle *child);
+struct fwnode_handle *device_get_next_child_node(
+ struct device *dev, struct fwnode_handle *child);
#define device_for_each_child_node(dev, child) \
for (child = device_get_next_child_node(dev, NULL); child; \
child = device_get_next_child_node(dev, child))
-struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode,
- const char *childname);
+struct fwnode_handle *fwnode_get_named_child_node(
+ const struct fwnode_handle *fwnode, const char *childname);
struct fwnode_handle *device_get_named_child_node(struct device *dev,
const char *childname);
@@ -129,31 +131,31 @@ static inline int device_property_read_u64(struct device *dev,
return device_property_read_u64_array(dev, propname, val, 1);
}
-static inline bool fwnode_property_read_bool(struct fwnode_handle *fwnode,
+static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode,
const char *propname)
{
return fwnode_property_present(fwnode, propname);
}
-static inline int fwnode_property_read_u8(struct fwnode_handle *fwnode,
+static inline int fwnode_property_read_u8(const struct fwnode_handle *fwnode,
const char *propname, u8 *val)
{
return fwnode_property_read_u8_array(fwnode, propname, val, 1);
}
-static inline int fwnode_property_read_u16(struct fwnode_handle *fwnode,
+static inline int fwnode_property_read_u16(const struct fwnode_handle *fwnode,
const char *propname, u16 *val)
{
return fwnode_property_read_u16_array(fwnode, propname, val, 1);
}
-static inline int fwnode_property_read_u32(struct fwnode_handle *fwnode,
+static inline int fwnode_property_read_u32(const struct fwnode_handle *fwnode,
const char *propname, u32 *val)
{
return fwnode_property_read_u32_array(fwnode, propname, val, 1);
}
-static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode,
+static inline int fwnode_property_read_u64(const struct fwnode_handle *fwnode,
const char *propname, u64 *val)
{
return fwnode_property_read_u64_array(fwnode, propname, val, 1);
@@ -274,17 +276,17 @@ int device_get_phy_mode(struct device *dev);
void *device_get_mac_address(struct device *dev, char *addr, int alen);
struct fwnode_handle *fwnode_graph_get_next_endpoint(
- struct fwnode_handle *fwnode, struct fwnode_handle *prev);
+ const struct fwnode_handle *fwnode, struct fwnode_handle *prev);
struct fwnode_handle *fwnode_graph_get_remote_port_parent(
- struct fwnode_handle *fwnode);
+ const struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_port(
- struct fwnode_handle *fwnode);
+ const struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_endpoint(
- struct fwnode_handle *fwnode);
+ const struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_node(
- struct fwnode_handle *fwnode, u32 port, u32 endpoint);
+ const struct fwnode_handle *fwnode, u32 port, u32 endpoint);
-int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
+int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);
#endif /* _LINUX_PROPERTY_H_ */
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/7] v4l: fwnode: Constify fwnode endpoints
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
` (4 preceding siblings ...)
2017-05-22 9:07 ` [PATCH 5/7] device property: Constify fwnode property API Sakari Ailus
@ 2017-05-22 9:07 ` Sakari Ailus
[not found] ` <1495444062-23867-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
6 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi
Cc: devicetree, sudeep.holla, lorenzo.pieralisi, mika.westerberg,
rafael, mark.rutland, broonie, robh, ahs3, frowand.list
Make the fwnode arguments to V4L2 fwnode API const as this is now
possible.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/v4l2-core/v4l2-fwnode.c | 12 ++++++------
include/media/v4l2-fwnode.h | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 153c53c..a68ed05 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -28,8 +28,8 @@
#include <media/v4l2-fwnode.h>
-static int v4l2_fwnode_endpoint_parse_csi_bus(struct fwnode_handle *fwnode,
- struct v4l2_fwnode_endpoint *vep)
+static int v4l2_fwnode_endpoint_parse_csi_bus(
+ const struct fwnode_handle *fwnode, struct v4l2_fwnode_endpoint *vep)
{
struct v4l2_fwnode_bus_mipi_csi2 *bus = &vep->bus.mipi_csi2;
bool have_clk_lane = false;
@@ -97,7 +97,7 @@ static int v4l2_fwnode_endpoint_parse_csi_bus(struct fwnode_handle *fwnode,
}
static void v4l2_fwnode_endpoint_parse_parallel_bus(
- struct fwnode_handle *fwnode, struct v4l2_fwnode_endpoint *vep)
+ const struct fwnode_handle *fwnode, struct v4l2_fwnode_endpoint *vep)
{
struct v4l2_fwnode_bus_parallel *bus = &vep->bus.parallel;
unsigned int flags = 0;
@@ -165,7 +165,7 @@ static void v4l2_fwnode_endpoint_parse_parallel_bus(
*
* Return: 0 on success or a negative error code on failure.
*/
-int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
+int v4l2_fwnode_endpoint_parse(const struct fwnode_handle *fwnode,
struct v4l2_fwnode_endpoint *vep)
{
int rval;
@@ -232,7 +232,7 @@ EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_free);
* on error.
*/
struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(
- struct fwnode_handle *fwnode)
+ const struct fwnode_handle *fwnode)
{
struct v4l2_fwnode_endpoint *vep;
int rval;
@@ -291,7 +291,7 @@ EXPORT_SYMBOL_GPL(v4l2_fwnode_endpoint_alloc_parse);
* Return: 0 on success, or -ENOLINK if the remote endpoint fwnode can't be
* found.
*/
-int v4l2_fwnode_parse_link(struct fwnode_handle *__fwnode,
+int v4l2_fwnode_parse_link(const struct fwnode_handle *__fwnode,
struct v4l2_fwnode_link *link)
{
const char *port_prop = is_of_node(__fwnode) ? "reg" : "port";
diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
index ecc1233..bdbd785 100644
--- a/include/media/v4l2-fwnode.h
+++ b/include/media/v4l2-fwnode.h
@@ -92,12 +92,12 @@ struct v4l2_fwnode_link {
unsigned int remote_port;
};
-int v4l2_fwnode_endpoint_parse(struct fwnode_handle *fwnode,
+int v4l2_fwnode_endpoint_parse(const struct fwnode_handle *fwnode,
struct v4l2_fwnode_endpoint *vep);
struct v4l2_fwnode_endpoint *v4l2_fwnode_endpoint_alloc_parse(
- struct fwnode_handle *fwnode);
+ const struct fwnode_handle *fwnode);
void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep);
-int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
+int v4l2_fwnode_parse_link(const struct fwnode_handle *fwnode,
struct v4l2_fwnode_link *link);
void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link);
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/7] v4l2-async: Make fwnode const
[not found] ` <1495444062-23867-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-05-22 9:07 ` Sakari Ailus
0 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2017-05-22 9:07 UTC (permalink / raw)
To: linux-acpi-u79uwXL29TY76Z2rM5mHXA
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, sudeep.holla-5wv7dgnIgG8,
lorenzo.pieralisi-5wv7dgnIgG8,
mika.westerberg-VuQAYsv1563Yd54FQh9/CA,
rafael-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
broonie-DgEjT+Ai2ygdnm+yROfE0A, robh-DgEjT+Ai2ygdnm+yROfE0A,
ahs3-H+wXaHxf7aLQT0dZR+AlfA, frowand.list-Re5JQEeQqe8AvxtiuMwx3w
It can be const now.
Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
include/media/v4l2-async.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index c69d8c8..056cae0 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -55,7 +55,7 @@ struct v4l2_async_subdev {
enum v4l2_async_match_type match_type;
union {
struct {
- struct fwnode_handle *fwnode;
+ const struct fwnode_handle *fwnode;
} fwnode;
struct {
const char *name;
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-05-22 9:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 9:07 [PATCH 0/7] Constify property fwnode arguments Sakari Ailus
2017-05-22 9:07 ` [PATCH 1/7] ACPI: Constify acpi_get_next_subnode() fwnode argument Sakari Ailus
2017-05-22 9:07 ` [PATCH 2/7] ACPI: Constify acpi_bus helper functions, switch to macros Sakari Ailus
2017-05-22 9:07 ` [PATCH 3/7] ACPI: Constify internal fwnode arguments Sakari Ailus
2017-05-22 9:07 ` [PATCH 4/7] device property: Constify argument to pset fwnode backend Sakari Ailus
2017-05-22 9:07 ` [PATCH 5/7] device property: Constify fwnode property API Sakari Ailus
2017-05-22 9:07 ` [PATCH 6/7] v4l: fwnode: Constify fwnode endpoints Sakari Ailus
[not found] ` <1495444062-23867-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-05-22 9:07 ` [PATCH 7/7] v4l2-async: Make fwnode const Sakari Ailus
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).