staging: greybus: make cport_quiesce() method optional
authorAlexandre Bailon <abailon@baylibre.com>
Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Apr 2017 11:27:15 +0000 (13:27 +0200)
The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/connection.c

index 1bf0ee403106efa6824d26000f602d8c00208b89..2cf64640e8ec55367dea4802233e05a70e0a3e6f 100644 (file)
@@ -366,6 +366,9 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection)
        if (connection->mode_switch)
                peer_space += sizeof(struct gb_operation_msg_hdr);
 
+       if (!hd->driver->cport_quiesce)
+               return 0;
+
        ret = hd->driver->cport_quiesce(hd, connection->hd_cport_id,
                                        peer_space,
                                        GB_CONNECTION_CPORT_QUIESCE_TIMEOUT);