Commit 8424084f authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Rob Clark

drm/msm: Remove need for reiterating the compatibles

After spending a non-negligible time trying to figure out why
dpu_kms_init() would dereference a NULL dpu_kms->pdev, it turns out that
in addition to adding the new compatible to the msm_drv of_match_table
one also need to teach add_display_components() to register the child
nodes - which includes the DPU platform_device.

Replace the open coded test for compatibles with a check against the
match data of the mdss device to save others this trouble in the future.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210317025634.3987908-1-bjorn.andersson@linaro.orgSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 0054eeb7
...@@ -1186,10 +1186,11 @@ static int compare_name_mdp(struct device *dev, void *data) ...@@ -1186,10 +1186,11 @@ static int compare_name_mdp(struct device *dev, void *data)
return (strstr(dev_name(dev), "mdp") != NULL); return (strstr(dev_name(dev), "mdp") != NULL);
} }
static int add_display_components(struct device *dev, static int add_display_components(struct platform_device *pdev,
struct component_match **matchptr) struct component_match **matchptr)
{ {
struct device *mdp_dev; struct device *mdp_dev;
struct device *dev = &pdev->dev;
int ret; int ret;
/* /*
...@@ -1198,9 +1199,9 @@ static int add_display_components(struct device *dev, ...@@ -1198,9 +1199,9 @@ static int add_display_components(struct device *dev,
* Populate the children devices, find the MDP5/DPU node, and then add * Populate the children devices, find the MDP5/DPU node, and then add
* the interfaces to our components list. * the interfaces to our components list.
*/ */
if (of_device_is_compatible(dev->of_node, "qcom,mdss") || switch (get_mdp_ver(pdev)) {
of_device_is_compatible(dev->of_node, "qcom,sdm845-mdss") || case KMS_MDP5:
of_device_is_compatible(dev->of_node, "qcom,sc7180-mdss")) { case KMS_DPU:
ret = of_platform_populate(dev->of_node, NULL, NULL, dev); ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (ret) { if (ret) {
DRM_DEV_ERROR(dev, "failed to populate children devices\n"); DRM_DEV_ERROR(dev, "failed to populate children devices\n");
...@@ -1219,9 +1220,11 @@ static int add_display_components(struct device *dev, ...@@ -1219,9 +1220,11 @@ static int add_display_components(struct device *dev,
/* add the MDP component itself */ /* add the MDP component itself */
drm_of_component_match_add(dev, matchptr, compare_of, drm_of_component_match_add(dev, matchptr, compare_of,
mdp_dev->of_node); mdp_dev->of_node);
} else { break;
case KMS_MDP4:
/* MDP4 */ /* MDP4 */
mdp_dev = dev; mdp_dev = dev;
break;
} }
ret = add_components_mdp(mdp_dev, matchptr); ret = add_components_mdp(mdp_dev, matchptr);
...@@ -1286,7 +1289,7 @@ static int msm_pdev_probe(struct platform_device *pdev) ...@@ -1286,7 +1289,7 @@ static int msm_pdev_probe(struct platform_device *pdev)
int ret; int ret;
if (get_mdp_ver(pdev)) { if (get_mdp_ver(pdev)) {
ret = add_display_components(&pdev->dev, &match); ret = add_display_components(pdev, &match);
if (ret) if (ret)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment