]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
greybus: interface: add active state flag
authorJohan Hovold <johan@hovoldconsulting.com>
Sat, 23 Apr 2016 16:47:26 +0000 (18:47 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 25 Apr 2016 18:08:30 +0000 (11:08 -0700)
Add active state flag to avoid deactivating an interface which is
already off.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h

index 2553312dc33292a4728fd88cf46e2b216fc80c4c..e0c38f158435130ceccbbe48903b7a463552fdc4 100644 (file)
@@ -409,6 +409,8 @@ int gb_interface_activate(struct gb_interface *intf)
        if (ret)
                return ret;
 
+       intf->active = true;
+
        return 0;
 }
 
@@ -419,7 +421,12 @@ int gb_interface_activate(struct gb_interface *intf)
  */
 void gb_interface_deactivate(struct gb_interface *intf)
 {
+       if (!intf->active)
+               return;
+
        gb_interface_route_destroy(intf);
+
+       intf->active = false;
 }
 
 /*
index 61399e7ea1028e5d491caa94c9c39dcc8989e477..c9c1c92ece463db97790ae9be59c7ed8c5816f5b 100644 (file)
@@ -43,6 +43,7 @@ struct gb_interface {
 
        bool disconnected;
        bool ejected;
+       bool active;
        bool enabled;
 };
 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)