spi: spi-nxp-fspi: use guard(mutex) to simplify the code

Use guard(mutex) to simplify the code logic.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250428-flexspipatch-v3-3-61d5e8f591bc@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Haibo Chen 2025-04-28 18:06:45 +08:00 committed by Mark Brown
parent 97be4b919a
commit 93be516f81
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -932,11 +932,10 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
struct nxp_fspi *f = spi_controller_get_devdata(mem->spi->controller);
int err = 0;
mutex_lock(&f->lock);
guard(mutex)(&f->lock);
err = pm_runtime_get_sync(f->dev);
if (err < 0) {
mutex_unlock(&f->lock);
dev_err(f->dev, "Failed to enable clock %d\n", __LINE__);
return err;
}
@ -972,7 +971,6 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
pm_runtime_mark_last_busy(f->dev);
pm_runtime_put_autosuspend(f->dev);
mutex_unlock(&f->lock);
return err;
}