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>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH 13/18] irqdomain.h: Improve kernel-docs of functions
Date: Wed, 15 Jan 2025 09:54:02 +0100	[thread overview]
Message-ID: <20250115085409.1629787-14-jirislaby@kernel.org> (raw)
In-Reply-To: <20250115085409.1629787-1-jirislaby@kernel.org>

Many of irqdomain.h's functions are referenced in Documentation/ but are
not properly documented. Therefore, document these.

And use "Returns:" tag consistently, so that it is properly generated to
the resulting docs.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>
---
 include/linux/irqdomain.h | 62 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ca4628fa269d..6de8a9f3fecf 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -417,6 +417,26 @@ static inline struct irq_domain *irq_find_host(struct device_node *node)
 	return d;
 }
 
+/**
+ * irq_domain_add_simple_of_node() - Register an irq_domain and optionally map a range of irqs
+ * @of_node: pointer to interrupt controller's device tree node.
+ * @size: total number of irqs in mapping
+ * @first_irq: first number of irq block assigned to the domain,
+ *	pass zero to assign irqs on-the-fly. If first_irq is non-zero, then
+ *	pre-map all of the irqs in the domain to virqs starting at first_irq.
+ * @ops: domain callbacks
+ * @host_data: Controller private data pointer
+ *
+ * Allocates an irq_domain, and optionally if @first_irq is positive then also
+ * allocate irq_descs and map all of the hwirqs to virqs starting at @first_irq.
+ *
+ * This is intended to implement the expected behaviour for most
+ * interrupt controllers. If device tree is used, then @first_irq will be 0 and
+ * irqs get mapped dynamically on the fly. However, if the controller requires
+ * static virq assignments (non-DT boot) then it will set that up correctly.
+ *
+ * Returns: Newly created irq_domain
+ */
 static inline struct irq_domain *irq_domain_add_simple_of_node(struct device_node *of_node,
 						       unsigned int size,
 						       unsigned int first_irq,
@@ -486,6 +506,15 @@ static inline struct irq_domain *irq_domain_add_tree_of_node(struct device_node
 	return IS_ERR(d) ? NULL : d;
 }
 
+/**
+ * irq_domain_add_linear_fwnode() - Allocate and register a linear revmap irq_domain.
+ * @fwnode: pointer to interrupt controller's FW node.
+ * @size: Number of interrupts in the domain.
+ * @ops: map/unmap domain callbacks
+ * @host_data: Controller private data pointer
+ *
+ * Returns: Newly created irq_domain
+ */
 static inline struct irq_domain *irq_domain_add_linear_fwnode(struct fwnode_handle *fwnode,
 					 unsigned int size,
 					 const struct irq_domain_ops *ops,
@@ -532,6 +561,18 @@ unsigned int irq_create_mapping_affinity(struct irq_domain *domain,
 unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec);
 void irq_dispose_mapping(unsigned int virq);
 
+/**
+ * irq_create_mapping() - Map a hardware interrupt into linux irq space
+ * @domain: domain owning this hardware interrupt or NULL for default domain
+ * @hwirq: hardware irq number in that domain space
+ *
+ * Only one mapping per hardware interrupt is permitted.
+ *
+ * If the sense/trigger is to be specified, set_irq_type() should be called
+ * on the number returned from that call.
+ *
+ * Returns: Linux irq number or 0 on error
+ */
 static inline unsigned int irq_create_mapping(struct irq_domain *domain,
 					      irq_hw_number_t hwirq)
 {
@@ -542,6 +583,13 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domain *domain,
 				       irq_hw_number_t hwirq,
 				       unsigned int *irq);
 
+/**
+ * irq_resolve_mapping() - Find a linux irq from a hw irq number.
+ * @domain: domain owning this hardware interrupt
+ * @hwirq: hardware irq number in that domain space
+ *
+ * Returns: Interrupt descriptor
+ */
 static inline struct irq_desc *irq_resolve_mapping(struct irq_domain *domain,
 						   irq_hw_number_t hwirq)
 {
@@ -552,6 +600,8 @@ static inline struct irq_desc *irq_resolve_mapping(struct irq_domain *domain,
  * irq_find_mapping() - Find a linux irq from a hw irq number.
  * @domain: domain owning this hardware interrupt
  * @hwirq: hardware irq number in that domain space
+ *
+ * Returns: Linux irq number or 0 if not found
  */
 static inline unsigned int irq_find_mapping(struct irq_domain *domain,
 					    irq_hw_number_t hwirq)
@@ -614,7 +664,8 @@ void irq_domain_reset_irq_data(struct irq_data *irq_data);
  *
  * If successful the parent is associated to the new domain and the
  * domain flags are set.
- * Returns pointer to IRQ domain, or NULL on failure.
+ *
+ * Returns: A pointer to IRQ domain, or %NULL on failure.
  */
 static inline struct irq_domain *irq_domain_add_hierarchy_fwnode(struct irq_domain *parent,
 					    unsigned int flags,
@@ -657,6 +708,15 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs);
 int irq_domain_activate_irq(struct irq_data *irq_data, bool early);
 void irq_domain_deactivate_irq(struct irq_data *irq_data);
 
+/**
+ * irq_domain_alloc_irqs - Allocate IRQs from domain
+ * @domain:	domain to allocate from
+ * @nr_irqs:	number of IRQs to allocate
+ * @node:	NUMA node id for memory allocation
+ * @arg:	domain specific argument
+ *
+ * See __irq_domain_alloc_irqs()' documentation.
+ */
 static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
 			unsigned int nr_irqs, int node, void *arg)
 {
-- 
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 ` [PATCH 07/18] irqdomain: Make irq_domain_instantiate() returned domains an initializer Jiri Slaby (SUSE)
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 ` Jiri Slaby (SUSE) [this message]
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-14-jirislaby@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=rdunlap@infradead.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