Commit 1e1565e5 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: interface: add active state flag

Add active state flag to avoid deactivating an interface which is
already off.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 36602a29
...@@ -409,6 +409,8 @@ int gb_interface_activate(struct gb_interface *intf) ...@@ -409,6 +409,8 @@ int gb_interface_activate(struct gb_interface *intf)
if (ret) if (ret)
return ret; return ret;
intf->active = true;
return 0; return 0;
} }
...@@ -419,7 +421,12 @@ int gb_interface_activate(struct gb_interface *intf) ...@@ -419,7 +421,12 @@ int gb_interface_activate(struct gb_interface *intf)
*/ */
void gb_interface_deactivate(struct gb_interface *intf) void gb_interface_deactivate(struct gb_interface *intf)
{ {
if (!intf->active)
return;
gb_interface_route_destroy(intf); gb_interface_route_destroy(intf);
intf->active = false;
} }
/* /*
......
...@@ -43,6 +43,7 @@ struct gb_interface { ...@@ -43,6 +43,7 @@ struct gb_interface {
bool disconnected; bool disconnected;
bool ejected; bool ejected;
bool active;
bool enabled; bool enabled;
}; };
#define to_gb_interface(d) container_of(d, struct gb_interface, dev) #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
......
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