mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
Merge "clk: qcom: clk-aop-qmp: correct mailbox channel request logic"
This commit is contained in:
commit
a892df470a
1 changed files with 16 additions and 4 deletions
|
|
@ -129,6 +129,12 @@ static int clk_aop_qmp_prepare(struct clk_hw *hw)
|
|||
struct clk_aop_qmp *clk = to_aop_qmp_clk(hw);
|
||||
|
||||
mutex_lock(&clk_aop_lock);
|
||||
/*
|
||||
* Return early if the clock has been enabled already. This
|
||||
* is to avoid issues with sending duplicate enable requests.
|
||||
*/
|
||||
if (clk->enabled)
|
||||
goto err;
|
||||
|
||||
if (clk->level)
|
||||
rate = clk->level;
|
||||
|
|
@ -167,6 +173,9 @@ static void clk_aop_qmp_unprepare(struct clk_hw *hw)
|
|||
|
||||
mutex_lock(&clk_aop_lock);
|
||||
|
||||
if (!clk->enabled)
|
||||
goto err;
|
||||
|
||||
rate = clk->disable_state;
|
||||
|
||||
snprintf(mbox_msg, MAX_LEN, "{class: %s, res: %s, val: %ld}",
|
||||
|
|
@ -216,6 +225,7 @@ static int qmp_update_client(struct clk_hw *hw, struct device *dev,
|
|||
struct mbox_chan *mbox)
|
||||
{
|
||||
struct clk_aop_qmp *clk_aop = to_aop_qmp_clk(hw);
|
||||
int ret;
|
||||
|
||||
/* Use mailbox client with blocking mode */
|
||||
clk_aop->cl.dev = dev;
|
||||
|
|
@ -230,10 +240,12 @@ static int qmp_update_client(struct clk_hw *hw, struct device *dev,
|
|||
|
||||
/* Allocate mailbox channel */
|
||||
mbox = clk_aop->mbox = mbox_request_channel(&clk_aop->cl, 0);
|
||||
if (IS_ERR(clk_aop->mbox) && PTR_ERR(clk_aop->mbox) != -EPROBE_DEFER) {
|
||||
dev_err(dev, "Failed to get mailbox channel %pK %ld\n",
|
||||
mbox, PTR_ERR(mbox));
|
||||
return PTR_ERR(clk_aop->mbox);
|
||||
if (IS_ERR(clk_aop->mbox)) {
|
||||
ret = PTR_ERR(clk_aop->mbox);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get mailbox channel, ret %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue