[PATCH v6 08/35] drm/arm/hdlcd: Migrate to aggregate driver

From: Stephen Boyd
Date: Thu Jan 27 2022 - 15:02:21 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: Liviu Dudau <liviu.dudau@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>
---
drivers/gpu/drm/arm/hdlcd_drv.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 479c2422a2e0..e3ed925797d5 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver = {
.minor = 0,
};

-static int hdlcd_drm_bind(struct device *dev)
+static int hdlcd_drm_bind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm;
struct hdlcd_drm_private *hdlcd;
int ret;
@@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev)
return ret;
}

-static void hdlcd_drm_unbind(struct device *dev)
+static void hdlcd_drm_unbind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm = dev_get_drvdata(dev);
struct hdlcd_drm_private *hdlcd = drm->dev_private;

@@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev)
drm_dev_put(drm);
}

-static const struct component_master_ops hdlcd_master_ops = {
- .bind = hdlcd_drm_bind,
- .unbind = hdlcd_drm_unbind,
+static struct aggregate_driver hdlcd_aggregate_driver = {
+ .probe = hdlcd_drm_bind,
+ .remove = hdlcd_drm_unbind,
+ .driver = {
+ .name = "hdlcd_drm",
+ .owner = THIS_MODULE,
+ },
};

static int compare_dev(struct device *dev, void *data)
@@ -390,13 +396,12 @@ static int hdlcd_probe(struct platform_device *pdev)
drm_of_component_match_add(&pdev->dev, &match, compare_dev, port);
of_node_put(port);

- return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops,
- match);
+ return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, match);
}

static int hdlcd_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &hdlcd_master_ops);
+ component_aggregate_unregister(&pdev->dev, &hdlcd_aggregate_driver);
return 0;
}

--
https://chromeos.dev