[PATCH 09/12] ASoC: qcom: q6afe: Use guard() for spin locks

From: Srinivas Kandagatla
Date: Fri Oct 17 2025 - 04:58:43 EST


Clean up the code using guard() for spin locks.

No functional changes, just cleanup.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
---
sound/soc/qcom/qdsp6/q6afe.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 56f85f1c2425..980851a12976 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -946,9 +946,8 @@ static struct q6afe_port *q6afe_find_port(struct q6afe *afe, int token)
{
struct q6afe_port *p;
struct q6afe_port *ret = NULL;
- unsigned long flags;

- spin_lock_irqsave(&afe->port_list_lock, flags);
+ guard(spinlock)(&afe->port_list_lock);
list_for_each_entry(p, &afe->port_list, node)
if (p->token == token) {
ret = p;
@@ -956,7 +955,6 @@ static struct q6afe_port *q6afe_find_port(struct q6afe *afe, int token)
break;
}

- spin_unlock_irqrestore(&afe->port_list_lock, flags);
return ret;
}

@@ -1733,7 +1731,6 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id)
int port_id;
struct q6afe *afe = dev_get_drvdata(dev->parent);
struct q6afe_port *port;
- unsigned long flags;
int cfg_type;

if (id < 0 || id >= AFE_PORT_MAX) {
@@ -1810,9 +1807,8 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id)
port->cfg_type = cfg_type;
kref_init(&port->refcount);

- spin_lock_irqsave(&afe->port_list_lock, flags);
+ guard(spinlock)(&afe->port_list_lock);
list_add_tail(&port->node, &afe->port_list);
- spin_unlock_irqrestore(&afe->port_list_lock, flags);

return port;

--
2.51.0