greybus: Greybus driver: add a new callbacks to driver
authorAlexandre Bailon <abailon@baylibre.com>
Fri, 4 Sep 2015 14:55:40 +0000 (16:55 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 4 Sep 2015 21:49:09 +0000 (14:49 -0700)
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: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/greybus.h

index 466ea36da0aa26daa0e480a5ca0aeecdb09b319d..c25e5705f8651e99d750fcfeae1f5d6528c788bf 100644 (file)
@@ -262,6 +262,8 @@ gb_connection_create_range(struct greybus_host_device *hd,
                gb_svc_connection_create(hd->svc,
                                         hd->endo->ap_intf_id, hd_cport_id,
                                         bundle->intf->interface_id, cport_id);
+               if (hd->driver->connection_create)
+                       hd->driver->connection_create(connection);
        }
 
        gb_connection_bind_protocol(connection);
@@ -430,6 +432,9 @@ void gb_connection_destroy(struct gb_connection *connection)
        list_del(&connection->hd_links);
        spin_unlock_irq(&gb_connections_lock);
 
+       if (connection->hd->driver->connection_destroy)
+               connection->hd->driver->connection_destroy(connection);
+
        if (connection->protocol)
                gb_protocol_put(connection->protocol);
        connection->protocol = NULL;
index 8e215f870c1d0d4dfa8450b70995f6af470905ae..9f2eb1f2e8a9c7192fb2e72f80ad220a99e7a7ee 100644 (file)
@@ -75,6 +75,8 @@ struct greybus_host_device;
 struct greybus_host_driver {
        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,
                        struct gb_message *message, gfp_t gfp_mask);
        void (*message_cancel)(struct gb_message *message);