Commit 8afd831e authored by Alexandre Bailon's avatar Alexandre Bailon Committed by Greg Kroah-Hartman

greybus: Greybus driver: add a new callbacks to driver

Add connection_create and connection_destroy callbacks.

ES2 can map a cport to a pair of endpoints.
Because ES2 have only a few pair of endpoints, ES2 need to have
access to some high level connection information such as protocol id
to effectively map the cports.
These callback will provide these information and help ES2 to map cports.
Signed-off-by: default avatarAlexandre Bailon <abailon@baylibre.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 2111134f
...@@ -262,6 +262,8 @@ gb_connection_create_range(struct greybus_host_device *hd, ...@@ -262,6 +262,8 @@ gb_connection_create_range(struct greybus_host_device *hd,
gb_svc_connection_create(hd->svc, gb_svc_connection_create(hd->svc,
hd->endo->ap_intf_id, hd_cport_id, hd->endo->ap_intf_id, hd_cport_id,
bundle->intf->interface_id, cport_id); bundle->intf->interface_id, cport_id);
if (hd->driver->connection_create)
hd->driver->connection_create(connection);
} }
gb_connection_bind_protocol(connection); gb_connection_bind_protocol(connection);
...@@ -430,6 +432,9 @@ void gb_connection_destroy(struct gb_connection *connection) ...@@ -430,6 +432,9 @@ void gb_connection_destroy(struct gb_connection *connection)
list_del(&connection->hd_links); list_del(&connection->hd_links);
spin_unlock_irq(&gb_connections_lock); spin_unlock_irq(&gb_connections_lock);
if (connection->hd->driver->connection_destroy)
connection->hd->driver->connection_destroy(connection);
if (connection->protocol) if (connection->protocol)
gb_protocol_put(connection->protocol); gb_protocol_put(connection->protocol);
connection->protocol = NULL; connection->protocol = NULL;
......
...@@ -75,6 +75,8 @@ struct greybus_host_device; ...@@ -75,6 +75,8 @@ struct greybus_host_device;
struct greybus_host_driver { struct greybus_host_driver {
size_t hd_priv_size; size_t hd_priv_size;
void (*connection_create)(struct gb_connection *connection);
void (*connection_destroy)(struct gb_connection *connection);
int (*message_send)(struct greybus_host_device *hd, u16 dest_cport_id, int (*message_send)(struct greybus_host_device *hd, u16 dest_cport_id,
struct gb_message *message, gfp_t gfp_mask); struct gb_message *message, gfp_t gfp_mask);
void (*message_cancel)(struct gb_message *message); void (*message_cancel)(struct gb_message *message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment