mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
i3c: master: svc: fix cpu schedule in spin lock
[ Upstream commit33beadb3b1] pm_runtime_resume_and_get() may call sleep(). It cannot be used in svc_i3c_master_start_xfer_locked(), because it is in a spin lock. Move the pm runtime operations to svc_i3c_master_enqueue_xfer(). Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> Fixes:05be23ef78("i3c: master: svc: add runtime pm support") Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20230517033030.3068085-2-xiaoning.wang@nxp.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c0ed8b8049
commit
76efcb6cda
@@ -1090,12 +1090,6 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
|
|||||||
if (!xfer)
|
if (!xfer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ret = pm_runtime_resume_and_get(master->dev);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
svc_i3c_master_clear_merrwarn(master);
|
svc_i3c_master_clear_merrwarn(master);
|
||||||
svc_i3c_master_flush_fifo(master);
|
svc_i3c_master_flush_fifo(master);
|
||||||
|
|
||||||
@@ -1110,9 +1104,6 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pm_runtime_mark_last_busy(master->dev);
|
|
||||||
pm_runtime_put_autosuspend(master->dev);
|
|
||||||
|
|
||||||
xfer->ret = ret;
|
xfer->ret = ret;
|
||||||
complete(&xfer->comp);
|
complete(&xfer->comp);
|
||||||
|
|
||||||
@@ -1133,6 +1124,13 @@ static void svc_i3c_master_enqueue_xfer(struct svc_i3c_master *master,
|
|||||||
struct svc_i3c_xfer *xfer)
|
struct svc_i3c_xfer *xfer)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = pm_runtime_resume_and_get(master->dev);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_completion(&xfer->comp);
|
init_completion(&xfer->comp);
|
||||||
spin_lock_irqsave(&master->xferqueue.lock, flags);
|
spin_lock_irqsave(&master->xferqueue.lock, flags);
|
||||||
@@ -1143,6 +1141,9 @@ static void svc_i3c_master_enqueue_xfer(struct svc_i3c_master *master,
|
|||||||
svc_i3c_master_start_xfer_locked(master);
|
svc_i3c_master_start_xfer_locked(master);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&master->xferqueue.lock, flags);
|
spin_unlock_irqrestore(&master->xferqueue.lock, flags);
|
||||||
|
|
||||||
|
pm_runtime_mark_last_busy(master->dev);
|
||||||
|
pm_runtime_put_autosuspend(master->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|||||||
Reference in New Issue
Block a user