[PATCH v3 30/34] fbdev: omap2: Migrate to aggregate driver

From: Stephen Boyd
Date: Mon Oct 25 2021 - 20:03:33 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: <linux-omap@xxxxxxxxxxxxxxx>
Cc: <linux-fbdev@xxxxxxxxxxxxxxx>
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/video/fbdev/omap2/omapfb/dss/dss.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
index a6b1c1598040..f12663c39ceb 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c
@@ -1067,8 +1067,9 @@ static int dss_video_pll_probe(struct platform_device *pdev)
}

/* DSS HW IP initialisation */
-static int dss_bind(struct device *dev)
+static int dss_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct platform_device *pdev = to_platform_device(dev);
struct resource *dss_mem;
u32 rev;
@@ -1167,8 +1168,9 @@ static int dss_bind(struct device *dev)
return r;
}

-static void dss_unbind(struct device *dev)
+static void dss_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct platform_device *pdev = to_platform_device(dev);

dss_initialized = false;
@@ -1188,9 +1190,13 @@ static void dss_unbind(struct device *dev)
dss_put_clocks();
}

-static const struct component_master_ops dss_component_ops = {
- .bind = dss_bind,
- .unbind = dss_unbind,
+static struct aggregate_driver dss_aggregate_driver = {
+ .probe = dss_bind,
+ .remove = dss_unbind,
+ .driver = {
+ .name = "dss_fbdev",
+ .owner = THIS_MODULE,
+ },
};

static int dss_component_compare(struct device *dev, void *data)
@@ -1225,7 +1231,7 @@ static int dss_probe(struct platform_device *pdev)
/* add all the child devices as components */
device_for_each_child(&pdev->dev, &match, dss_add_child_component);

- r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match);
+ r = component_aggregate_register(&pdev->dev, &dss_aggregate_driver, match);
if (r)
return r;

@@ -1234,7 +1240,7 @@ static int dss_probe(struct platform_device *pdev)

static int dss_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &dss_component_ops);
+ component_aggregate_unregister(&pdev->dev, &dss_aggregate_driver);
return 0;
}

--
https://chromeos.dev