mfd: omap-usb-host: fix OF populate on driver rebind
Subsystems (3)
PATCH 1/1 mfd: omap-usb-host: fix OF populate on driver rebind
Since commit c6e126de43e7 ("of: Keep track of populated platform devices") child devices will not be created by of_platform_populate() if the devices had previously been deregistered individually so that the OF_POPULATED flag is still set in the corresponding OF nodes.
Switch to using of_platform_depopulate() instead of open coding so that the child devices are created if the driver is rebound.
--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mfd/omap-usb-host.c +4 -2
@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev); +else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); }static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
Signature · 1 line
2.51.2
Quoted 11 lines · On Fri, 19 Dec 2025 12:07:14 +0100 Johan Hovold <[email protected]> wrote:
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>
Lee Jones
maintainerQuoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);
What on earth is this driver even doing in MFD?
Nightmare - quick dig, bury it!
Signature · 1 line
Lee Jones [李琼斯]
Lee Jones
maintainerQuoted 32 lines · Lee Jones
Quoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?
Quoted 6 lines
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);What on earth is this driver even doing in MFD?
Nightmare - quick dig, bury it!
Is the old platform method even supported anymore?
$ git grep \"usbhs_omap\"" drivers/mfd/omap-usb-host.c:#define USBHS_DRIVER_NAME "usbhs_omap"
Signature · 1 line
Lee Jones [李琼斯]
Andreas Kemnade
maintainerQuoted 39 lines · On Fri, 9 Jan 2026 16:39:39 +0000 Lee Jones <[email protected]> wrote:
Quoted 37 lines · Lee Jones
Quoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);What on earth is this driver even doing in MFD?
Quoted 7 lines
Quoted 1 line
Nightmare - quick dig, bury it!
Is the old platform method even supported anymore?
$ git grep \"usbhs_omap\"" drivers/mfd/omap-usb-host.c:#define USBHS_DRIVER_NAME "usbhs_omap"
:~/linux/arch/arm/boot/dts/ti/omap$ grep ti,usbhs-host *.dtsi omap3.dtsi: compatible = "ti,usbhs-host"; omap4-l4.dtsi: compatible = "ti,usbhs-host"; omap5-l4.dtsi: compatible = "ti,usbhs-host";
So it is still in use.
Regards,
Andreas
Andreas Kemnade
maintainerQuoted 49 lines · On Fri, 9 Jan 2026 18:18:39 +0100 Andreas Kemnade <[email protected]> wrote:
Quoted 39 lines · On Fri, 9 Jan 2026 16:39:39 +0000 Lee Jones <[email protected]> wrote:
Quoted 37 lines · Lee Jones
Quoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);What on earth is this driver even doing in MFD?
Quoted 7 lines
Quoted 1 line
Nightmare - quick dig, bury it!
Is the old platform method even supported anymore?
$ git grep \"usbhs_omap\"" drivers/mfd/omap-usb-host.c:#define USBHS_DRIVER_NAME "usbhs_omap"
Quoted 7 lines
:~/linux/arch/arm/boot/dts/ti/omap$ grep ti,usbhs-host *.dtsi omap3.dtsi: compatible = "ti,usbhs-host"; omap4-l4.dtsi: compatible = "ti,usbhs-host"; omap5-l4.dtsi: compatible = "ti,usbhs-host";So it is still in use.
ok, that was just answering in panic mode to prevent removal of a needed driver. Reading it again: I think omap2/3/4/5 without devicetree will not work anyway, so we can remove anything done on !dev->of_node.
Regards,
Andreas
Lee Jones
maintainerQuoted 57 lines · Andreas Kemnade
Quoted 54 lines · On Fri, 9 Jan 2026 18:18:39 +0100 Andreas Kemnade <[email protected]> wrote:
Quoted 39 lines · On Fri, 9 Jan 2026 16:39:39 +0000 Lee Jones <[email protected]> wrote:
Quoted 37 lines · Lee Jones
Quoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);What on earth is this driver even doing in MFD?
Quoted 7 lines
Quoted 1 line
Nightmare - quick dig, bury it!
Is the old platform method even supported anymore?
$ git grep \"usbhs_omap\"" drivers/mfd/omap-usb-host.c:#define USBHS_DRIVER_NAME "usbhs_omap":~/linux/arch/arm/boot/dts/ti/omap$ grep ti,usbhs-host *.dtsi omap3.dtsi: compatible = "ti,usbhs-host"; omap4-l4.dtsi: compatible = "ti,usbhs-host"; omap5-l4.dtsi: compatible = "ti,usbhs-host";
Quoted 5 lines
Quoted 2 lines
So it is still in use.
ok, that was just answering in panic mode to prevent removal of a needed driver. Reading it again: I think omap2/3/4/5 without devicetree will not work anyway, so we can remove anything done on !dev->of_node.
Okay, leave it with me.
Signature · 1 line
Lee Jones [李琼斯]
Lee Jones
maintainerQuoted 46 lines · Andreas Kemnade
Quoted 43 lines · On Fri, 9 Jan 2026 16:39:39 +0000 Lee Jones <[email protected]> wrote:
Quoted 32 lines · Lee Jones
Quoted 20 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/mfd/omap-usb-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/omap-usb-host.c +0
-0drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 7 lines
drivers/mfd/omap-usb-host.c +2
-2@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev); -/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?Quoted 6 lines
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);What on earth is this driver even doing in MFD?
Nightmare - quick dig, bury it!
Is the old platform method even supported anymore?
Quoted 7 lines
Quoted 3 lines
$ git grep \"usbhs_omap\"" drivers/mfd/omap-usb-host.c:#define USBHS_DRIVER_NAME "usbhs_omap":~/linux/arch/arm/boot/dts/ti/omap$ grep ti,usbhs-host *.dtsi omap3.dtsi: compatible = "ti,usbhs-host"; omap4-l4.dtsi: compatible = "ti,usbhs-host"; omap5-l4.dtsi: compatible = "ti,usbhs-host";
That's the new "DT" method.
What about the old "usbhs_omap" one?
Looks to me like support was removed by Tony in 2016:
9080b8dc761a ("ARM: OMAP2+: Remove legacy usb-host.c platform init code")
Signature · 1 line
Lee Jones [李琼斯]
Quoted 18 lines · Lee Jones
Quoted 16 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>drivers/mfd/omap-usb-host.c +0
-0@@ -819,8 +819,10 @@ static void usbhs_omap_remove(struct platform_device *pdev) {pm_runtime_disable (&pdev->dev);
Quoted 6 lines
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 823
Quoted 4 lines
drivers/mfd/omap-usb-host.c +2
-2-/* remove children */ -device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child); +if (pdev->dev.of_node) +of_platform_depopulate (&pdev->dev);
devm_of_platform_populate()?
Looks like that would work here, but I prefer using explicit removal for both the OF and non-OF for symmetry and readability reasons.
If you think that the non-OF support can be removed then a devres conversion can be done as part of that change.
Quoted 2 lines
drivers/mfd/omap-usb-host.c static void usbhs_omap_remove(struct platform_device *pdev) · line 825
Quoted 2 lines
drivers/mfd/omap-usb-host.c +2
-0+else +device_for_each_child (&pdev->dev,NULL , usbhs_omap_remove_child);
Johan
Re: (subset) [PATCH] mfd: omap-usb-host: fix OF populate on driver rebind
In reply to Johan HovoldQuoted 9 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag is still set in the corresponding OF nodes.Switch to using
of_platform_depopulate()instead of open coding so that the child devices are created if the driver is rebound.[...]
Applied, thanks!
[1/1] mfd: omap-usb-host: fix OF populate on driver rebind
commit: 74283e1c49dd2d56e83bca070c163c56375c057d
--
Lee Jones [李琼斯]