[PATCH] spi: Convert lock/unlock to scoped_guard

Erick Karanja posted 1 patch 3 weeks ago
drivers/spi/spi-qup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] spi: Convert lock/unlock to scoped_guard
Posted by Erick Karanja 3 weeks ago
Siplify the lock/unlock pattern with scope based cleanup.

Generated-by: Coccinelle SmPL

Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
 drivers/spi/spi-qup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index 7d647edf6bc3..ad4f526a3705 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -654,10 +654,10 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
 		error = -EIO;
 	}
 
-	spin_lock(&controller->lock);
-	if (!controller->error)
-		controller->error = error;
-	spin_unlock(&controller->lock);
+	scoped_guard (spinlock, &controller->lock) {
+		if (!controller->error)
+			controller->error = error;
+	}
 
 	if (spi_qup_is_dma_xfer(controller->mode)) {
 		writel_relaxed(opflags, controller->base + QUP_OPERATIONAL);
-- 
2.43.0
Re: [PATCH] spi: Convert lock/unlock to scoped_guard
Posted by Mark Brown 3 weeks ago
On Wed, Sep 10, 2025 at 11:50:03PM +0300, Erick Karanja wrote:
> Siplify the lock/unlock pattern with scope based cleanup.
> 
> Generated-by: Coccinelle SmPL

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.