summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scmi
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2019-11-06 14:32:05 +0300
committerSudeep Holla <sudeep.holla@arm.com>2019-12-24 14:35:49 +0300
commit11040889afe3c0b084de0de1782534d529493e9b (patch)
tree4b27cd199ccbffee88dd40115b1c3f43c7e5e4d5 /drivers/firmware/arm_scmi
parentee7a9c9f67c59008b330deff2762bd8cf1407eec (diff)
downloadlinux-11040889afe3c0b084de0de1782534d529493e9b.tar.xz
firmware: arm_scmi: Skip scmi mbox channel setup for addtional devices
Now that the scmi bus supports adding multiple devices per protocol, and since scmi_create_protocol_device calls scmi_mbox_chan_setup, we must avoid allocating and initialising the mbox channel if it is already initialised. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi')
-rw-r--r--drivers/firmware/arm_scmi/driver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index dee7ce3bd815..2952fcd8dd8a 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -735,6 +735,11 @@ static int scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev,
idx = tx ? 0 : 1;
idr = tx ? &info->tx_idr : &info->rx_idr;
+ /* check if already allocated, used for multiple device per protocol */
+ cinfo = idr_find(idr, prot_id);
+ if (cinfo)
+ return 0;
+
if (scmi_mailbox_check(np, idx)) {
cinfo = idr_find(idr, SCMI_PROTOCOL_BASE);
if (unlikely(!cinfo)) /* Possible only if platform has no Rx */