[PATCH v4 22/34] drm/sti: Migrate to aggregate driver
Stephen Boyd
swboyd at chromium.org
Thu Dec 2 22:27:20 UTC 2021
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: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Cc: Rob Clark <robdclark at gmail.com>
Cc: Russell King <rmk+kernel at arm.linux.org.uk>
Cc: Saravana Kannan <saravanak at google.com>
Signed-off-by: Stephen Boyd <swboyd at chromium.org>
---
drivers/gpu/drm/sti/sti_drv.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index c7efb43b83ee..b277cc679154 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -182,8 +182,9 @@ static void sti_cleanup(struct drm_device *ddev)
ddev->dev_private = NULL;
}
-static int sti_bind(struct device *dev)
+static int sti_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *ddev;
int ret;
@@ -216,8 +217,9 @@ static int sti_bind(struct device *dev)
return ret;
}
-static void sti_unbind(struct device *dev)
+static void sti_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *ddev = dev_get_drvdata(dev);
drm_dev_unregister(ddev);
@@ -225,9 +227,13 @@ static void sti_unbind(struct device *dev)
drm_dev_put(ddev);
}
-static const struct component_master_ops sti_ops = {
- .bind = sti_bind,
- .unbind = sti_unbind,
+static struct aggregate_driver sti_aggregate_driver = {
+ .probe = sti_bind,
+ .remove = sti_unbind,
+ .driver = {
+ .name = "sti_drm",
+ .owner = THIS_MODULE,
+ },
};
static int sti_platform_probe(struct platform_device *pdev)
@@ -249,12 +255,12 @@ static int sti_platform_probe(struct platform_device *pdev)
child_np = of_get_next_available_child(node, child_np);
}
- return component_master_add_with_match(dev, &sti_ops, match);
+ return component_aggregate_register(dev, &sti_aggregate_driver, match);
}
static int sti_platform_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &sti_ops);
+ component_aggregate_unregister(&pdev->dev, &sti_aggregate_driver);
return 0;
}
--
https://chromeos.dev
More information about the dri-devel
mailing list