[PATCH 1/2] firmware: arm_scmi: mailbox: share shmem for protocols

From: peng . fan
Date: Thu Feb 06 2020 - 08:04:47 EST


From: Peng Fan <peng.fan@xxxxxxx>

When shmem property of protocol is not specificed, let it use
its parent's shmem property.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---

Based on Viresh's V6 patchset.

drivers/firmware/arm_scmi/mailbox.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
index 73077bbc4ad9..68ed58e2a47a 100644
--- a/drivers/firmware/arm_scmi/mailbox.c
+++ b/drivers/firmware/arm_scmi/mailbox.c
@@ -69,6 +69,8 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
return -ENOMEM;

shmem = of_parse_phandle(cdev->of_node, "shmem", idx);
+ if (!shmem)
+ shmem = of_parse_phandle(dev->of_node, "shmem", idx);
ret = of_address_to_resource(shmem, 0, &res);
of_node_put(shmem);
if (ret) {
--
2.16.4