Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730756

[PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal

From Martin Kaiser <martin@kaiser.cx>
Newsgroups linux.kernel
Subject [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal
Date 2017-09-12 11:10 +0200
Message-ID <uoPmH-7Mg-67@gated-at.bofh.it> (permalink)
References <uoPmG-7Mg-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When fsl-imx25-tsadc is compiled as a module, unloading and reloading
the module will lead to a crash.

Add a removal function which clears the irq handler and removes the irq
domain. With this cleanup in place, it's possible to unload and reload
the module.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/mfd/fsl-imx25-tsadc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c
index 14189ef..a6423bd 100644
--- a/drivers/mfd/fsl-imx25-tsadc.c
+++ b/drivers/mfd/fsl-imx25-tsadc.c
@@ -179,6 +179,19 @@ static int mx25_tsadc_probe(struct platform_device *pdev)
 	return devm_of_platform_populate(dev);
 }
 
+static int __exit mx25_tsadc_remove(struct platform_device *pdev)
+{
+	struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
+	int irq = platform_get_irq(pdev, 0);
+
+	if (irq) {
+		irq_set_chained_handler_and_data(irq, NULL, NULL);
+		irq_domain_remove(tsadc->domain);
+	}
+
+	return 0;
+}
+
 static const struct of_device_id mx25_tsadc_ids[] = {
 	{ .compatible = "fsl,imx25-tsadc" },
 	{ /* Sentinel */ }
@@ -191,6 +204,7 @@ static struct platform_driver mx25_tsadc_driver = {
 		.of_match_table = of_match_ptr(mx25_tsadc_ids),
 	},
 	.probe = mx25_tsadc_probe,
+	.remove = __exit_p(mx25_tsadc_remove),
 };
 module_platform_driver(mx25_tsadc_driver);
 
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] mfd: fsl-imx25: set irq handler and data in one go Martin Kaiser <martin@kaiser.cx> - 2017-09-12 11:10 +0200
  [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal Martin Kaiser <martin@kaiser.cx> - 2017-09-12 11:10 +0200
    Re: [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal Lee Jones <lee.jones@linaro.org> - 2017-09-14 11:30 +0200
      Re: [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during  removal Martin Kaiser <martin@kaiser.cx> - 2017-09-14 23:10 +0200
        Re: [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal Lee Jones <lee.jones@linaro.org> - 2017-09-18 11:00 +0200
  Re: [PATCH 1/2] mfd: fsl-imx25: set irq handler and data in one go Lee Jones <lee.jones@linaro.org> - 2017-09-14 11:30 +0200
  [PATCH v2 2/2] mfd: fsl-imx25: clean up irq settings during removal Martin Kaiser <martin@kaiser.cx> - 2017-09-19 08:30 +0200
    Re: [PATCH v2 2/2] mfd: fsl-imx25: clean up irq settings during  removal Lucas Stach <l.stach@pengutronix.de> - 2017-09-19 10:30 +0200
  [PATCH v2 1/2] mfd: fsl-imx25: set irq handler and data in one go Martin Kaiser <martin@kaiser.cx> - 2017-09-19 08:30 +0200
    Re: [PATCH v2 1/2] mfd: fsl-imx25: set irq handler and data in one  go Lucas Stach <l.stach@pengutronix.de> - 2017-09-19 10:20 +0200
  Re: [PATCH v3 2/2] mfd: fsl-imx25: clean up irq settings during  removal Lucas Stach <l.stach@pengutronix.de> - 2017-09-19 14:50 +0200
  [PATCH v3 1/2] mfd: fsl-imx25: set irq handler and data in one go Martin Kaiser <martin@kaiser.cx> - 2017-09-19 14:50 +0200
    [PATCH v3 2/2] mfd: fsl-imx25: clean up irq settings during removal Martin Kaiser <martin@kaiser.cx> - 2017-09-19 14:50 +0200

csiph-web