All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <maz@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: [PATCH v2 4/6] irq/irq_sim: remove irq_domain_remove_sim()
Date: Tue, 11 Feb 2020 14:12:38 +0100	[thread overview]
Message-ID: <20200211131240.15853-5-brgl@bgdev.pl> (raw)
In-Reply-To: <20200211131240.15853-1-brgl@bgdev.pl>

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use the new remove() callback in irq_domain_ops to dispose of any
private data associated with the sim domain. This allows us to drop
the dedicated irq_domain_remove_sim() function and instead just use
the regular irq_domain_remove().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/iio/dummy/iio_dummy_evgen.c |  2 +-
 include/linux/irq_sim.h             |  1 -
 kernel/irq/irq_sim.c                | 32 ++++++++++++-----------------
 3 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/dummy/iio_dummy_evgen.c b/drivers/iio/dummy/iio_dummy_evgen.c
index 31c9e012abeb..47620bdae845 100644
--- a/drivers/iio/dummy/iio_dummy_evgen.c
+++ b/drivers/iio/dummy/iio_dummy_evgen.c
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(iio_dummy_evgen_get_regs);
 
 static void iio_dummy_evgen_free(void)
 {
-	irq_domain_remove_sim(iio_evgen->irq_sim_domain);
+	irq_domain_remove(iio_evgen->irq_sim_domain);
 	kfree(iio_evgen);
 }
 
diff --git a/include/linux/irq_sim.h b/include/linux/irq_sim.h
index 26bf6164dcc7..90e910fa2f91 100644
--- a/include/linux/irq_sim.h
+++ b/include/linux/irq_sim.h
@@ -21,7 +21,6 @@ struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
 struct irq_domain *devm_irq_domain_create_sim(struct device *dev,
 					      struct fwnode_handle *fwnode,
 					      unsigned int num_irqs);
-void irq_domain_remove_sim(struct irq_domain *domain);
 void irq_sim_fire(int virq);
 
 #endif /* _LINUX_IRQ_SIM_H */
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index 575c1e3d32a9..a4400aed5fb2 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -108,9 +108,19 @@ static void irq_sim_domain_unmap(struct irq_domain *domain, unsigned int virq)
 	kfree(irq_ctx);
 }
 
+static void irq_sim_domain_remove(struct irq_domain *domain)
+{
+	struct irq_sim_work_ctx *work_ctx = domain->host_data;
+
+	irq_work_sync(&work_ctx->work);
+	bitmap_free(work_ctx->pending);
+	kfree(work_ctx);
+}
+
 static const struct irq_domain_ops irq_sim_domain_ops = {
 	.map		= irq_sim_domain_map,
 	.unmap		= irq_sim_domain_unmap,
+	.remove		= irq_sim_domain_remove,
 };
 
 /**
@@ -122,6 +132,8 @@ static const struct irq_domain_ops irq_sim_domain_ops = {
  *
  * On success: return a new irq_domain object.
  * On failure: a negative errno wrapped with ERR_PTR().
+ *
+ * The returned domain can be freed using irq_domain_remove().
  */
 struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
 					 unsigned int num_irqs)
@@ -156,29 +168,11 @@ struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode,
 }
 EXPORT_SYMBOL_GPL(irq_domain_create_sim);
 
-/**
- * irq_domain_remove_sim - Deinitialize the interrupt simulator domain: free
- *                         the interrupt descriptors and allocated memory.
- *
- * @domain:     The interrupt simulator domain to tear down.
- */
-void irq_domain_remove_sim(struct irq_domain *domain)
-{
-	struct irq_sim_work_ctx *work_ctx = domain->host_data;
-
-	irq_work_sync(&work_ctx->work);
-	bitmap_free(work_ctx->pending);
-	kfree(work_ctx);
-
-	irq_domain_remove(domain);
-}
-EXPORT_SYMBOL_GPL(irq_domain_remove_sim);
-
 static void devm_irq_domain_release_sim(struct device *dev, void *res)
 {
 	struct irq_sim_devres *this = res;
 
-	irq_domain_remove_sim(this->domain);
+	irq_domain_remove(this->domain);
 }
 
 /**
-- 
2.25.0


  parent reply	other threads:[~2020-02-11 13:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 13:12 [PATCH v2 0/6] irq/irq_sim: try to improve the API Bartosz Golaszewski
2020-02-11 13:12 ` [PATCH v2 1/6] irq: make irq_domain_reset_irq_data() available even for non-V2 users Bartosz Golaszewski
2020-02-14  9:02   ` Thomas Gleixner
2020-02-14  9:31     ` Bartosz Golaszewski
2020-02-11 13:12 ` [PATCH v2 2/6] irq/irq_sim: simplify the API Bartosz Golaszewski
2020-02-11 13:12 ` [PATCH v2 3/6] irq/domain: add a new callback to domain ops Bartosz Golaszewski
2020-03-08 13:51   ` Marc Zyngier
2020-03-08 17:59     ` Bartosz Golaszewski
2020-03-12  8:15       ` Bartosz Golaszewski
2020-03-20  9:38         ` Bartosz Golaszewski
2020-02-11 13:12 ` Bartosz Golaszewski [this message]
2020-02-11 13:12 ` [PATCH v2 5/6] irq/domain: provide irq_domain_dispose_mappings() helper Bartosz Golaszewski
2020-02-11 13:12 ` [PATCH v2 6/6] irqchip: keystone: use irq_domain_dispose_mappings() Bartosz Golaszewski
2020-03-03  7:57 ` [PATCH v2 0/6] irq/irq_sim: try to improve the API Bartosz Golaszewski
2020-04-13 17:07   ` Jonathan Cameron
2020-04-14  8:37     ` 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=20200211131240.15853-5-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=bgolaszewski@baylibre.com \
    --cc=jason@lakedaemon.net \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pmeerw@pmeerw.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.