Skip to contentSkip to conversation

EDAC/altera: Use parent device for devres in altr_portb_setup()

PATCH Applied Dinh Nguyen 2 participants 5 messages Jun 17 – Jul 10

Subsystems (3)
lore
Share & tools
lore

Dinh Nguyen

author maintainer
#0 lore raw

PATCH 1/1 EDAC/altera: Use parent device for devres in altr_portb_setup()

Anchor the devres group and the devm-managed IRQ requests in altr_portb_setup() to the actual parent device (device->edac->dev) instead of the embedded struct device inside the copied per-port altr_edac_device_dev. This keeps devres_open_group(), devm_request_irq(), devres_remove_group() and devres_release_group() all referring to the same long-lived device so the group and the resources allocated inside it are torn down together.

Fixes 911049845d70 ("EDAC, altera: Add Arria10 SD-MMC EDAC support")
Assisted-by Claude:claude-opus-4-7
---
 drivers/edac/altera_edac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/edac/altera_edac.c +5 -5
index 4edd2088c2db..5914b2fd94d9 100644
@@ -1533,7 +1533,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 	altdev = dci->pvt_info;
 	*altdev = *device;
 
-	if (!devres_open_group(&altdev->ddev, altr_portb_setup, GFP_KERNEL))
+	if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL))
 		return -ENOMEM;
 
 	/* Update PortB specific values */
@@ -1562,7 +1562,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 		rc = -ENODEV;
 		goto err_release_group_1;
 	}
-	rc = devm_request_irq(&altdev->ddev, altdev->sb_irq,
+	rc = devm_request_irq(device->edac->dev, altdev->sb_irq,
 			      prv->ecc_irq_handler, IRQF_TRIGGER_HIGH,
 			      ecc_name, altdev);
 	if (rc) {
@@ -1585,7 +1585,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 		rc = -ENODEV;
 		goto err_release_group_1;
 	}
-	rc = devm_request_irq(&altdev->ddev, altdev->db_irq,
+	rc = devm_request_irq(device->edac->dev, altdev->db_irq,
 			      prv->ecc_irq_handler, IRQF_TRIGGER_HIGH,
 			      ecc_name, altdev);
 	if (rc) {
@@ -1605,13 +1605,13 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
 
 	list_add(&altdev->next, &altdev->edac->a10_ecc_devices);
 
-	devres_remove_group(&altdev->ddev, altr_portb_setup);
+	devres_remove_group(device->edac->dev, altr_portb_setup);
 
 	return 0;
 
 err_release_group_1:
 	edac_device_free_ctl_info(dci);
-	devres_release_group(&altdev->ddev, altr_portb_setup);
+	devres_release_group(device->edac->dev, altr_portb_setup);
 	edac_printk(KERN_ERR, EDAC_DEVICE,
 		    "%s:Error setting up EDAC device: %d\n", ecc_name, rc);
 	return rc;
Signature · 1 line
2.42.0.411.g813d9a9188
maintainer
#1 lore raw
Quoted 8 lines · Dinh Nguyen

Anchor the devres group and the devm-managed IRQ requests in altr_portb_setup() to the actual parent device (device->edac->dev) instead of the embedded struct device inside the copied per-port altr_edac_device_dev. This keeps devres_open_group(), devm_request_irq(), devres_remove_group() and devres_release_group() all referring to the same long-lived device so the group and the resources allocated inside it are torn down together.

Quoted 8 lines
Fixes 911049845d70 ("EDAC, altera: Add Arria10 SD-MMC EDAC support")
Assisted-by Claude:claude-opus-4-7
---
 drivers/edac/altera_edac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

How urgent is this? Can it wait until the merge window is over?

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
author maintainer
#2 lore raw
Quoted 18 lines · Borislav Petkov
Quoted 8 lines · Dinh Nguyen

Anchor the devres group and the devm-managed IRQ requests in altr_portb_setup() to the actual parent device (device->edac->dev) instead of the embedded struct device inside the copied per-port altr_edac_device_dev. This keeps devres_open_group(), devm_request_irq(), devres_remove_group() and devres_release_group() all referring to the same long-lived device so the group and the resources allocated inside it are torn down together.

Quoted 8 lines
Fixes 911049845d70 ("EDAC, altera: Add Arria10 SD-MMC EDAC support")
Assisted-by Claude:claude-opus-4-7
---
  drivers/edac/altera_edac.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 2 lines

How urgent is this? Can it wait until the merge window is over?

Not urgent at all. It can wait until v7.2-rc1.

Thanks,
Dinh

author maintainer
#3 lore raw
In reply to Borislav Petkov
Quoted 18 lines · Borislav Petkov
Quoted 8 lines · Dinh Nguyen

Anchor the devres group and the devm-managed IRQ requests in altr_portb_setup() to the actual parent device (device->edac->dev) instead of the embedded struct device inside the copied per-port altr_edac_device_dev. This keeps devres_open_group(), devm_request_irq(), devres_remove_group() and devres_release_group() all referring to the same long-lived device so the group and the resources allocated inside it are torn down together.

Quoted 8 lines
Fixes 911049845d70 ("EDAC, altera: Add Arria10 SD-MMC EDAC support")
Assisted-by Claude:claude-opus-4-7
---
  drivers/edac/altera_edac.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 2 lines

How urgent is this? Can it wait until the merge window is over?

Can you please pick this up for v7.2?

Thanks,

Dinh

maintainer Applied
#4 lore raw
Quoted 21 lines · Dinh Nguyen
Quoted 18 lines · Borislav Petkov
Quoted 16 lines · Dinh Nguyen

Anchor the devres group and the devm-managed IRQ requests in altr_portb_setup() to the actual parent device (device->edac->dev) instead of the embedded struct device inside the copied per-port altr_edac_device_dev. This keeps devres_open_group(), devm_request_irq(), devres_remove_group() and devres_release_group() all referring to the same long-lived device so the group and the resources allocated inside it are torn down together.

Fixes 911049845d70 ("EDAC, altera: Add Arria10 SD-MMC EDAC support")
Assisted-by Claude:claude-opus-4-7
---
  drivers/edac/altera_edac.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
Quoted 4 lines
Quoted 2 lines

How urgent is this? Can it wait until the merge window is over?

Can you please pick this up for v7.2?

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette