Skip to contentSkip to conversation

spi: Convert lock/unlock to scoped_guard

PATCH In review Erick Karanja 2 participants 2 messages Sep 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: Convert lock/unlock to scoped_guard

Siplify the lock/unlock pattern with scope based cleanup.

Generated-by: Coccinelle SmPL

---
 drivers/spi/spi-qup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-qup.c +4 -4
index 7d647edf6bc3..ad4f526a3705 100644
@@ -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);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 3 lines · Erick Karanja

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.