API: Add binding accessors to generic struct mctp_binding
Rather than have every binding include their own wrappers around
binding<->core functions, introduce an accessor to retrieve the struct
mctp_binding from each.
This means we no longer need the binding-specific registration
callbacks. However, we do now need a ->start callback, to allow bindings
to perform post-registration init.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Change-Id: I6cee9e93f37520f85c155a0ca34017cc0675552c
diff --git a/core.c b/core.c
index e0cb95d..61356e9 100644
--- a/core.c
+++ b/core.c
@@ -257,6 +257,10 @@
binding->bus = &mctp->busses[0];
binding->mctp = mctp;
mctp->route_policy = ROUTE_ENDPOINT;
+
+ if (binding->start)
+ binding->start(binding);
+
return 0;
}
@@ -274,6 +278,13 @@
b2->mctp = mctp;
mctp->route_policy = ROUTE_BRIDGE;
+
+ if (b1->start)
+ b1->start(b1);
+
+ if (b2->start)
+ b2->start(b2);
+
return 0;
}