mailbox: Allow multiple controllers per device
authorMikko Perttunen <mperttunen@nvidia.com>
Wed, 28 Nov 2018 09:54:11 +0000 (10:54 +0100)
committerJassi Brar <jaswinder.singh@linaro.org>
Sat, 22 Dec 2018 04:31:26 +0000 (22:31 -0600)
Look through the whole controller list when mapping device tree
phandles to controllers instead of stopping at the first one.

Each controller is intended to only contain one kind of mailbox,
but some devices (like Tegra HSP) implement multiple kinds and use
the same device tree node for all of them. As such, we need to allow
multiple mbox_controllers per device tree node.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/mailbox.c

index 6abb35ff49fa16d2292fafc8f39b844414173985..c6a7d4582dc6790be3a50f545faa36bc07ea8a7f 100644 (file)
@@ -355,7 +355,8 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
        list_for_each_entry(mbox, &mbox_cons, node)
                if (mbox->dev->of_node == spec.np) {
                        chan = mbox->of_xlate(mbox, &spec);
-                       break;
+                       if (!IS_ERR(chan))
+                               break;
                }
 
        of_node_put(spec.np);