[PATCH v3 25/27] ASoC: codecs: rt712: Use guard() for mutex locks
Mark Brown
broonie at kernel.org
Fri Jul 10 08:07:43 PDT 2026
On Fri, Jul 10, 2026 at 12:05:09PM +0700, phucduc.bui at gmail.com wrote:
> @@ -455,14 +456,15 @@ static int rt712_sdca_dev_resume(struct device *dev)
> return 0;
>
> if (!slave->unattach_request) {
> - mutex_lock(&rt712->disable_irq_lock);
> - if (rt712->disable_irq == true) {
> -
> - sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1, SDW_SCP_SDCA_INTMASK_SDCA_0);
> - sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2, SDW_SCP_SDCA_INTMASK_SDCA_8);
> - rt712->disable_irq = false;
> + scoped_guard(mutex, &rt712->disable_irq_lock) {
> + if (rt712->disable_irq) {
> + sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK1,
> + SDW_SCP_SDCA_INTMASK_SDCA_0);
> + sdw_write_no_pm(slave, SDW_SCP_SDCA_INTMASK2,
> + SDW_SCP_SDCA_INTMASK_SDCA_8);
> + rt712->disable_irq = false;
> + }
> }
> - mutex_unlock(&rt712->disable_irq_lock);
> }
This function does also have some goto based unwinding, there's a
similar thing in the rt721 changes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20260710/a03ed7fb/attachment.sig>
More information about the Linux-mediatek
mailing list