public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] soc: fsl: qe_ports_ic: Add missing cleanup on device removal
@ 2026-03-09 16:25 Felix Gu
  2026-03-28 12:44 ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-03-09 16:25 UTC (permalink / raw)
  To: Qiang Zhao, Christophe Leroy (CS GROUP)
  Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Felix Gu

Add a devm action handler to properly clean up the irq_domain and
chained handler when the device is removed.

Fixes: f0bcd784e1b7 ("soc: fsl: qe: Add an interrupt controller for QUICC Engine Ports")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/soc/fsl/qe/qe_ports_ic.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe_ports_ic.c b/drivers/soc/fsl/qe/qe_ports_ic.c
index 8e2107e2cde5..5e3fae19f314 100644
--- a/drivers/soc/fsl/qe/qe_ports_ic.c
+++ b/drivers/soc/fsl/qe/qe_ports_ic.c
@@ -17,6 +17,7 @@
 struct qepic_data {
 	void __iomem *reg;
 	struct irq_domain *host;
+	int irq;
 };
 
 static void qepic_mask(struct irq_data *d)
@@ -92,11 +93,18 @@ static const struct irq_domain_ops qepic_host_ops = {
 	.map = qepic_host_map,
 };
 
+static void qepic_remove(void *res)
+{
+	struct qepic_data *data = res;
+
+	irq_set_chained_handler_and_data(data->irq, NULL, NULL);
+	irq_domain_remove(data->host);
+}
+
 static int qepic_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct qepic_data *data;
-	int irq;
 
 	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
@@ -106,17 +114,18 @@ static int qepic_probe(struct platform_device *pdev)
 	if (IS_ERR(data->reg))
 		return PTR_ERR(data->reg);
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
+	data->irq = platform_get_irq(pdev, 0);
+	if (data->irq < 0)
+		return data->irq;
 
 	data->host = irq_domain_add_linear(dev->of_node, 32, &qepic_host_ops, data);
 	if (!data->host)
 		return -ENODEV;
 
-	irq_set_chained_handler_and_data(irq, qepic_cascade, data);
+	irq_set_chained_handler_and_data(data->irq, qepic_cascade, data);
+
+	return devm_add_action_or_reset(dev, qepic_remove, data);
 
-	return 0;
 }
 
 static const struct of_device_id qepic_match[] = {

---
base-commit: a0ae2a256046c0c5d3778d1a194ff2e171f16e5f
change-id: 20260310-qe_ports_ic-ca4c98bd1c4f

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: fsl: qe_ports_ic: Add missing cleanup on device removal
  2026-03-09 16:25 [PATCH] soc: fsl: qe_ports_ic: Add missing cleanup on device removal Felix Gu
@ 2026-03-28 12:44 ` Christophe Leroy (CS GROUP)
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-03-28 12:44 UTC (permalink / raw)
  To: Felix Gu, Qiang Zhao; +Cc: linuxppc-dev, linux-arm-kernel, linux-kernel



Le 09/03/2026 à 17:25, Felix Gu a écrit :
> [Vous ne recevez pas souvent de courriers de ustc.gu@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> Add a devm action handler to properly clean up the irq_domain and
> chained handler when the device is removed.
> 
> Fixes: f0bcd784e1b7 ("soc: fsl: qe: Add an interrupt controller for QUICC Engine Ports")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
>   drivers/soc/fsl/qe/qe_ports_ic.c | 21 +++++++++++++++------
>   1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qe/qe_ports_ic.c b/drivers/soc/fsl/qe/qe_ports_ic.c
> index 8e2107e2cde5..5e3fae19f314 100644
> --- a/drivers/soc/fsl/qe/qe_ports_ic.c
> +++ b/drivers/soc/fsl/qe/qe_ports_ic.c
> @@ -17,6 +17,7 @@
>   struct qepic_data {
>          void __iomem *reg;
>          struct irq_domain *host;
> +       int irq;
>   };
> 
>   static void qepic_mask(struct irq_data *d)
> @@ -92,11 +93,18 @@ static const struct irq_domain_ops qepic_host_ops = {
>          .map = qepic_host_map,
>   };
> 
> +static void qepic_remove(void *res)
> +{
> +       struct qepic_data *data = res;
> +
> +       irq_set_chained_handler_and_data(data->irq, NULL, NULL);
> +       irq_domain_remove(data->host);
> +}
> +
>   static int qepic_probe(struct platform_device *pdev)
>   {
>          struct device *dev = &pdev->dev;
>          struct qepic_data *data;
> -       int irq;
> 
>          data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
>          if (!data)
> @@ -106,17 +114,18 @@ static int qepic_probe(struct platform_device *pdev)
>          if (IS_ERR(data->reg))
>                  return PTR_ERR(data->reg);
> 
> -       irq = platform_get_irq(pdev, 0);
> -       if (irq < 0)
> -               return irq;
> +       data->irq = platform_get_irq(pdev, 0);
> +       if (data->irq < 0)
> +               return data->irq;
> 
>          data->host = irq_domain_add_linear(dev->of_node, 32, &qepic_host_ops, data);
>          if (!data->host)
>                  return -ENODEV;
> 
> -       irq_set_chained_handler_and_data(irq, qepic_cascade, data);
> +       irq_set_chained_handler_and_data(data->irq, qepic_cascade, data);
> +
> +       return devm_add_action_or_reset(dev, qepic_remove, data);
> 
> -       return 0;
>   }
> 
>   static const struct of_device_id qepic_match[] = {
> 
> ---
> base-commit: a0ae2a256046c0c5d3778d1a194ff2e171f16e5f
> change-id: 20260310-qe_ports_ic-ca4c98bd1c4f
> 
> Best regards,
> --
> Felix Gu <ustc.gu@gmail.com>
> 

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-28 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 16:25 [PATCH] soc: fsl: qe_ports_ic: Add missing cleanup on device removal Felix Gu
2026-03-28 12:44 ` Christophe Leroy (CS GROUP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox