From: Johan Hovold Date: Sat, 23 Apr 2016 16:47:26 +0000 (+0200) Subject: greybus: interface: add active state flag X-Git-Tag: v4.9.8~1233^2~378^2~21^2~493 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e1565e5fee47362baee92506749d80167a1456e;p=platform%2Fkernel%2Flinux-rpi3.git greybus: interface: add active state flag Add active state flag to avoid deactivating an interface which is already off. Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index 2553312..e0c38f1 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -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; } /* diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h index 61399e7..c9c1c92 100644 --- a/drivers/staging/greybus/interface.h +++ b/drivers/staging/greybus/interface.h @@ -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)