Skip to content

Commit 672d0e4

Browse files
committed
Merge branches 'acpi-pmic', 'acpi-bus', 'acpi-wdat' and 'acpi-properties'
* acpi-pmic: ACPI / PMIC: Add code reviewers to MAINTAINERS * acpi-bus: ACPI / bus: Make ACPI_HANDLE() work for non-GPL code again * acpi-wdat: ACPI / watchdog: properly initialize resources * acpi-properties: ACPI: properties: Return _DSD hierarchical extension (data) sub-nodes correctly
4 parents 096a2c6 + 9e987b7 + 6ce14f6 + 0c0bceb commit 672d0e4

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

drivers/acpi/acpi_watchdog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void __init acpi_watchdog_init(void)
6666
for (i = 0; i < wdat->entries; i++) {
6767
const struct acpi_generic_address *gas;
6868
struct resource_entry *rentry;
69-
struct resource res;
69+
struct resource res = {};
7070
bool found;
7171

7272
gas = &entries[i].register_region;

drivers/acpi/property.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,12 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
908908
struct fwnode_handle *child)
909909
{
910910
const struct acpi_device *adev = to_acpi_device_node(fwnode);
911-
struct acpi_device *child_adev = NULL;
912911
const struct list_head *head;
913912
struct list_head *next;
914913

915914
if (!child || is_acpi_device_node(child)) {
915+
struct acpi_device *child_adev;
916+
916917
if (adev)
917918
head = &adev->children;
918919
else
@@ -922,8 +923,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
922923
goto nondev;
923924

924925
if (child) {
925-
child_adev = to_acpi_device_node(child);
926-
next = child_adev->node.next;
926+
adev = to_acpi_device_node(child);
927+
next = adev->node.next;
927928
if (next == head) {
928929
child = NULL;
929930
goto nondev;
@@ -941,8 +942,8 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
941942
const struct acpi_data_node *data = to_acpi_data_node(fwnode);
942943
struct acpi_data_node *dn;
943944

944-
if (child_adev)
945-
head = &child_adev->data.subnodes;
945+
if (adev)
946+
head = &adev->data.subnodes;
946947
else if (data)
947948
head = &data->data.subnodes;
948949
else
@@ -1293,3 +1294,16 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
12931294
DECLARE_ACPI_FWNODE_OPS(acpi_device_fwnode_ops);
12941295
DECLARE_ACPI_FWNODE_OPS(acpi_data_fwnode_ops);
12951296
const struct fwnode_operations acpi_static_fwnode_ops;
1297+
1298+
bool is_acpi_device_node(const struct fwnode_handle *fwnode)
1299+
{
1300+
return !IS_ERR_OR_NULL(fwnode) &&
1301+
fwnode->ops == &acpi_device_fwnode_ops;
1302+
}
1303+
EXPORT_SYMBOL(is_acpi_device_node);
1304+
1305+
bool is_acpi_data_node(const struct fwnode_handle *fwnode)
1306+
{
1307+
return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &acpi_data_fwnode_ops;
1308+
}
1309+
EXPORT_SYMBOL(is_acpi_data_node);

include/acpi/acpi_bus.h

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -399,17 +399,12 @@ extern const struct fwnode_operations acpi_device_fwnode_ops;
399399
extern const struct fwnode_operations acpi_data_fwnode_ops;
400400
extern const struct fwnode_operations acpi_static_fwnode_ops;
401401

402+
bool is_acpi_device_node(const struct fwnode_handle *fwnode);
403+
bool is_acpi_data_node(const struct fwnode_handle *fwnode);
404+
402405
static inline bool is_acpi_node(const struct fwnode_handle *fwnode)
403406
{
404-
return !IS_ERR_OR_NULL(fwnode) &&
405-
(fwnode->ops == &acpi_device_fwnode_ops
406-
|| fwnode->ops == &acpi_data_fwnode_ops);
407-
}
408-
409-
static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
410-
{
411-
return !IS_ERR_OR_NULL(fwnode) &&
412-
fwnode->ops == &acpi_device_fwnode_ops;
407+
return (is_acpi_device_node(fwnode) || is_acpi_data_node(fwnode));
413408
}
414409

415410
#define to_acpi_device_node(__fwnode) \
@@ -422,11 +417,6 @@ static inline bool is_acpi_device_node(const struct fwnode_handle *fwnode)
422417
NULL; \
423418
})
424419

425-
static inline bool is_acpi_data_node(const struct fwnode_handle *fwnode)
426-
{
427-
return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &acpi_data_fwnode_ops;
428-
}
429-
430420
#define to_acpi_data_node(__fwnode) \
431421
({ \
432422
typeof(__fwnode) __to_acpi_data_node_fwnode = __fwnode; \

0 commit comments

Comments
 (0)