|
@@ -314,6 +314,14 @@ static int compare_dev(struct device *dev, void *data)
|
|
return dev == (struct device *)data;
|
|
return dev == (struct device *)data;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void rockchip_drm_match_remove(struct device *dev)
|
|
|
|
+{
|
|
|
|
+ struct device_link *link;
|
|
|
|
+
|
|
|
|
+ list_for_each_entry(link, &dev->links.consumers, s_node)
|
|
|
|
+ device_link_del(link);
|
|
|
|
+}
|
|
|
|
+
|
|
static struct component_match *rockchip_drm_match_add(struct device *dev)
|
|
static struct component_match *rockchip_drm_match_add(struct device *dev)
|
|
{
|
|
{
|
|
struct component_match *match = NULL;
|
|
struct component_match *match = NULL;
|
|
@@ -331,10 +339,15 @@ static struct component_match *rockchip_drm_match_add(struct device *dev)
|
|
|
|
|
|
if (!d)
|
|
if (!d)
|
|
break;
|
|
break;
|
|
|
|
+
|
|
|
|
+ device_link_add(dev, d, DL_FLAG_STATELESS);
|
|
component_match_add(dev, &match, compare_dev, d);
|
|
component_match_add(dev, &match, compare_dev, d);
|
|
} while (true);
|
|
} while (true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (IS_ERR(match))
|
|
|
|
+ rockchip_drm_match_remove(dev);
|
|
|
|
+
|
|
return match ?: ERR_PTR(-ENODEV);
|
|
return match ?: ERR_PTR(-ENODEV);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -411,13 +424,21 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev)
|
|
if (IS_ERR(match))
|
|
if (IS_ERR(match))
|
|
return PTR_ERR(match);
|
|
return PTR_ERR(match);
|
|
|
|
|
|
- return component_master_add_with_match(dev, &rockchip_drm_ops, match);
|
|
|
|
|
|
+ ret = component_master_add_with_match(dev, &rockchip_drm_ops, match);
|
|
|
|
+ if (ret < 0) {
|
|
|
|
+ rockchip_drm_match_remove(dev);
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int rockchip_drm_platform_remove(struct platform_device *pdev)
|
|
static int rockchip_drm_platform_remove(struct platform_device *pdev)
|
|
{
|
|
{
|
|
component_master_del(&pdev->dev, &rockchip_drm_ops);
|
|
component_master_del(&pdev->dev, &rockchip_drm_ops);
|
|
|
|
|
|
|
|
+ rockchip_drm_match_remove(&pdev->dev);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|