The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] irqchip/tb10x: simplify ioremap
@ 2026-05-10 19:47 Rosen Penev
  2026-05-11 13:49 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-05-10 19:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner

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


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

end of thread, other threads:[~2026-05-11 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 19:47 [PATCH] irqchip/tb10x: simplify ioremap Rosen Penev
2026-05-11 13:49 ` Thomas Gleixner

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