[PATCH v6 32/35] usb: typec: port-mapper: Migrate to aggregate driver
Stephen Boyd
swboyd at chromium.org
Thu Jan 27 20:01:38 UTC 2022
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: Heikki Krogerus <heikki.krogerus at linux.intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Cc: Rob Clark <robdclark at gmail.com>
Cc: Russell King <rmk+kernel at arm.linux.org.uk>
Cc: Saravana Kannan <saravanak at google.com>
Signed-off-by: Stephen Boyd <swboyd at chromium.org>
---
drivers/usb/typec/port-mapper.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c
index 07d307418b47..33fbebc6a85b 100644
--- a/drivers/usb/typec/port-mapper.c
+++ b/drivers/usb/typec/port-mapper.c
@@ -11,19 +11,27 @@
#include "class.h"
-static int typec_aggregate_bind(struct device *dev)
+static int typec_aggregate_probe(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
+
return component_bind_all(dev, NULL);
}
-static void typec_aggregate_unbind(struct device *dev)
+static void typec_aggregate_remove(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
+
component_unbind_all(dev, NULL);
}
-static const struct component_master_ops typec_aggregate_ops = {
- .bind = typec_aggregate_bind,
- .unbind = typec_aggregate_unbind,
+static struct aggregate_driver typec_aggregate_driver = {
+ .probe = typec_aggregate_probe,
+ .remove = typec_aggregate_remove,
+ .driver = {
+ .name = "typec_aggregate",
+ .owner = THIS_MODULE,
+ },
};
struct each_port_arg {
@@ -69,10 +77,10 @@ int typec_link_ports(struct typec_port *con)
* improvements to the component framework. Right now you can only have
* one master per device.
*/
- return component_master_add_with_match(&con->dev, &typec_aggregate_ops, arg.match);
+ return component_aggregate_register(&con->dev, &typec_aggregate_driver, arg.match);
}
void typec_unlink_ports(struct typec_port *con)
{
- component_master_del(&con->dev, &typec_aggregate_ops);
+ component_aggregate_unregister(&con->dev, &typec_aggregate_driver);
}
--
https://chromeos.dev
More information about the dri-devel
mailing list