Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf3aa8bd authored by David Collins's avatar David Collins
Browse files

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: default avatarDavid Collins <collinsd@codeaurora.org>
parent e55aea69
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
// 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)
@@ -263,14 +263,14 @@ 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;

	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);