Skip to content

Commit 18e743e

Browse files
Jiri Slaby (SUSE)KAGA-KOKO
authored andcommitted
irqdomain: Use irq_domain_instantiate()'s return value as initializers
This makes the code more compact. Note that irq_domain_create_hierarchy()'s handling of size is now part of info's initializer (using the ternary operator). That makes more sense while reading it. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250319092951.37667-51-jirislaby@kernel.org
1 parent 14ebb11 commit 18e743e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

include/linux/irqdomain.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,8 @@ static inline struct irq_domain *irq_domain_create_nomap(struct fwnode_handle *f
403403
.ops = ops,
404404
.host_data = host_data,
405405
};
406-
struct irq_domain *d;
406+
struct irq_domain *d = irq_domain_instantiate(&info);
407407

408-
d = irq_domain_instantiate(&info);
409408
return IS_ERR(d) ? NULL : d;
410409
}
411410

@@ -424,9 +423,8 @@ static inline struct irq_domain *irq_domain_create_linear(struct fwnode_handle *
424423
.ops = ops,
425424
.host_data = host_data,
426425
};
427-
struct irq_domain *d;
426+
struct irq_domain *d = irq_domain_instantiate(&info);
428427

429-
d = irq_domain_instantiate(&info);
430428
return IS_ERR(d) ? NULL : d;
431429
}
432430

@@ -440,9 +438,8 @@ static inline struct irq_domain *irq_domain_create_tree(struct fwnode_handle *fw
440438
.ops = ops,
441439
.host_data = host_data,
442440
};
443-
struct irq_domain *d;
441+
struct irq_domain *d = irq_domain_instantiate(&info);
444442

445-
d = irq_domain_instantiate(&info);
446443
return IS_ERR(d) ? NULL : d;
447444
}
448445

@@ -554,18 +551,14 @@ static inline struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *
554551
struct irq_domain_info info = {
555552
.fwnode = fwnode,
556553
.size = size,
557-
.hwirq_max = size,
554+
.hwirq_max = size ? : ~0U,
558555
.ops = ops,
559556
.host_data = host_data,
560557
.domain_flags = flags,
561558
.parent = parent,
562559
};
563-
struct irq_domain *d;
560+
struct irq_domain *d = irq_domain_instantiate(&info);
564561

565-
if (!info.size)
566-
info.hwirq_max = ~0U;
567-
568-
d = irq_domain_instantiate(&info);
569562
return IS_ERR(d) ? NULL : d;
570563
}
571564

0 commit comments

Comments
 (0)