lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <171863227259.10875.9213959710476410531.tip-bot2@tip-bot2>
Date: Mon, 17 Jun 2024 13:51:12 -0000
From: "tip-bot2 for Herve Codina" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
 Herve Codina <herve.codina@...tlin.com>, x86@...nel.org,
 linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/core] irqdomain: Convert __irq_domain_create() to use
 struct irq_domain_info

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     24a4f4e48557dddf2bb722df7b01184efc92a6a7
Gitweb:        https://git.kernel.org/tip/24a4f4e48557dddf2bb722df7b01184efc92a6a7
Author:        Herve Codina <herve.codina@...tlin.com>
AuthorDate:    Fri, 14 Jun 2024 19:32:07 +02:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 17 Jun 2024 15:48:13 +02:00

irqdomain: Convert __irq_domain_create() to use struct irq_domain_info

The existing __irq_domain_create() use a bunch of parameters to create
an irq domain.

With the introduction of irq_domain_info structure, these parameters are
available in the information structure itself.
Using directly this information structure allows future flexibility to
add other parameters in a simple way without the need to change the
__irq_domain_create() prototype.

Convert __irq_domain_create() to use the information structure.

[ tglx: Fixup struct initializer ]

Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Herve Codina <herve.codina@...tlin.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/20240614173232.1184015-7-herve.codina@bootlin.com

---
 kernel/irq/irqdomain.c | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index a7be776..0eda48f 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -179,45 +179,40 @@ static int irq_domain_set_name(struct irq_domain *domain,
 	return 0;
 }
 
-static struct irq_domain *__irq_domain_create(struct fwnode_handle *fwnode,
-					      unsigned int size,
-					      irq_hw_number_t hwirq_max,
-					      int direct_max,
-					      const struct irq_domain_ops *ops,
-					      void *host_data)
+static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info)
 {
 	struct irq_domain *domain;
 	int err;
 
-	if (WARN_ON((size && direct_max) ||
-		    (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max) ||
-		    (direct_max && direct_max != hwirq_max)))
+	if (WARN_ON((info->size && info->direct_max) ||
+		    (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) ||
+		    (info->direct_max && info->direct_max != info->hwirq_max)))
 		return NULL;
 
-	domain = kzalloc_node(struct_size(domain, revmap, size),
-			      GFP_KERNEL, of_node_to_nid(to_of_node(fwnode)));
+	domain = kzalloc_node(struct_size(domain, revmap, info->size),
+			      GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode)));
 	if (!domain)
 		return NULL;
 
-	err = irq_domain_set_name(domain, fwnode);
+	err = irq_domain_set_name(domain, info->fwnode);
 	if (err) {
 		kfree(domain);
 		return NULL;
 	}
 
-	domain->fwnode = fwnode_handle_get(fwnode);
+	domain->fwnode = fwnode_handle_get(info->fwnode);
 	fwnode_dev_initialized(domain->fwnode, true);
 
 	/* Fill structure */
 	INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL);
-	domain->ops = ops;
-	domain->host_data = host_data;
-	domain->hwirq_max = hwirq_max;
+	domain->ops = info->ops;
+	domain->host_data = info->host_data;
+	domain->hwirq_max = info->hwirq_max;
 
-	if (direct_max)
+	if (info->direct_max)
 		domain->flags |= IRQ_DOMAIN_FLAG_NO_MAP;
 
-	domain->revmap_size = size;
+	domain->revmap_size = info->size;
 
 	/*
 	 * Hierarchical domains use the domain lock of the root domain
@@ -264,8 +259,7 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info)
 {
 	struct irq_domain *domain;
 
-	domain = __irq_domain_create(info->fwnode, info->size, info->hwirq_max,
-				     info->direct_max, info->ops, info->host_data);
+	domain = __irq_domain_create(info);
 	if (!domain)
 		return ERR_PTR(-ENOMEM);
 
@@ -1204,13 +1198,19 @@ struct irq_domain *irq_domain_create_hierarchy(struct irq_domain *parent,
 					    const struct irq_domain_ops *ops,
 					    void *host_data)
 {
+	struct irq_domain_info info = {
+		.fwnode		= fwnode,
+		.size		= size,
+		.hwirq_max	= size,
+		.ops		= ops,
+		.host_data	= host_data,
+	};
 	struct irq_domain *domain;
 
-	if (size)
-		domain = __irq_domain_create(fwnode, size, size, 0, ops, host_data);
-	else
-		domain = __irq_domain_create(fwnode, 0, ~0, 0, ops, host_data);
+	if (!info.size)
+		info.hwirq_max = ~0U;
 
+	domain = __irq_domain_create(&info);
 	if (domain) {
 		if (parent)
 			domain->root = parent->root;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ