Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH wireless-next] bcma: host_soc: convert to devres and drop remove callback
@ 2026-06-29  3:18 Rosen Penev
  0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-06-29  3:18 UTC (permalink / raw)
  To: linux-wireless; +Cc: Rafał Miłecki, open list

Replace of_iomap with devm_platform_ioremap_resource to let
the device resource framework handle unmapping. Use
devm_add_action_or_reset to schedule bcma_bus_unregister on
device removal, allowing the explicit remove callback to be
dropped entirely.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/bcma/host_soc.c | 42 ++++++++++++-----------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)

diff --git a/drivers/bcma/host_soc.c b/drivers/bcma/host_soc.c
index 20b1816c570b..411cfbf53f7b 100644
--- a/drivers/bcma/host_soc.c
+++ b/drivers/bcma/host_soc.c
@@ -188,22 +188,20 @@ int __init bcma_host_soc_register(struct bcma_soc *soc)
 
 int __init bcma_host_soc_init(struct bcma_soc *soc)
 {
-	struct bcma_bus *bus = &soc->bus;
-	int err;
+	return bcma_bus_early_register(&soc->bus);
+}
 
-	/* Scan bus and initialize it */
-	err = bcma_bus_early_register(bus);
-	if (err)
-		iounmap(bus->mmio);
+#ifdef CONFIG_OF
+static void bcma_host_soc_unregister(void *data)
+{
+	struct bcma_bus *bus = data;
 
-	return err;
+	bcma_bus_unregister(bus);
 }
 
-#ifdef CONFIG_OF
 static int bcma_host_soc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	struct bcma_bus *bus;
 	int err;
 
@@ -215,9 +213,9 @@ static int bcma_host_soc_probe(struct platform_device *pdev)
 	bus->dev = dev;
 
 	/* Map MMIO */
-	bus->mmio = of_iomap(np, 0);
-	if (!bus->mmio)
-		return -ENOMEM;
+	bus->mmio = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(bus->mmio))
+		return PTR_ERR(bus->mmio);
 
 	/* Host specific */
 	bus->hosttype = BCMA_HOSTTYPE_SOC;
@@ -229,24 +227,9 @@ static int bcma_host_soc_probe(struct platform_device *pdev)
 	/* Register */
 	err = bcma_bus_register(bus);
 	if (err)
-		goto err_unmap_mmio;
-
-	platform_set_drvdata(pdev, bus);
-
-	return err;
-
-err_unmap_mmio:
-	iounmap(bus->mmio);
-	return err;
-}
-
-static void bcma_host_soc_remove(struct platform_device *pdev)
-{
-	struct bcma_bus *bus = platform_get_drvdata(pdev);
+		return err;
 
-	bcma_bus_unregister(bus);
-	iounmap(bus->mmio);
-	platform_set_drvdata(pdev, NULL);
+	return devm_add_action_or_reset(dev, bcma_host_soc_unregister, bus);
 }
 
 static const struct of_device_id bcma_host_soc_of_match[] = {
@@ -261,7 +244,6 @@ static struct platform_driver bcma_host_soc_driver = {
 		.of_match_table = bcma_host_soc_of_match,
 	},
 	.probe		= bcma_host_soc_probe,
-	.remove		= bcma_host_soc_remove,
 };
 
 int __init bcma_host_soc_register_driver(void)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-29  3:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29  3:18 [PATCH wireless-next] bcma: host_soc: convert to devres and drop remove callback Rosen Penev

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