[PATCH v2] ARM: switch open-coded instances to platform_mem_driver

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jan 11 00:03:04 PST 2023


Now that platform_mem_driver ensures probe at mem_initcall level, we no
longer need to use the opencoded version.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - squash fixup correcting typo (Sascha)
---
 arch/arm/mach-imx/esdctl.c      | 13 +------------
 arch/arm/mach-stm32mp/ddrctrl.c | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index eb47957db0e5..a704250297bb 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -754,18 +754,7 @@ static struct driver imx_esdctl_driver = {
 	.id_table = imx_esdctl_ids,
 	.of_compatible = DRV_OF_COMPAT(imx_esdctl_dt_ids),
 };
-
-static int imx_esdctl_init(void)
-{
-	int ret;
-
-	ret = platform_driver_register(&imx_esdctl_driver);
-	if (ret)
-		return ret;
-
-	return of_devices_ensure_probed_by_dev_id(imx_esdctl_dt_ids);
-}
-mem_initcall(imx_esdctl_init);
+mem_platform_driver(imx_esdctl_driver);
 
 /*
  * The i.MX SoCs usually have two SDRAM chipselects. The following
diff --git a/arch/arm/mach-stm32mp/ddrctrl.c b/arch/arm/mach-stm32mp/ddrctrl.c
index ad4662c44d07..ffda1ba61f3c 100644
--- a/arch/arm/mach-stm32mp/ddrctrl.c
+++ b/arch/arm/mach-stm32mp/ddrctrl.c
@@ -157,15 +157,4 @@ static struct driver stm32mp1_ddr_driver = {
 	.probe  = stm32mp1_ddr_probe,
 	.of_compatible = DRV_OF_COMPAT(stm32mp1_ddr_dt_ids),
 };
-
-static int stm32mp1_ddr_init(void)
-{
-	int ret;
-
-	ret = platform_driver_register(&stm32mp1_ddr_driver);
-	if (ret)
-		return ret;
-
-	return of_devices_ensure_probed_by_dev_id(stm32mp1_ddr_dt_ids);
-}
-mem_initcall(stm32mp1_ddr_init);
+mem_platform_driver(stm32mp1_ddr_driver);
-- 
2.30.2




More information about the barebox mailing list