[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250115085409.1629787-8-jirislaby@kernel.org>
Date: Wed, 15 Jan 2025 09:53:56 +0100
From: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
To: tglx@...utronix.de
Cc: maz@...nel.org,
linux-kernel@...r.kernel.org,
"Jiri Slaby (SUSE)" <jirislaby@...nel.org>
Subject: [PATCH 07/18] irqdomain: Make irq_domain_instantiate() returned domains an initializer
I was thinking whether add a \n before the 'return' or this. And this
looks both more compact and more readable.
Note 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@...nel.org>
---
include/linux/irqdomain.h | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 15919ca8b3cb..7903dbbbdef1 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -445,9 +445,8 @@ static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_no
.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;
}
@@ -464,9 +463,8 @@ static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_nod
.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;
}
@@ -483,9 +481,8 @@ static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node
.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;
}
@@ -501,9 +498,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;
}
@@ -517,9 +513,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;
}
@@ -637,18 +632,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;
-
- if (!info.size)
- info.hwirq_max = ~0U;
+ struct irq_domain *d = irq_domain_instantiate(&info);
- d = irq_domain_instantiate(&info);
return IS_ERR(d) ? NULL : d;
}
--
2.48.0
Powered by blists - more mailing lists