Message ID | 20211006193819.2654854-16-swboyd@chromium.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | component: Make into an aggregate bus | expand |
Hi Stephen, Le mer., oct. 6 2021 at 12:38:00 -0700, Stephen Boyd <swboyd@chromium.org> a écrit : > 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. > > TODO: Move the helpers to PM in aggregate driver hooks. > > Cc: Paul Cercueil <paul@crapouillou.net> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: "Rafael J. Wysocki" <rafael@kernel.org> > Cc: Rob Clark <robdclark@gmail.com> > Cc: Russell King <rmk+kernel@arm.linux.org.uk> > Cc: Saravana Kannan <saravanak@google.com> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > --- > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 24 > +++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > index a5df1c8d34cd..058b7bfe5610 100644 > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > @@ -1150,8 +1150,10 @@ static int ingenic_drm_bind(struct device > *dev, bool has_components) > return ret; > } > > -static int ingenic_drm_bind_with_components(struct device *dev) > +static int ingenic_drm_bind_with_components(struct aggregate_device > *adev) > { > + struct device *dev = adev->parent; > + > return ingenic_drm_bind(dev, true); > } > > @@ -1174,9 +1176,19 @@ static void ingenic_drm_unbind(struct device > *dev) > drm_atomic_helper_shutdown(&priv->drm); > } > > -static const struct component_master_ops ingenic_master_ops = { > - .bind = ingenic_drm_bind_with_components, > - .unbind = ingenic_drm_unbind, > +static void ingenic_aggregate_remove(struct aggregate_device *adev) > +{ > + struct device *dev = adev->parent; Space here. With that: Acked-by: Paul Cercueil <paul@crapouillou.net> Cheers, -Paul > + ingenic_drm_unbind(dev); > +} > + > +static struct aggregate_driver ingenic_aggregate_driver = { > + .probe = ingenic_drm_bind_with_components, > + .remove = ingenic_aggregate_remove, > + .driver = { > + .name = "ingenic_drm", > + .owner = THIS_MODULE, > + }, > }; > > static int ingenic_drm_probe(struct platform_device *pdev) > @@ -1196,7 +1208,7 @@ static int ingenic_drm_probe(struct > platform_device *pdev) > drm_of_component_match_add(dev, &match, compare_of, np); > of_node_put(np); > > - return component_master_add_with_match(dev, &ingenic_master_ops, > match); > + return component_aggregate_register(dev, &ingenic_aggregate_driver, > match); > } > > static int ingenic_drm_remove(struct platform_device *pdev) > @@ -1206,7 +1218,7 @@ static int ingenic_drm_remove(struct > platform_device *pdev) > if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) > ingenic_drm_unbind(dev); > else > - component_master_del(dev, &ingenic_master_ops); > + component_aggregate_unregister(dev, &ingenic_aggregate_driver); > > return 0; > } > -- > https://chromeos.dev >
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a5df1c8d34cd..058b7bfe5610 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1150,8 +1150,10 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } -static int ingenic_drm_bind_with_components(struct device *dev) +static int ingenic_drm_bind_with_components(struct aggregate_device *adev) { + struct device *dev = adev->parent; + return ingenic_drm_bind(dev, true); } @@ -1174,9 +1176,19 @@ static void ingenic_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(&priv->drm); } -static const struct component_master_ops ingenic_master_ops = { - .bind = ingenic_drm_bind_with_components, - .unbind = ingenic_drm_unbind, +static void ingenic_aggregate_remove(struct aggregate_device *adev) +{ + struct device *dev = adev->parent; + ingenic_drm_unbind(dev); +} + +static struct aggregate_driver ingenic_aggregate_driver = { + .probe = ingenic_drm_bind_with_components, + .remove = ingenic_aggregate_remove, + .driver = { + .name = "ingenic_drm", + .owner = THIS_MODULE, + }, }; static int ingenic_drm_probe(struct platform_device *pdev) @@ -1196,7 +1208,7 @@ static int ingenic_drm_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, np); of_node_put(np); - return component_master_add_with_match(dev, &ingenic_master_ops, match); + return component_aggregate_register(dev, &ingenic_aggregate_driver, match); } static int ingenic_drm_remove(struct platform_device *pdev) @@ -1206,7 +1218,7 @@ static int ingenic_drm_remove(struct platform_device *pdev) if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) ingenic_drm_unbind(dev); else - component_master_del(dev, &ingenic_master_ops); + component_aggregate_unregister(dev, &ingenic_aggregate_driver); return 0; }
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. TODO: Move the helpers to PM in aggregate driver hooks. Cc: Paul Cercueil <paul@crapouillou.net> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Rob Clark <robdclark@gmail.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Saravana Kannan <saravanak@google.com> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)