gb_interfaces_remove(hd);
gb_endo_remove(hd->endo);
+ /* Is the SVC still using the partially uninitialized connection ? */
+ if (hd->initial_svc_connection) {
+ gb_connection_exit(hd->initial_svc_connection);
+ gb_connection_destroy(hd->initial_svc_connection);
+ }
+
/*
* Make sure there are no leftovers that can potentially corrupt sysfs.
*/
intf->device_id = GB_DEVICE_ID_AP;
svc_update_connection(intf, connection);
+ /* Its no longer a partially initialized connection */
+ hd->initial_svc_connection = NULL;
+
return intf;
}
svc->connection = connection;
connection->private = svc;
- /*
- * SVC connection is created twice:
- * - before the interface-id of the AP and the endo type is known.
- * - after receiving endo type and interface-id of the AP from the SVC.
- *
- * We should do light-weight initialization for the first case.
- */
- if (!connection->bundle) {
- WARN_ON(connection->hd->initial_svc_connection);
- connection->hd->initial_svc_connection = connection;
- return 0;
- }
+ WARN_ON(connection->hd->initial_svc_connection);
+ connection->hd->initial_svc_connection = connection;
ida_init(&greybus_svc_device_id_map);
- /* Set interface's svc connection */
- connection->bundle->intf->svc = svc;
-
return 0;
}
{
struct gb_svc *svc = connection->private;
- if (connection->hd->initial_svc_connection == connection) {
- connection->hd->initial_svc_connection = NULL;
- } else {
- if (WARN_ON(connection->bundle->intf->svc != svc))
- return;
- connection->bundle->intf->svc = NULL;
- }
-
connection->private = NULL;
kfree(svc);
}