[PATCH v3 15/34] drm/imx: Migrate to aggregate driver
From: Stephen Boyd
Date: Mon Oct 25 2021 - 20:01:51 EST
Use an aggregate driver instead of component ops so that we can get
proper driver probe ordering of the aggregate device with respect to all
the component devices that make up the aggregate device.
Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Cc: Rob Clark <robdclark@xxxxxxxxx>
Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
---
drivers/gpu/drm/imx/imx-drm-core.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 9558e9e1b431..dbf5cca5201d 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -198,8 +198,9 @@ static int compare_of(struct device *dev, void *data)
return dev->of_node == np;
}
-static int imx_drm_bind(struct device *dev)
+static int imx_drm_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *drm;
int ret;
@@ -266,8 +267,9 @@ static int imx_drm_bind(struct device *dev)
return ret;
}
-static void imx_drm_unbind(struct device *dev)
+static void imx_drm_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *drm = dev_get_drvdata(dev);
drm_dev_unregister(drm);
@@ -281,14 +283,18 @@ static void imx_drm_unbind(struct device *dev)
dev_set_drvdata(dev, NULL);
}
-static const struct component_master_ops imx_drm_ops = {
- .bind = imx_drm_bind,
- .unbind = imx_drm_unbind,
+static struct aggregate_driver imx_drm_aggregate_driver = {
+ .probe = imx_drm_bind,
+ .remove = imx_drm_unbind,
+ .driver = {
+ .name = "imx_drm",
+ .owner = THIS_MODULE,
+ },
};
static int imx_drm_platform_probe(struct platform_device *pdev)
{
- int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops);
+ int ret = drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggregate_driver);
if (!ret)
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
@@ -298,7 +304,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev)
static int imx_drm_platform_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &imx_drm_ops);
+ component_aggregate_unregister(&pdev->dev, &imx_drm_aggregate_driver);
return 0;
}
--
https://chromeos.dev