[PATCH v3 08/34] drm/komeda: Migrate to aggregate driver

From: Stephen Boyd
Date: Mon Oct 25 2021 - 20:04:22 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: James Qian Wang (Arm Technology China) <james.qian.wang@xxxxxxx>
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>
---
.../gpu/drm/arm/display/komeda/komeda_drv.c | 20 ++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index e7933930a657..0463386a6ed2 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -25,8 +25,9 @@ struct komeda_dev *dev_to_mdev(struct device *dev)
return mdrv ? mdrv->mdev : NULL;
}

-static void komeda_unbind(struct device *dev)
+static void komeda_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct komeda_drv *mdrv = dev_get_drvdata(dev);

if (!mdrv)
@@ -45,8 +46,9 @@ static void komeda_unbind(struct device *dev)
devm_kfree(dev, mdrv);
}

-static int komeda_bind(struct device *dev)
+static int komeda_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct komeda_drv *mdrv;
int err;

@@ -87,9 +89,13 @@ static int komeda_bind(struct device *dev)
return err;
}

-static const struct component_master_ops komeda_master_ops = {
- .bind = komeda_bind,
- .unbind = komeda_unbind,
+static struct aggregate_driver komeda_aggregate_driver = {
+ .probe = komeda_bind,
+ .remove = komeda_unbind,
+ .driver = {
+ .name = "komeda_drm",
+ .owner = THIS_MODULE,
+ },
};

static int compare_of(struct device *dev, void *data)
@@ -129,12 +135,12 @@ static int komeda_platform_probe(struct platform_device *pdev)
komeda_add_slave(dev, &match, child, KOMEDA_OF_PORT_OUTPUT, 1);
}

- return component_master_add_with_match(dev, &komeda_master_ops, match);
+ return component_aggregate_register(dev, &komeda_aggregate_driver, match);
}

static int komeda_platform_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &komeda_master_ops);
+ component_aggregate_unregister(&pdev->dev, &komeda_aggregate_driver);
return 0;
}

--
https://chromeos.dev