summaryrefslogtreecommitdiff
path: root/drivers/acpi/property.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-07-21 14:39:32 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-22 01:04:50 +0300
commit01c1da2897918b718de65abb3070ea6985aecbd1 (patch)
tree9568f774d496ed2030f9975f10e8b8d898a6c975 /drivers/acpi/property.c
parentdb3e50f3234ba1a477413f56a9e5800a73dca786 (diff)
downloadlinux-01c1da2897918b718de65abb3070ea6985aecbd1.tar.xz
ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument
Make local variables const (head) or add new variables; adev was used for two purposes: to refer the root device node and its children. The two purposes are separated by this patch. This is preparation for making fwnode arguments const for fwnode ops. Don't constify the argument itself quite yet as this is used as a callback function. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/property.c')
-rw-r--r--drivers/acpi/property.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index cb6a3b38ded2..04c60a25ee87 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -899,8 +899,10 @@ 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 *adev = to_acpi_device_node(fwnode);
+ struct acpi_device *child_adev = NULL;
+ const struct list_head *head;
+ struct list_head *next;
if (!child || is_acpi_device_node(child)) {
if (adev)
@@ -912,26 +914,27 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
goto nondev;
if (child) {
- adev = to_acpi_device_node(child);
- next = adev->node.next;
+ child_adev = to_acpi_device_node(child);
+ next = child_adev->node.next;
if (next == head) {
child = NULL;
goto nondev;
}
- adev = list_entry(next, struct acpi_device, node);
+ child_adev = list_entry(next, struct acpi_device, node);
} else {
- adev = list_first_entry(head, struct acpi_device, node);
+ child_adev = list_first_entry(head, struct acpi_device,
+ node);
}
- return acpi_fwnode_handle(adev);
+ return acpi_fwnode_handle(child_adev);
}
nondev:
if (!child || is_acpi_data_node(child)) {
- 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;
+ if (child_adev)
+ head = &child_adev->data.subnodes;
else if (data)
head = &data->data.subnodes;
else