clk: qcom: clk-aop-qmp: pass mbox pointer by reference in qmp_update_client

Pass the mbox pointer to qmp_update_client() by reference so that
it is possible to update its value inside of the function.

Change-Id: Iefa4587f6e77b6e7029ed07236fa3a51ca09c129
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2018-01-26 18:05:53 -08:00
commit 860fa9a8ce

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "%s: " fmt, __func__
@ -222,7 +222,7 @@ static struct clk_hw *aop_qmp_clk_hws[] = {
};
static int qmp_update_client(struct clk_hw *hw, struct device *dev,
struct mbox_chan *mbox)
struct mbox_chan **mbox)
{
struct clk_aop_qmp *clk_aop = to_aop_qmp_clk(hw);
int ret;
@ -233,13 +233,13 @@ static int qmp_update_client(struct clk_hw *hw, struct device *dev,
clk_aop->cl.tx_tout = MBOX_TOUT_MS;
clk_aop->cl.knows_txdone = false;
if (mbox) {
clk_aop->mbox = mbox;
if (*mbox) {
clk_aop->mbox = *mbox;
return 0;
}
/* Allocate mailbox channel */
mbox = clk_aop->mbox = mbox_request_channel(&clk_aop->cl, 0);
*mbox = clk_aop->mbox = mbox_request_channel(&clk_aop->cl, 0);
if (IS_ERR(clk_aop->mbox)) {
ret = PTR_ERR(clk_aop->mbox);
if (ret != -EPROBE_DEFER)
@ -264,7 +264,7 @@ static int aop_qmp_clk_probe(struct platform_device *pdev)
* Allocate mbox channel for the first clock client. The same channel
* would be used for the rest of the clock clients.
*/
ret = qmp_update_client(aop_qmp_clk_hws[i], &pdev->dev, mbox);
ret = qmp_update_client(aop_qmp_clk_hws[i], &pdev->dev, &mbox);
if (ret < 0)
return ret;
@ -282,7 +282,7 @@ static int aop_qmp_clk_probe(struct platform_device *pdev)
for (i = 1; i < num_clks; i++) {
if (!aop_qmp_clk_hws[i])
continue;
ret = qmp_update_client(aop_qmp_clk_hws[i], &pdev->dev, mbox);
ret = qmp_update_client(aop_qmp_clk_hws[i], &pdev->dev, &mbox);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to update QMP client %d\n",
ret);