lkml.org 
[lkml]   [2020]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/6] irq/domain: add a new callback to domain ops
Date
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Add the remove() callback to irq_domain_ops which can be used to
automatically dispose of any host data associated with the domain when
irq_domain_remove() is called.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
include/linux/irqdomain.h | 3 +++
kernel/irq/irqdomain.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 20d38621e2f8..fbc25f464f62 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -95,6 +95,8 @@ enum irq_domain_bus_token {
* @unmap: Dispose of such a mapping
* @xlate: Given a device tree node and interrupt specifier, decode
* the hardware irq number and linux irq type value.
+ * @remove: Free any custom resources associated with this domain. This is
+ * called from irq_domain_remove() before any other code.
*
* Functions below are provided by the driver and called whenever a new mapping
* is created or an old mapping is disposed. The driver can then proceed to
@@ -126,6 +128,7 @@ struct irq_domain_ops {
void (*debug_show)(struct seq_file *m, struct irq_domain *d,
struct irq_data *irqd, int ind);
#endif
+ void (*remove)(struct irq_domain *d);
};

extern struct irq_domain_ops irq_generic_chip_ops;
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 039427c98af8..b391d2e65bdd 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -242,6 +242,9 @@ EXPORT_SYMBOL_GPL(__irq_domain_add);
*/
void irq_domain_remove(struct irq_domain *domain)
{
+ if (domain->ops->remove)
+ domain->ops->remove(domain);
+
mutex_lock(&irq_domain_mutex);
debugfs_remove_domain_dir(domain);

--
2.25.0
\
 
 \ /
  Last update: 2020-02-11 14:13    [W:0.052 / U:2.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site