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: Sandeep Patil <sspatil@google.com> 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: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
62491622db
commit
12169bc914
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue