diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-04-23 18:47:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-04-25 11:08:30 -0700 |
commit | 36602a2981c85de7b0b8600eb12cbad3d80eacd9 (patch) | |
tree | 36d7d940d5c75957e5e0bc7fcaa67e6c18b2a532 /drivers/staging/greybus/svc.c | |
parent | b15d97d77017dc168c74c5e9aacfe14ff74dcbe9 (diff) |
greybus: module: implement controlled module removal
Implement controlled module removal through a new module attribute
"eject".
When a non-zero argument is written to the attribute, all interfaces of
the module are disabled (e.g. bundles are deregistered) and deactivated
(e.g. powered off) before instructing the SVC to physically eject the
module.
Note that the module device is not deregistered until the SVC has
reported the physical removal of all of its interfaces.
A new interface mutex is added to enforce interface state-change
serialisation.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/svc.c')
-rw-r--r-- | drivers/staging/greybus/svc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 94016954a6ab..96b3027db528 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -682,6 +682,8 @@ static void gb_svc_intf_reenable(struct gb_svc *svc, struct gb_interface *intf) { int ret; + mutex_lock(&intf->mutex); + /* Mark as disconnected to prevent I/O during disable. */ intf->disconnected = true; gb_interface_disable(intf); @@ -694,6 +696,8 @@ static void gb_svc_intf_reenable(struct gb_svc *svc, struct gb_interface *intf) gb_interface_deactivate(intf); } + + mutex_unlock(&intf->mutex); } static void gb_svc_process_intf_hotplug(struct gb_operation *operation) |