提交 01c1da28 编写于 作者: S Sakari Ailus 提交者: Rafael J. Wysocki

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: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 db3e50f3
...@@ -899,8 +899,10 @@ int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, ...@@ -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 *acpi_get_next_subnode(struct fwnode_handle *fwnode,
struct fwnode_handle *child) struct fwnode_handle *child)
{ {
struct acpi_device *adev = to_acpi_device_node(fwnode); const struct acpi_device *adev = to_acpi_device_node(fwnode);
struct list_head *head, *next; struct acpi_device *child_adev = NULL;
const struct list_head *head;
struct list_head *next;
if (!child || is_acpi_device_node(child)) { if (!child || is_acpi_device_node(child)) {
if (adev) if (adev)
...@@ -912,26 +914,27 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, ...@@ -912,26 +914,27 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
goto nondev; goto nondev;
if (child) { if (child) {
adev = to_acpi_device_node(child); child_adev = to_acpi_device_node(child);
next = adev->node.next; next = child_adev->node.next;
if (next == head) { if (next == head) {
child = NULL; child = NULL;
goto nondev; goto nondev;
} }
adev = list_entry(next, struct acpi_device, node); child_adev = list_entry(next, struct acpi_device, node);
} else { } 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: nondev:
if (!child || is_acpi_data_node(child)) { 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; struct acpi_data_node *dn;
if (adev) if (child_adev)
head = &adev->data.subnodes; head = &child_adev->data.subnodes;
else if (data) else if (data)
head = &data->data.subnodes; head = &data->data.subnodes;
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册