mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: [PATCH v2] irq: generic-chip: provide irq_free_generic_chip()
Date: Wed,  8 Mar 2017 18:04:05 +0100	[thread overview]
Message-ID: <1488992645-9980-1-git-send-email-bgolaszewski@baylibre.com> (raw)

Some users of irq_alloc_generic_chip() are modules which can be
removed (e.g. gpio-ml-ioh) but have no means of freeing the allocated
generic chip. Provide a function for that.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
v1 -> v2:
- added the kernel doc

 include/linux/irq.h       |  1 +
 kernel/irq/generic-chip.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index f887351..04e5120 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -950,6 +950,7 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
 int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
 void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
 			     unsigned int clr, unsigned int set);
+void irq_free_generic_chip(struct irq_chip_generic *gc);
 
 struct irq_chip_generic *irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq);
 
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index ee32870..242836e 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -545,6 +545,18 @@ void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
 }
 EXPORT_SYMBOL_GPL(irq_remove_generic_chip);
 
+/**
+ * irq_free_generic_chip - Free the memory allocated for a chip
+ * @gc:		Generic irq chip
+ *
+ * Free the data previously allocated by irq_allocate_generic_chip().
+ */
+void irq_free_generic_chip(struct irq_chip_generic *gc)
+{
+	kfree(gc);
+}
+EXPORT_SYMBOL_GPL(irq_free_generic_chip);
+
 static struct irq_data *irq_gc_get_irq_data(struct irq_chip_generic *gc)
 {
 	unsigned int virq;
-- 
2.9.3

             reply	other threads:[~2017-03-08 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 17:04 Bartosz Golaszewski [this message]
2017-03-09  8:05 ` Marc Zyngier
2017-03-09 10:17 ` Thomas Gleixner
2017-03-09 10:35   ` Bartosz Golaszewski

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=1488992645-9980-1-git-send-email-bgolaszewski@baylibre.com \
    --to=bgolaszewski@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --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

all inboxes | Powered by JetHome®