astlpc: defer BMC initialisation to ->start callback
There's no need to do this in the init code, so defer to start.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Change-Id: Idb99187f17b1a9f9cf248919eda4134e984d37b1
diff --git a/astlpc.c b/astlpc.c
index cf75534..079d9c5 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -332,6 +332,14 @@
return rc;
}
+static int mctp_binding_astlpc_start(struct mctp_binding *b)
+{
+ struct mctp_binding_astlpc *astlpc = container_of(b,
+ struct mctp_binding_astlpc, binding);
+
+ return mctp_astlpc_init_bmc(astlpc);
+}
+
/* allocate and basic initialisation */
static struct mctp_binding_astlpc *__mctp_astlpc_init(void)
{
@@ -342,6 +350,7 @@
astlpc->binding.name = "astlpc";
astlpc->binding.version = 1;
astlpc->binding.tx = mctp_binding_astlpc_tx;
+ astlpc->binding.start = mctp_binding_astlpc_start;
astlpc->binding.pkt_size = MCTP_BMTU;
astlpc->binding.pkt_pad = 0;
astlpc->lpc_map = NULL;
@@ -375,12 +384,6 @@
if (!astlpc->lpc_map)
astlpc->priv_hdr = __mctp_alloc(sizeof(*astlpc->priv_hdr));
- rc = mctp_astlpc_init_bmc(astlpc);
- if (rc) {
- free(astlpc);
- return NULL;
- }
-
return astlpc;
}
@@ -490,12 +493,6 @@
return NULL;
}
- rc = mctp_astlpc_init_bmc(astlpc);
- if (rc) {
- free(astlpc);
- return NULL;
- }
-
return astlpc;
}
#else