Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip: armada-370-xp: properly request resources

Instead of using of_iomap(), we now use of_address_to_resource(),
request_mem_region() and ioremap(). This allows the corresponding I/O
regions to be properly requested and visible in /proc/iomem.

The main motivation for this change is that the introduction of the
MSI support requires us to get the physical address of the main
interrupt controller registers, so we will need the corresponding
'struct resource' anyway.

We also take this opportunity to change a panic() to BUG_ON(), in
order to be consistent with the rest of the driver.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Daniel Price <daniel.price@gmail.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>

authored by

Thomas Petazzoni and committed by
Jason Cooper
627dfcc2 272b98c6

+16 -4
+16 -4
drivers/irqchip/irq-armada-370-xp.c
··· 248 248 static int __init armada_370_xp_mpic_of_init(struct device_node *node, 249 249 struct device_node *parent) 250 250 { 251 + struct resource main_int_res, per_cpu_int_res; 251 252 u32 control; 252 253 253 - main_int_base = of_iomap(node, 0); 254 - per_cpu_int_base = of_iomap(node, 1); 254 + BUG_ON(of_address_to_resource(node, 0, &main_int_res)); 255 + BUG_ON(of_address_to_resource(node, 1, &per_cpu_int_res)); 255 256 257 + BUG_ON(!request_mem_region(main_int_res.start, 258 + resource_size(&main_int_res), 259 + node->full_name)); 260 + BUG_ON(!request_mem_region(per_cpu_int_res.start, 261 + resource_size(&per_cpu_int_res), 262 + node->full_name)); 263 + 264 + main_int_base = ioremap(main_int_res.start, 265 + resource_size(&main_int_res)); 256 266 BUG_ON(!main_int_base); 267 + 268 + per_cpu_int_base = ioremap(per_cpu_int_res.start, 269 + resource_size(&per_cpu_int_res)); 257 270 BUG_ON(!per_cpu_int_base); 258 271 259 272 control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); ··· 275 262 irq_domain_add_linear(node, (control >> 2) & 0x3ff, 276 263 &armada_370_xp_mpic_irq_ops, NULL); 277 264 278 - if (!armada_370_xp_mpic_domain) 279 - panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n"); 265 + BUG_ON(!armada_370_xp_mpic_domain); 280 266 281 267 irq_set_default_host(armada_370_xp_mpic_domain); 282 268