};
+int svc_update_connection(struct gb_interface *intf,
+ struct gb_connection *connection)
+{
+ struct gb_bundle *bundle;
+
+ bundle = gb_bundle_create(intf, GB_SVC_BUNDLE_ID, GREYBUS_CLASS_SVC);
+ if (!bundle)
+ return -EINVAL;
+
+ device_del(&connection->dev);
+ connection->bundle = bundle;
+ connection->dev.parent = &bundle->dev;
+ dev_set_name(&connection->dev, "%s:%d", dev_name(&bundle->dev),
+ GB_SVC_CPORT_ID);
+
+ WARN_ON(device_add(&connection->dev));
+
+ spin_lock_irq(&gb_connections_lock);
+ list_add(&connection->bundle_links, &bundle->connections);
+ spin_unlock_irq(&gb_connections_lock);
+
+ return 0;
+}
+
void gb_connection_bind_protocol(struct gb_connection *connection)
{
struct gb_protocol *protocol;
};
#define to_gb_connection(d) container_of(d, struct gb_connection, dev)
+int svc_update_connection(struct gb_interface *intf,
+ struct gb_connection *connection);
struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
u16 cport_id, u8 protocol_id);
struct gb_connection *gb_connection_create_range(struct greybus_host_device *hd,
{
struct gb_interface *intf;
struct device *dev = &hd->endo->dev;
- int ret;
intf = gb_interface_create(hd, interface_id);
if (!intf) {
}
intf->device_id = GB_DEVICE_ID_AP;
-
- /*
- * XXX: Disable the initial svc connection here, but don't destroy it
- * yet. We do need to send a response of 'svc-hello message' on that.
- */
-
- /* Establish new control CPort connection */
- ret = gb_create_bundle_connection(intf, GREYBUS_CLASS_SVC);
- if (ret) {
- dev_err(&intf->dev, "%s: Failed to create svc connection (%d %d)\n",
- __func__, interface_id, ret);
- gb_interface_destroy(intf);
- intf = NULL;
- }
+ svc_update_connection(intf, connection);
return intf;
}