mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: Convert lock/unlock to scoped_guard
@ 2025-09-10 20:50 Erick Karanja
  2025-09-10 21:52 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Erick Karanja @ 2025-09-10 20:50 UTC (permalink / raw)
  To: broonie
  Cc: linux-arm-msm, linux-spi, linux-kernel, julia.lawall, Erick Karanja

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: Convert lock/unlock to scoped_guard
  2025-09-10 20:50 [PATCH] spi: Convert lock/unlock to scoped_guard Erick Karanja
@ 2025-09-10 21:52 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-09-10 21:52 UTC (permalink / raw)
  To: Erick Karanja; +Cc: linux-arm-msm, linux-spi, linux-kernel, julia.lawall

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-10 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-10 20:50 [PATCH] spi: Convert lock/unlock to scoped_guard Erick Karanja
2025-09-10 21:52 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®