[PATCH v3 12/34] drm/etnaviv: Migrate to aggregate driver

From: Stephen Boyd
Date: Mon Oct 25 2021 - 20:02:37 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: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
Cc: Russell King <linux+etnaviv@xxxxxxxxxxxxxxx>
Cc: Christian Gmeiner <christian.gmeiner@xxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Cc: Rob Clark <robdclark@xxxxxxxxx>
Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 7dcc6392792d..95d1e518ff13 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -494,8 +494,9 @@ static const struct drm_driver etnaviv_drm_driver = {
/*
* Platform driver:
*/
-static int etnaviv_bind(struct device *dev)
+static int etnaviv_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct etnaviv_drm_private *priv;
struct drm_device *drm;
int ret;
@@ -552,8 +553,9 @@ static int etnaviv_bind(struct device *dev)
return ret;
}

-static void etnaviv_unbind(struct device *dev)
+static void etnaviv_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *drm = dev_get_drvdata(dev);
struct etnaviv_drm_private *priv = drm->dev_private;

@@ -569,9 +571,13 @@ static void etnaviv_unbind(struct device *dev)
drm_dev_put(drm);
}

-static const struct component_master_ops etnaviv_master_ops = {
- .bind = etnaviv_bind,
- .unbind = etnaviv_unbind,
+static struct aggregate_driver etnaviv_aggregate_driver = {
+ .probe = etnaviv_bind,
+ .remove = etnaviv_unbind,
+ .driver = {
+ .name = "etnaviv_drm",
+ .owner = THIS_MODULE,
+ },
};

static int compare_of(struct device *dev, void *data)
@@ -609,12 +615,12 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
component_match_add(dev, &match, compare_str, names[i]);
}

- return component_master_add_with_match(dev, &etnaviv_master_ops, match);
+ return component_aggregate_register(dev, &etnaviv_aggregate_driver, match);
}

static int etnaviv_pdev_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &etnaviv_master_ops);
+ component_aggregate_unregister(&pdev->dev, &etnaviv_aggregate_driver);

return 0;
}
--
https://chromeos.dev