From: "tip-bot2 for Andrew Davis" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Andrew Davis <afd@ti.com>, Thomas Gleixner <tglx@kernel.org>,
Radu Rendec <radu@rendec.net>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: irq/drivers] irqchip/pruss-intc: Use scoped lock guard and devm_mutex_init
Date: Mon, 07 Sep 2026 19:51:31 -0000 [thread overview]
Message-ID: <178881069105.623050.11750229050053182460.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260903185220.2014861-2-afd@ti.com>
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: c23c3a1ec322f8bb9ed73bc1262d1083e76df23b
Gitweb: https://git.kernel.org/tip/c23c3a1ec322f8bb9ed73bc1262d1083e76df23b
Author: Andrew Davis <afd@ti.com>
AuthorDate: Thu, 03 Sep 2026 13:52:20 -05:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Mon, 07 Sep 2026 21:47:51 +02:00
irqchip/pruss-intc: Use scoped lock guard and devm_mutex_init
Scoped locking simplifies the return path in a spot, and removes
a couple lines in another couple spots. The devm mutex init will
call mutex_destroy() for us on remove, which only really matters
when CONFIG_DEBUG_MUTEXES is set, but it is nice to do anyway.
Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Radu Rendec <radu@rendec.net>
Link: https://patch.msgid.link/20260903185220.2014861-2-afd@ti.com
---
drivers/irqchip/irq-pruss-intc.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c
index cc3a7c2..5a3e9e5 100644
--- a/drivers/irqchip/irq-pruss-intc.c
+++ b/drivers/irqchip/irq-pruss-intc.c
@@ -181,7 +181,7 @@ static void pruss_intc_map(struct pruss_intc *intc, unsigned long hwirq)
u8 ch, host, reg_idx;
u32 val;
- mutex_lock(&intc->lock);
+ guard(mutex)(&intc->lock);
intc->event_channel[hwirq].ref_count++;
@@ -206,8 +206,6 @@ static void pruss_intc_map(struct pruss_intc *intc, unsigned long hwirq)
dev_dbg(dev, "mapped system_event = %lu channel = %d host = %d",
hwirq, ch, host);
-
- mutex_unlock(&intc->lock);
}
/**
@@ -224,7 +222,7 @@ static void pruss_intc_unmap(struct pruss_intc *intc, unsigned long hwirq)
u8 ch, host, reg_idx;
u32 val;
- mutex_lock(&intc->lock);
+ guard(mutex)(&intc->lock);
ch = intc->event_channel[hwirq].value;
host = intc->channel_host[ch].value;
@@ -251,8 +249,6 @@ static void pruss_intc_unmap(struct pruss_intc *intc, unsigned long hwirq)
dev_dbg(intc->dev, "unmapped system_event = %lu channel = %d host = %d\n",
hwirq, ch, host);
-
- mutex_unlock(&intc->lock);
}
static void pruss_intc_init(struct pruss_intc *intc)
@@ -376,17 +372,15 @@ static int pruss_intc_validate_mapping(struct pruss_intc *intc, int event,
int channel, int host)
{
struct device *dev = intc->dev;
- int ret = 0;
- mutex_lock(&intc->lock);
+ guard(mutex)(&intc->lock);
/* check if sysevent already assigned */
if (intc->event_channel[event].ref_count > 0 &&
intc->event_channel[event].value != channel) {
dev_err(dev, "event %d (req. ch %d) already assigned to channel %d\n",
event, channel, intc->event_channel[event].value);
- ret = -EBUSY;
- goto unlock;
+ return -EBUSY;
}
/* check if channel already assigned */
@@ -394,16 +388,13 @@ static int pruss_intc_validate_mapping(struct pruss_intc *intc, int event,
intc->channel_host[channel].value != host) {
dev_err(dev, "channel %d (req. host %d) already assigned to host %d\n",
channel, host, intc->channel_host[channel].value);
- ret = -EBUSY;
- goto unlock;
+ return -EBUSY;
}
intc->event_channel[event].value = channel;
intc->channel_host[channel].value = host;
-unlock:
- mutex_unlock(&intc->lock);
- return ret;
+ return 0;
}
static int
@@ -550,7 +541,9 @@ static int pruss_intc_probe(struct platform_device *pdev)
pruss_intc_init(intc);
- mutex_init(&intc->lock);
+ ret = devm_mutex_init(dev, &intc->lock);
+ if (ret)
+ return ret;
intc->domain = irq_domain_create_linear(dev_fwnode(dev), max_system_events,
&pruss_intc_irq_domain_ops, intc);
next prev parent reply other threads:[~2026-09-07 19:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 18:52 [PATCH 1/2] irqchip/pruss-intc: Use match data directly Andrew Davis
2026-09-03 18:52 ` [PATCH 2/2] irqchip/pruss-intc: Use scoped lock guard and devm_mutex_init Andrew Davis
2026-09-05 16:01 ` Radu Rendec
2026-09-07 19:51 ` tip-bot2 for Andrew Davis [this message]
2026-09-05 14:02 ` [PATCH 1/2] irqchip/pruss-intc: Use match data directly Radu Rendec
2026-09-07 19:51 ` [tip: irq/drivers] " tip-bot2 for Andrew Davis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178881069105.623050.11750229050053182460.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=afd@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=radu@rendec.net \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®