Skip to content

Commit 5418db1

Browse files
committed
Merge tag 'zynqmp-soc-for-v5.13' of https://github.com/Xilinx/linux-xlnx into arm/drivers
arm64: soc: ZynqMP SoC changes for v5.13 - Fix firmware removal path - Cleanup eemi doc and *ops() * tag 'zynqmp-soc-for-v5.13' of https://github.com/Xilinx/linux-xlnx: firmware: xilinx: Remove zynqmp_pm_get_eemi_ops() in IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE) firmware: xilinx: Fix dereferencing freed memory Link: https://lore.kernel.org/r/a44f8e9f-cea7-57ef-c3bc-10f5f5e064fc@monstr.eu Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 30be844 + 79bfe48 commit 5418db1

3 files changed

Lines changed: 5 additions & 36 deletions

File tree

‎Documentation/driver-api/xilinx/eemi.rst‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,8 @@ components running across different processing clusters on a chip or
1616
device to communicate with a power management controller (PMC) on a
1717
device to issue or respond to power management requests.
1818

19-
EEMI ops is a structure containing all eemi APIs supported by Zynq MPSoC.
20-
The zynqmp-firmware driver maintain all EEMI APIs in zynqmp_eemi_ops
21-
structure. Any driver who want to communicate with PMC using EEMI APIs
22-
can call zynqmp_pm_get_eemi_ops().
23-
24-
Example of EEMI ops::
25-
26-
/* zynqmp-firmware driver maintain all EEMI APIs */
27-
struct zynqmp_eemi_ops {
28-
int (*get_api_version)(u32 *version);
29-
int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
30-
};
31-
32-
static const struct zynqmp_eemi_ops eemi_ops = {
33-
.get_api_version = zynqmp_pm_get_api_version,
34-
.query_data = zynqmp_pm_query_data,
35-
};
36-
37-
Example of EEMI ops usage::
38-
39-
static const struct zynqmp_eemi_ops *eemi_ops;
40-
u32 ret_payload[PAYLOAD_ARG_CNT];
41-
int ret;
42-
43-
eemi_ops = zynqmp_pm_get_eemi_ops();
44-
if (IS_ERR(eemi_ops))
45-
return PTR_ERR(eemi_ops);
46-
47-
ret = eemi_ops->query_data(qdata, ret_payload);
19+
Any driver who wants to communicate with PMC using EEMI APIs use the
20+
functions provided for each function.
4821

4922
IOCTL
5023
------

‎drivers/firmware/xilinx/zynqmp.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Xilinx Zynq MPSoC Firmware layer
44
*
5-
* Copyright (C) 2014-2020 Xilinx, Inc.
5+
* Copyright (C) 2014-2021 Xilinx, Inc.
66
*
77
* Michal Simek <michal.simek@xilinx.com>
88
* Davorin Mista <davorin.mista@aggios.com>
@@ -1280,12 +1280,13 @@ static int zynqmp_firmware_probe(struct platform_device *pdev)
12801280
static int zynqmp_firmware_remove(struct platform_device *pdev)
12811281
{
12821282
struct pm_api_feature_data *feature_data;
1283+
struct hlist_node *tmp;
12831284
int i;
12841285

12851286
mfd_remove_devices(&pdev->dev);
12861287
zynqmp_pm_api_debugfs_exit();
12871288

1288-
hash_for_each(pm_api_features_map, i, feature_data, hentry) {
1289+
hash_for_each_safe(pm_api_features_map, i, tmp, feature_data, hentry) {
12891290
hash_del(&feature_data->hentry);
12901291
kfree(feature_data);
12911292
}

‎include/linux/firmware/xlnx-zynqmp.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,6 @@ int zynqmp_pm_read_pggs(u32 index, u32 *value);
354354
int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype);
355355
int zynqmp_pm_set_boot_health_status(u32 value);
356356
#else
357-
static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
358-
{
359-
return ERR_PTR(-ENODEV);
360-
}
361-
362357
static inline int zynqmp_pm_get_api_version(u32 *version)
363358
{
364359
return -ENODEV;

0 commit comments

Comments
 (0)