Skip to content

Commit 268db33

Browse files
committed
Merge tag 'devprop-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework updates from Rafael Wysocki: "These mostly extend the device property API and make it easier to use in some cases. Specifics: - Allow error pointer to be passed to fwnode APIs (Andy Shevchenko). - Introduce fwnode_for_each_parent_node() (Andy Shevchenko, Douglas Anderson). - Advertise fwnode and device property count API calls (Andy Shevchenko). - Clean up fwnode_is_ancestor_of() (Andy Shevchenko). - Convert device_{dma_supported,get_dma_attr} to fwnode (Sakari Ailus). - Release subnode properties with data nodes (Sakari Ailus). - Add ->iomap() and ->irq_get() to fwnode operations (Sakari Ailus)" * tag 'devprop-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: device property: Advertise fwnode and device property count API calls device property: Fix recent breakage of fwnode_get_next_parent_dev() device property: Drop 'test' prefix in parameters of fwnode_is_ancestor_of() device property: Introduce fwnode_for_each_parent_node() device property: Allow error pointer to be passed to fwnode APIs ACPI: property: Release subnode properties with data nodes device property: Add irq_get to fwnode operation device property: Add iomap to fwnode operations ACPI: property: Move acpi_fwnode_device_get_match_data() up device property: Convert device_{dma_supported,get_dma_attr} to fwnode
2 parents f4fb859 + f6e109a commit 268db33

File tree

5 files changed

+211
-121
lines changed

5 files changed

+211
-121
lines changed

drivers/acpi/property.c

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,16 @@ void acpi_init_properties(struct acpi_device *adev)
433433
acpi_extract_apple_properties(adev);
434434
}
435435

436+
static void acpi_free_device_properties(struct list_head *list)
437+
{
438+
struct acpi_device_properties *props, *tmp;
439+
440+
list_for_each_entry_safe(props, tmp, list, list) {
441+
list_del(&props->list);
442+
kfree(props);
443+
}
444+
}
445+
436446
static void acpi_destroy_nondev_subnodes(struct list_head *list)
437447
{
438448
struct acpi_data_node *dn, *next;
@@ -445,22 +455,18 @@ static void acpi_destroy_nondev_subnodes(struct list_head *list)
445455
wait_for_completion(&dn->kobj_done);
446456
list_del(&dn->sibling);
447457
ACPI_FREE((void *)dn->data.pointer);
458+
acpi_free_device_properties(&dn->data.properties);
448459
kfree(dn);
449460
}
450461
}
451462

452463
void acpi_free_properties(struct acpi_device *adev)
453464
{
454-
struct acpi_device_properties *props, *tmp;
455-
456465
acpi_destroy_nondev_subnodes(&adev->data.subnodes);
457466
ACPI_FREE((void *)adev->data.pointer);
458467
adev->data.of_compatible = NULL;
459468
adev->data.pointer = NULL;
460-
list_for_each_entry_safe(props, tmp, &adev->data.properties, list) {
461-
list_del(&props->list);
462-
kfree(props);
463-
}
469+
acpi_free_device_properties(&adev->data.properties);
464470
}
465471

466472
/**
@@ -1256,6 +1262,24 @@ static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
12561262
return acpi_device_is_present(to_acpi_device_node(fwnode));
12571263
}
12581264

1265+
static const void *
1266+
acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
1267+
const struct device *dev)
1268+
{
1269+
return acpi_device_get_match_data(dev);
1270+
}
1271+
1272+
static bool acpi_fwnode_device_dma_supported(const struct fwnode_handle *fwnode)
1273+
{
1274+
return acpi_dma_supported(to_acpi_device_node(fwnode));
1275+
}
1276+
1277+
static enum dev_dma_attr
1278+
acpi_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode)
1279+
{
1280+
return acpi_get_dma_attr(to_acpi_device_node(fwnode));
1281+
}
1282+
12591283
static bool acpi_fwnode_property_present(const struct fwnode_handle *fwnode,
12601284
const char *propname)
12611285
{
@@ -1376,17 +1400,26 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
13761400
return 0;
13771401
}
13781402

1379-
static const void *
1380-
acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
1381-
const struct device *dev)
1403+
static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
1404+
unsigned int index)
13821405
{
1383-
return acpi_device_get_match_data(dev);
1406+
struct resource res;
1407+
int ret;
1408+
1409+
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
1410+
if (ret)
1411+
return ret;
1412+
1413+
return res.start;
13841414
}
13851415

13861416
#define DECLARE_ACPI_FWNODE_OPS(ops) \
13871417
const struct fwnode_operations ops = { \
13881418
.device_is_available = acpi_fwnode_device_is_available, \
13891419
.device_get_match_data = acpi_fwnode_device_get_match_data, \
1420+
.device_dma_supported = \
1421+
acpi_fwnode_device_dma_supported, \
1422+
.device_get_dma_attr = acpi_fwnode_device_get_dma_attr, \
13901423
.property_present = acpi_fwnode_property_present, \
13911424
.property_read_int_array = \
13921425
acpi_fwnode_property_read_int_array, \
@@ -1404,6 +1437,7 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
14041437
acpi_graph_get_remote_endpoint, \
14051438
.graph_get_port_parent = acpi_fwnode_get_parent, \
14061439
.graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
1440+
.irq_get = acpi_fwnode_irq_get, \
14071441
}; \
14081442
EXPORT_SYMBOL_GPL(ops)
14091443

0 commit comments

Comments
 (0)