Skip to contentSkip to conversation

fpga: region: depopulate child devices on remove

PATCH New [email protected] 1 participant 1 message Sep 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fpga: region: depopulate child devices on remove

From: Guanxin Li <[email protected]>

of_fpga_region_probe() populates child platform devices under the FPGA region using of_platform_populate(), but the remove path does not depopulate them before unregistering the region.

Call of_platform_depopulate() before unregistering the FPGA region so that the child devices are properly unregistered and their references are released.

Fixes 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
---
 drivers/fpga/of-fpga-region.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/fpga/of-fpga-region.c +8 -8
index 9107a5b461d3..eb62427705b4 100644
@@ -424,14 +424,14 @@ static int of_fpga_region_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static void of_fpga_region_remove(struct platform_device *pdev)
-{
-	struct fpga_region *region = platform_get_drvdata(pdev);
-	struct fpga_manager *mgr = region->mgr;
-
-	fpga_region_unregister(region);
-	fpga_mgr_put(mgr);
-}
+static void of_fpga_region_remove(struct platform_device *pdev){
+ 	struct fpga_region *region = platform_get_drvdata(pdev);
+ 	struct fpga_manager *mgr = region->mgr;
+ 
+	of_platform_depopulate(&region->dev);
+ 	fpga_region_unregister(region);
+ 	fpga_mgr_put(mgr);
+ }
 
 static struct platform_driver of_fpga_region_driver = {
 	.probe = of_fpga_region_probe,
Signature · 1 line
2.43.0