mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
ASoC: SOF: Intel: Use guard() for spinlocks where it makes sense
Replace the manual spinlock lock/unlock pairs with guard(). Only code refactoring, and no behavior change. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://patch.msgid.link/20260112101004.7648-7-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
@@ -143,9 +143,6 @@ irqreturn_t atom_irq_thread(int irq, void *context)
|
||||
|
||||
/* reply message from DSP */
|
||||
if (ipcx & SHIM_BYT_IPCX_DONE) {
|
||||
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
/*
|
||||
* handle immediate reply from DSP core. If the msg is
|
||||
* found, set done bit in cmd_done which is called at the
|
||||
@@ -153,11 +150,9 @@ irqreturn_t atom_irq_thread(int irq, void *context)
|
||||
* because the done bit can't be set in cmd_done function
|
||||
* which is triggered by msg
|
||||
*/
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
snd_sof_ipc_process_reply(sdev, ipcx);
|
||||
|
||||
atom_dsp_done(sdev);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
}
|
||||
|
||||
/* new message from DSP */
|
||||
|
||||
@@ -315,9 +315,6 @@ static irqreturn_t bdw_irq_thread(int irq, void *context)
|
||||
snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR,
|
||||
SHIM_IMRX, SHIM_IMRX_DONE,
|
||||
SHIM_IMRX_DONE);
|
||||
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
/*
|
||||
* handle immediate reply from DSP core. If the msg is
|
||||
* found, set done bit in cmd_done which is called at the
|
||||
@@ -325,11 +322,9 @@ static irqreturn_t bdw_irq_thread(int irq, void *context)
|
||||
* because the done bit can't be set in cmd_done function
|
||||
* which is triggered by msg
|
||||
*/
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
snd_sof_ipc_process_reply(sdev, ipcx);
|
||||
|
||||
bdw_dsp_done(sdev);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
}
|
||||
|
||||
ipcd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD);
|
||||
|
||||
@@ -69,13 +69,10 @@ irqreturn_t cnl_ipc4_irq_thread(int irq, void *context)
|
||||
data->primary = primary;
|
||||
data->extension = extension;
|
||||
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
snd_sof_ipc_get_reply(sdev);
|
||||
cnl_ipc_host_done(sdev);
|
||||
snd_sof_ipc_reply(sdev, data->primary);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
} else {
|
||||
dev_dbg_ratelimited(sdev->dev,
|
||||
"IPC reply before FW_READY: %#x|%#x\n",
|
||||
@@ -141,15 +138,11 @@ irqreturn_t cnl_ipc_irq_thread(int irq, void *context)
|
||||
CNL_DSP_REG_HIPCCTL_DONE, 0);
|
||||
|
||||
if (likely(sdev->fw_state == SOF_FW_BOOT_COMPLETE)) {
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
/* handle immediate reply from DSP core */
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
hda_dsp_ipc_get_reply(sdev);
|
||||
snd_sof_ipc_reply(sdev, msg);
|
||||
|
||||
cnl_ipc_dsp_done(sdev);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
} else {
|
||||
dev_dbg_ratelimited(sdev->dev, "IPC reply before FW_READY: %#x\n",
|
||||
msg);
|
||||
|
||||
@@ -58,7 +58,7 @@ hda_link_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream
|
||||
return NULL;
|
||||
}
|
||||
|
||||
spin_lock_irq(&bus->reg_lock);
|
||||
guard(spinlock_irq)(&bus->reg_lock);
|
||||
list_for_each_entry(hstream, &bus->stream_list, list) {
|
||||
struct hdac_ext_stream *hext_stream =
|
||||
stream_to_hdac_ext_stream(hstream);
|
||||
@@ -110,7 +110,6 @@ hda_link_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream
|
||||
res->link_locked = 1;
|
||||
res->link_substream = substream;
|
||||
}
|
||||
spin_unlock_irq(&bus->reg_lock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -204,13 +204,10 @@ irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context)
|
||||
data->primary = primary;
|
||||
data->extension = extension;
|
||||
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
snd_sof_ipc_get_reply(sdev);
|
||||
hda_dsp_ipc_host_done(sdev);
|
||||
snd_sof_ipc_reply(sdev, data->primary);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
} else {
|
||||
dev_dbg_ratelimited(sdev->dev,
|
||||
"IPC reply before FW_READY: %#x|%#x\n",
|
||||
@@ -289,16 +286,12 @@ irqreturn_t hda_dsp_ipc_irq_thread(int irq, void *context)
|
||||
* reply.
|
||||
*/
|
||||
if (likely(sdev->fw_state == SOF_FW_BOOT_COMPLETE)) {
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
/* handle immediate reply from DSP core */
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
hda_dsp_ipc_get_reply(sdev);
|
||||
snd_sof_ipc_reply(sdev, msg);
|
||||
|
||||
/* set the done bit */
|
||||
hda_dsp_ipc_dsp_done(sdev);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
} else {
|
||||
dev_dbg_ratelimited(sdev->dev, "IPC reply before FW_READY: %#x\n",
|
||||
msg);
|
||||
|
||||
@@ -724,12 +724,12 @@ int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
|
||||
struct hdac_bus *bus = sof_to_bus(sdev);
|
||||
u32 mask = BIT(hstream->index);
|
||||
|
||||
spin_lock_irq(&bus->reg_lock);
|
||||
guard(spinlock_irq)(&bus->reg_lock);
|
||||
|
||||
/* couple host and link DMA if link DMA channel is idle */
|
||||
if (!hext_stream->link_locked)
|
||||
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR,
|
||||
SOF_HDA_REG_PP_PPCTL, mask, 0);
|
||||
spin_unlock_irq(&bus->reg_lock);
|
||||
}
|
||||
|
||||
hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
|
||||
@@ -747,7 +747,7 @@ bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev)
|
||||
u32 status;
|
||||
|
||||
/* The function can be called at irq thread, so use spin_lock_irq */
|
||||
spin_lock_irq(&bus->reg_lock);
|
||||
guard(spinlock_irq)(&bus->reg_lock);
|
||||
|
||||
status = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS);
|
||||
|
||||
@@ -757,8 +757,6 @@ bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev)
|
||||
if (status != 0xffffffff)
|
||||
ret = true;
|
||||
|
||||
spin_unlock_irq(&bus->reg_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_NS(hda_dsp_check_stream_irq, "SND_SOC_SOF_INTEL_HDA_COMMON");
|
||||
@@ -842,7 +840,7 @@ irqreturn_t hda_dsp_stream_threaded_handler(int irq, void *context)
|
||||
* unsolicited responses from the codec
|
||||
*/
|
||||
for (i = 0, active = true; i < 10 && active; i++) {
|
||||
spin_lock_irq(&bus->reg_lock);
|
||||
guard(spinlock_irq)(&bus->reg_lock);
|
||||
|
||||
status = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTSTS);
|
||||
|
||||
@@ -853,7 +851,6 @@ irqreturn_t hda_dsp_stream_threaded_handler(int irq, void *context)
|
||||
if (status & AZX_INT_CTRL_EN) {
|
||||
active |= hda_codec_check_rirb_status(sdev);
|
||||
}
|
||||
spin_unlock_irq(&bus->reg_lock);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
|
||||
@@ -596,13 +596,10 @@ static irqreturn_t mtl_ipc_irq_thread(int irq, void *context)
|
||||
data->primary = primary;
|
||||
data->extension = extension;
|
||||
|
||||
spin_lock_irq(&sdev->ipc_lock);
|
||||
|
||||
guard(spinlock_irq)(&sdev->ipc_lock);
|
||||
snd_sof_ipc_get_reply(sdev);
|
||||
mtl_ipc_host_done(sdev);
|
||||
snd_sof_ipc_reply(sdev, data->primary);
|
||||
|
||||
spin_unlock_irq(&sdev->ipc_lock);
|
||||
} else {
|
||||
dev_dbg_ratelimited(sdev->dev,
|
||||
"IPC reply before FW_READY: %#x|%#x\n",
|
||||
|
||||
Reference in New Issue
Block a user