mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
ASoC: qcom: q6asm: Use guard() for spin locks
Clean up the code using guard() for spin locks. No functional changes, just cleanup. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20251023102444.88158-21-srinivas.kandagatla@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
680c683c8f
commit
655079ac8a
|
|
@ -571,9 +571,8 @@ static struct audio_client *q6asm_get_audio_client(struct q6asm *a,
|
|||
int session_id)
|
||||
{
|
||||
struct audio_client *ac = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&a->slock, flags);
|
||||
guard(spinlock_irqsave)(&a->slock);
|
||||
if ((session_id <= 0) || (session_id > MAX_SESSIONS)) {
|
||||
dev_err(a->dev, "invalid session: %d\n", session_id);
|
||||
goto err;
|
||||
|
|
@ -588,7 +587,6 @@ static struct audio_client *q6asm_get_audio_client(struct q6asm *a,
|
|||
ac = a->session[session_id];
|
||||
kref_get(&ac->refcount);
|
||||
err:
|
||||
spin_unlock_irqrestore(&a->slock, flags);
|
||||
return ac;
|
||||
}
|
||||
|
||||
|
|
@ -681,15 +679,13 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
|
|||
client_event = ASM_CLIENT_EVENT_DATA_WRITE_DONE;
|
||||
if (ac->io_mode & ASM_SYNC_IO_MODE) {
|
||||
phys_addr_t phys;
|
||||
unsigned long flags;
|
||||
int token = hdr->token & ASM_WRITE_TOKEN_MASK;
|
||||
|
||||
spin_lock_irqsave(&ac->lock, flags);
|
||||
guard(spinlock_irqsave)(&ac->lock);
|
||||
|
||||
port = &ac->port[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
|
||||
if (!port->buf) {
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
ret = 0;
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -700,11 +696,9 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
|
|||
upper_32_bits(phys) != result->status) {
|
||||
dev_err(ac->dev, "Expected addr %pa\n",
|
||||
&port->buf[token].phys);
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
atomic_set(&port->hw_ptr, token + 1);
|
||||
}
|
||||
break;
|
||||
|
|
@ -712,13 +706,11 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
|
|||
client_event = ASM_CLIENT_EVENT_DATA_READ_DONE;
|
||||
if (ac->io_mode & ASM_SYNC_IO_MODE) {
|
||||
struct asm_data_cmd_read_v2_done *done = data->payload;
|
||||
unsigned long flags;
|
||||
phys_addr_t phys;
|
||||
|
||||
spin_lock_irqsave(&ac->lock, flags);
|
||||
guard(spinlock_irqsave)(&ac->lock);
|
||||
port = &ac->port[SNDRV_PCM_STREAM_CAPTURE];
|
||||
if (!port->buf) {
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
ret = 0;
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -732,11 +724,9 @@ static int32_t q6asm_stream_callback(struct apr_device *adev,
|
|||
&port->buf[hdr->token].phys,
|
||||
done->buf_addr_lsw,
|
||||
done->buf_addr_msw);
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -1561,14 +1551,12 @@ EXPORT_SYMBOL_GPL(q6asm_write_async);
|
|||
static void q6asm_reset_buf_state(struct audio_client *ac)
|
||||
{
|
||||
struct audio_port_data *port;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&ac->lock, flags);
|
||||
guard(spinlock_irqsave)(&ac->lock);
|
||||
port = &ac->port[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
port->dsp_buf = 0;
|
||||
port = &ac->port[SNDRV_PCM_STREAM_CAPTURE];
|
||||
port->dsp_buf = 0;
|
||||
spin_unlock_irqrestore(&ac->lock, flags);
|
||||
}
|
||||
|
||||
static int __q6asm_cmd(struct audio_client *ac, uint32_t stream_id, int cmd,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user