greybus: interface: hibernate UniPro link in activation error path
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 20 Jul 2016 14:40:27 +0000 (16:40 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 20 Jul 2016 17:16:54 +0000 (10:16 -0700)
To be well-behaved, we should hibernate the link before disabling UniPro
in case the link has already been established (i.e. when the interface
type has been detected as UniPro or Greybus).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Patrick Titiano <ptitiano@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c

index f5ed79c..919eaa0 100644 (file)
@@ -947,8 +947,15 @@ static int _gb_interface_activate(struct gb_interface *intf,
                goto err_refclk_disable;
 
        ret = gb_interface_activate_operation(intf, type);
-       if (ret)
-               goto err_unipro_disable;
+       if (ret) {
+               switch (*type) {
+               case GB_INTERFACE_TYPE_UNIPRO:
+               case GB_INTERFACE_TYPE_GREYBUS:
+                       goto err_hibernate_link;
+               default:
+                       goto err_unipro_disable;
+               }
+       }
 
        ret = gb_interface_read_dme(intf);
        if (ret)