public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: tglx@linutronix.de
Cc: maz@kernel.org, linux-kernel@vger.kernel.org,
	"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Subject: [PATCH 07/18] irqdomain: Make irq_domain_instantiate() returned domains an initializer
Date: Wed, 15 Jan 2025 09:53:56 +0100	[thread overview]
Message-ID: <20250115085409.1629787-8-jirislaby@kernel.org> (raw)
In-Reply-To: <20250115085409.1629787-1-jirislaby@kernel.org>

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@kernel.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


  parent reply	other threads:[~2025-01-15  8:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15  8:53 [PATCH 00/18] irqdomain: couple cleanups and documentation Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 01/18] irqdomain.h: Remove extern from function declarations Jiri Slaby (SUSE)
2025-03-10  9:06   ` [tip: irq/core] irqdomain: " tip-bot2 for Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 02/18] irqdomain: Rename irq_set_default_host() to irq_set_default_domain() Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 03/18] irqdomain: Rename irq_get_default_host() to irq_get_default_domain() Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 04/18] irqdomain.h: Stop using 'host' for domain Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 05/18] irqdomain: Drop of_node_to_fwnode() Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 06/18] irqdomain: Make a couple of functions an inline Jiri Slaby (SUSE)
2025-01-15  8:53 ` Jiri Slaby (SUSE) [this message]
2025-01-15  8:53 ` [PATCH 08/18] irqdomain: Make struct irq_domain_info variables const Jiri Slaby (SUSE)
2025-01-15  8:53 ` [PATCH 09/18] irqdomain: Rename _add functions to _add_*_of_node Jiri Slaby (SUSE)
2025-02-06 16:22   ` tglx
2025-02-20  8:17     ` Jiri Slaby
2025-02-20 14:23       ` Thomas Gleixner
2025-01-15  8:53 ` [PATCH 10/18] irqdomain: Rename _create functions to _add_*_fwnode Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 11/18] irqdomain: Rename _instantiate functions to _add Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 12/18] irqdomain: Switch away from irq_linear_revmap() and drop it Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 13/18] irqdomain.h: Improve kernel-docs of functions Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 14/18] docs: irq/concepts: Add commas and reflow Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 15/18] docs: irq/concepts: Minor improvements Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 16/18] docs: irq-domain.rst: Simple improvements Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 17/18] docs: irqdomain: Update Jiri Slaby (SUSE)
2025-01-15  8:54 ` [PATCH 18/18] irqdomain.c: Fix kernel-doc and add it to Documentation Jiri Slaby (SUSE)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250115085409.1629787-8-jirislaby@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox