Commit 12169bc9 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: interface: prevent reactivation during removal

Make sure to prevent an interface that is going away from being
reactivated.

This is needed to preemptively close a race between the upcoming feature
to reactivate a powered-down interface and physical removal (i.e.
module_removed event processing) as well as logical removal (e.g. the
current system-suspend hack).
Reviewed-by: default avatarSandeep Patil <sspatil@google.com>
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarPatrick Titiano <ptitiano@baylibre.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 62491622
......@@ -873,7 +873,7 @@ static int _gb_interface_activate(struct gb_interface *intf,
*type = GB_INTERFACE_TYPE_UNKNOWN;
if (intf->ejected)
if (intf->ejected || intf->removed)
return -ENODEV;
ret = gb_interface_vsys_set(intf, true);
......
......@@ -53,6 +53,7 @@ struct gb_interface {
bool disconnected;
bool ejected;
bool removed;
bool active;
bool enabled;
bool mode_switch;
......
......@@ -186,6 +186,7 @@ static void gb_module_deregister_interface(struct gb_interface *intf)
intf->disconnected = true;
mutex_lock(&intf->mutex);
intf->removed = true;
gb_interface_disable(intf);
gb_interface_deactivate(intf);
mutex_unlock(&intf->mutex);
......
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