The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>
Subject: [PATCH] irqchip/tb10x: simplify ioremap
Date: Sun, 10 May 2026 12:47:38 -0700	[thread overview]
Message-ID: <20260510194738.9810-1-rosenp@gmail.com> (raw)

Use of_io_request_and_map() to combine, resource aquisition, region
request, and ioremap into one. No longer need to call
release_mem_region. Just iounmap.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/irqchip/irq-tb10x.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/irqchip/irq-tb10x.c b/drivers/irqchip/irq-tb10x.c
index cdeaa13f1681..846663ac94a3 100644
--- a/drivers/irqchip/irq-tb10x.c
+++ b/drivers/irqchip/irq-tb10x.c
@@ -90,28 +90,14 @@ static int __init of_tb10x_init_irq(struct device_node *ictl,
 					struct device_node *parent)
 {
 	int i, ret, nrirqs = of_irq_count(ictl);
-	struct resource mem;
 	struct irq_chip_generic *gc;
 	struct irq_domain *domain;
 	void __iomem *reg_base;
 
-	if (of_address_to_resource(ictl, 0, &mem)) {
-		pr_err("%pOFn: No registers declared in DeviceTree.\n",
-			ictl);
-		return -EINVAL;
-	}
-
-	if (!request_mem_region(mem.start, resource_size(&mem),
-		ictl->full_name)) {
-		pr_err("%pOFn: Request mem region failed.\n", ictl);
-		return -EBUSY;
-	}
-
-	reg_base = ioremap(mem.start, resource_size(&mem));
-	if (!reg_base) {
-		ret = -EBUSY;
+	reg_base = of_io_request_and_map(ictl, 0, ictl->full_name);
+	if (IS_ERR(reg_base)) {
 		pr_err("%pOFn: ioremap failed.\n", ictl);
-		goto ioremap_fail;
+		return PTR_ERR(reg_base);
 	}
 
 	domain = irq_domain_create_linear(of_fwnode_handle(ictl), AB_IRQCTL_MAXIRQ,
@@ -169,8 +155,6 @@ static int __init of_tb10x_init_irq(struct device_node *ictl,
 	irq_domain_remove(domain);
 irq_domain_create_fail:
 	iounmap(reg_base);
-ioremap_fail:
-	release_mem_region(mem.start, resource_size(&mem));
 	return ret;
 }
 IRQCHIP_DECLARE(tb10x_intc, "abilis,tb10x-ictl", of_tb10x_init_irq);
-- 
2.54.0


             reply	other threads:[~2026-05-10 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 19:47 Rosen Penev [this message]
2026-05-11 13:49 ` [PATCH] irqchip/tb10x: simplify ioremap Thomas Gleixner

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=20260510194738.9810-1-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@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