[tip: irq/cleanups] irqdomain: Use irq_domain_instantiate()'s return value as initializers

tip-bot2 for Jiri Slaby (SUSE)
2025-05-06T13:20:20Z

Commit-ID: 62ba4b718c7f032fdf418964916bb9cae291c5be
Gitweb: https://git.kernel.org/tip/62ba4b718c7f032fdf418964916bb9cae291c5be
Author: Jiri Slaby (SUSE) <jirislaby@kernel.org>
AuthorDate: Wed, 19 Mar 2025 10:29:43 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 06 May 2025 14:59:08 +02:00

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

---
include/linux/irqdomain.h | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index c8e55cd..1e38584 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -403,9 +403,8 @@ static inline struct irq_domain *irq_domain_create_nomap(struct fwnode_handle *f
.ops = ops,
.host_data = host_data,
};
- struct irq_domain *d;
+ struct irq_domain *d = irq_domain_instantiate(&info);

- d = irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}

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

- d = irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}

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

- d = irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}

@@ -554,18 +551,14 @@ static inline struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *
struct irq_domain_info info = {
.fwnode = fwnode,
.size = size,
- .hwirq_max = size,
+ .hwirq_max = size ? : ~0U,
.ops = ops,
.host_data = host_data,
.domain_flags = flags,
.parent = parent,
};
- struct irq_domain *d;
+ struct irq_domain *d = irq_domain_instantiate(&info);

- if (!info.size)
- info.hwirq_max = ~0U;
-
- d = irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}