If our compatible string has "simple-bus" at the end of it then the
system will handle probing our children for us.  Doing this has a few
advantages:

1. If we defer we don't have to keep probing / removing our children
   which should speed up boot.  The system just probes them once.

2. It fixes a problem where we could get into a big loop where we'd
   have:
   - msm_pdev_probe() is called.
   - msm_pdev_probe() registers drivers.  Registering drivers kicks
     off processing of probe deferrals.
   - component_master_add_with_match() could return -EPROBE_DEFER.
     making msm_pdev_probe() return -EPROBE_DEFER.
   - When msm_pdev_probe() returned the processing of probe deferrals
     happens.
   - Loop back to the start.

Signed-off-by: Douglas Anderson <diand...@chromium.org>
---

 drivers/gpu/drm/msm/msm_drv.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 78b09fde9e29..f7c6ef147095 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -1208,10 +1208,18 @@ static int add_display_components(struct device *dev,
        if (of_device_is_compatible(dev->of_node, "qcom,mdss") ||
            of_device_is_compatible(dev->of_node, "qcom,sdm845-mdss") ||
            of_device_is_compatible(dev->of_node, "qcom,sc7180-mdss")) {
-               ret = devm_of_platform_populate(dev);
-               if (ret) {
-                       DRM_DEV_ERROR(dev, "failed to populate children 
devices\n");
-                       return ret;
+               /*
+                * Old device tree files didn't include "simple-bus"
+                * in their compatible string so we had to manually pouplate
+                * our children.  When existing device trees are fixed this
+                * can be removed.
+                */
+               if (!of_device_is_compatible(dev->of_node, "simple-bus")) {
+                       ret = devm_of_platform_populate(dev);
+                       if (ret) {
+                               DRM_DEV_ERROR(dev, "failed to populate children 
devices\n");
+                               return ret;
+                       }
                }
 
                mdp_dev = device_find_child(dev, NULL, compare_name_mdp);
-- 
2.27.0.383.g050319c2ae-goog

Reply via email to