mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
soc: fsl: qe_ports_ic: Add missing cleanup on device removal
Add a devm action handler to properly clean up the irq_domain and
chained handler when the device is removed.
Fixes: f0bcd784e1 ("soc: fsl: qe: Add an interrupt controller for QUICC Engine Ports")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://lore.kernel.org/r/20260310-qe_ports_ic-v1-1-608293026561@gmail.com
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
This commit is contained in:
parent
cf8e9203cc
commit
7dad18a179
|
|
@ -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[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user