[Freedreno] [PATCH v6 22/35] drm/sun4i: Migrate to aggregate driver
Stephen Boyd
swboyd at chromium.org
Thu Jan 27 20:01:28 UTC 2022
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: Maxime Ripard <mripard at kernel.org>
Cc: Chen-Yu Tsai <wens at csie.org>
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/sun4i/sun4i_drv.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index b630614b3d72..9f20c3f0f93e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -56,8 +56,9 @@ static const struct drm_driver sun4i_drv_driver = {
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(drm_sun4i_gem_dumb_create),
};
-static int sun4i_drv_bind(struct device *dev)
+static int sun4i_drv_bind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm;
struct sun4i_drv *drv;
int ret;
@@ -125,8 +126,9 @@ static int sun4i_drv_bind(struct device *dev)
return ret;
}
-static void sun4i_drv_unbind(struct device *dev)
+static void sun4i_drv_unbind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm = dev_get_drvdata(dev);
drm_dev_unregister(drm);
@@ -140,9 +142,13 @@ static void sun4i_drv_unbind(struct device *dev)
drm_dev_put(drm);
}
-static const struct component_master_ops sun4i_drv_master_ops = {
- .bind = sun4i_drv_bind,
- .unbind = sun4i_drv_unbind,
+static struct aggregate_driver sun4i_aggregate_driver = {
+ .probe = sun4i_drv_bind,
+ .remove = sun4i_drv_unbind,
+ .driver = {
+ .name = "sun4i_drm",
+ .owner = THIS_MODULE,
+ },
};
static bool sun4i_drv_node_is_connector(struct device_node *node)
@@ -398,16 +404,14 @@ static int sun4i_drv_probe(struct platform_device *pdev)
}
if (count)
- return component_master_add_with_match(&pdev->dev,
- &sun4i_drv_master_ops,
- match);
- else
- return 0;
+ return component_aggregate_register(&pdev->dev, &sun4i_aggregate_driver, match);
+
+ return 0;
}
static int sun4i_drv_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &sun4i_drv_master_ops);
+ component_aggregate_unregister(&pdev->dev, &sun4i_aggregate_driver);
return 0;
}
--
https://chromeos.dev
More information about the Freedreno
mailing list